23 lines
524 B
Python
23 lines
524 B
Python
|
|
import sqlite3
|
||
|
|
|
||
|
|
conn = sqlite3.connect('db.sqlite3')
|
||
|
|
cursor = conn.cursor()
|
||
|
|
|
||
|
|
cursor.execute('''
|
||
|
|
INSERT INTO core_familymember (name, created_at, updated_at)
|
||
|
|
VALUES ('默认成员', datetime('now', 'localtime'), datetime('now', 'localtime'));
|
||
|
|
''')
|
||
|
|
|
||
|
|
cursor.execute('''
|
||
|
|
ALTER TABLE core_insightrecord ADD COLUMN speaker_id INTEGER NOT NULL DEFAULT 1;
|
||
|
|
''')
|
||
|
|
|
||
|
|
cursor.execute('''
|
||
|
|
ALTER TABLE core_todayplan ADD COLUMN speaker_id INTEGER NOT NULL DEFAULT 1;
|
||
|
|
''')
|
||
|
|
|
||
|
|
conn.commit()
|
||
|
|
conn.close()
|
||
|
|
|
||
|
|
print("Database updated successfully!")
|