Merge module/db
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
DB_PATH = 'app.db'
|
||||
|
||||
def migrate():
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
cursor = conn.cursor()
|
||||
|
||||
with open('schema.sql', 'r') as f:
|
||||
cursor.executescript(f.read())
|
||||
|
||||
with open('seed.sql', 'r') as f:
|
||||
cursor.executescript(f.read())
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print(f"Database migrated: {DB_PATH}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
migrate()
|
||||
Reference in New Issue
Block a user