app: add SQLite schema and db helper (WAL, busy_timeout, four tables + indexes)
This commit is contained in:
20
app/init.py
Normal file
20
app/init.py
Normal 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())
|
||||
Reference in New Issue
Block a user