fix(migration): only use on conflict with postgresql
This commit is contained in:
parent
51779b6cc3
commit
c013fe72e6
1 changed files with 6 additions and 3 deletions
|
@ -16,10 +16,13 @@ depends_on = None
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# Add SQL here
|
if op.get_context().dialect.name == 'postgresql':
|
||||||
sql = text("""INSERT INTO pool VALUES (
|
on_conflict = " ON CONFLICT (id) DO NOTHING"
|
||||||
|
else:
|
||||||
|
on_conflict = ""
|
||||||
|
sql = text(f"""INSERT INTO pool VALUES (
|
||||||
-1, 'Hot spares (reserve)', NOW(), NOW(), NULL, 'hotspare',
|
-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;""")
|
md5(to_char(NOW(), 'YYYY-MM-DD HH24:MI:SS.US')), NULL){on_conflict};""")
|
||||||
op.execute(sql)
|
op.execute(sql)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue