app: add SQLite schema and db helper (WAL, busy_timeout, four tables + indexes)

This commit is contained in:
Torres
2026-11-10 18:57:17 -04:00
parent 670648b17a
commit 5bf180c4c6
4 changed files with 104 additions and 0 deletions

20
app/init.py Normal file
View File

@@ -0,0 +1,20 @@
"""Explicit DB init path: python3 -m app.init --db <path>."""
import argparse
import sys
from . import db
def main(argv=None):
ap = argparse.ArgumentParser(description='Initialize the Bike-Tinder DB')
ap.add_argument('--db', default='data/bike-tinder.sqlite3')
args = ap.parse_args(argv)
conn = db.connect(args.db)
db.init_db(conn)
conn.close()
print('init: schema applied to %s' % args.db)
return 0
if __name__ == '__main__':
sys.exit(main())