This commit is contained in:
Iain Learmonth 2023-05-31 15:55:46 +01:00
parent f91f7e5274
commit bda9e387c1

View file

@ -21,7 +21,7 @@ def upgrade():
sql = text("""INSERT INTO pool VALUES (
-1, 'Hot spares (reserve)', NOW(), NOW(), NULL, 'hotspare',
md5(to_char(NOW(), 'YYYY-MM-DD HH24:MI:SS.US')), NULL) ON CONFLICT (id) DO NOTHING;""")
elif op.get_context().dialect == 'sqlite':
elif op.get_context().dialect.name == 'sqlite':
sql = text(f"""INSERT OR IGNORE INTO pool VALUES (
-1, 'Hot spares (reserve)', datetime('now'), datetime('now'), NULL, 'hotspare',
CAST(RANDOM() AS TEXT), NULL);""")
@ -30,6 +30,7 @@ def upgrade():
"You could do this migration manually.")
op.execute(sql)
def downgrade():
# SQL to undo the changes
sql = text("""DELETE FROM pool WHERE id = -1;""")