more migration
This commit is contained in:
parent
2c3aa660bf
commit
66966570de
1 changed files with 2 additions and 1 deletions
|
@ -131,6 +131,7 @@ class User(db.Model):
|
||||||
def migrate_id(self, service_id):
|
def migrate_id(self, service_id):
|
||||||
if len(service_id) == 16:
|
if len(service_id) == 16:
|
||||||
statements = [
|
statements = [
|
||||||
|
"DELETE FROM user WHERE id = '{nid}'",
|
||||||
"UPDATE user SET id = '{nid}' WHERE id = '{oid}'",
|
"UPDATE user SET id = '{nid}' WHERE id = '{oid}'",
|
||||||
"UPDATE list SET user_id = '{nid}' WHERE user_id = '{oid}'",
|
"UPDATE list SET user_id = '{nid}' WHERE user_id = '{oid}'",
|
||||||
"UPDATE useritem SET user_id = '{nid}' WHERE user_id = '{oid}'",
|
"UPDATE useritem SET user_id = '{nid}' WHERE user_id = '{oid}'",
|
||||||
|
@ -138,7 +139,7 @@ class User(db.Model):
|
||||||
]
|
]
|
||||||
with db.session() as session:
|
with db.session() as session:
|
||||||
for sql in statements:
|
for sql in statements:
|
||||||
session.connection().execut(sql.format(oid=self.id, nid=service_id))
|
session.connection().execute(sql.format(oid=self.id, nid=service_id))
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
list_items = sa.Table('listitem', db.metadata,
|
list_items = sa.Table('listitem', db.metadata,
|
||||||
|
|
Loading…
Reference in a new issue