_ensure_col. Internal helper function. This docstring was expanded to make future maintenance easier. Args: table: Parameter. col: Parameter. ddl: Parameter. Returns: Varies.
(table: str, col: str, ddl: str)
| 736 | This docstring was added automatically to improve maintainability. |
| 737 | |
| 738 | Returns: |
| 739 | Varies. |
| 740 | """ |
| 741 | return datetime.utcnow().isoformat(timespec="seconds") + "Z" |
| 742 | |
| 743 | def db_init(): |
| 744 | """db_init. |
| 745 | |
| 746 | Database helper for connecting to or initializing the SQLite database. |
| 747 | |
| 748 | This docstring was expanded to make future maintenance easier. |
| 749 | |
| 750 | Returns: |
| 751 | Varies. |
| 752 | """ |
| 753 | conn = db_connect() |
| 754 | cur = conn.cursor() |
| 755 | |
| 756 | cur.execute(""" |
| 757 | CREATE TABLE IF NOT EXISTS users ( |
| 758 | id INTEGER PRIMARY KEY AUTOINCREMENT, |
| 759 | username TEXT UNIQUE NOT NULL, |
| 760 | pw_hash TEXT NOT NULL, |
| 761 | is_admin INTEGER NOT NULL DEFAULT 0, |