22 lines
413 B
Python
22 lines
413 B
Python
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()
|