feature: made migration moe robust
This commit is contained in:
parent
2d42346823
commit
58a99456d9
2 changed files with 21 additions and 12 deletions
|
|
@ -4091,6 +4091,14 @@ class _PullRequestBase(BaseModel):
|
|||
"reviewer_data_json", MutationObj.as_mutable(JsonType(dialect_map=dict(mysql=UnicodeText(16384))))
|
||||
)
|
||||
|
||||
settings = Column(
|
||||
"settings_json",
|
||||
MutationObj.as_mutable(
|
||||
JsonType(dialect_map=dict(mysql=UnicodeText(16384))),
|
||||
),
|
||||
default=dict,
|
||||
)
|
||||
|
||||
@property
|
||||
def reviewer_data_json(self):
|
||||
return json.dumps(self.reviewer_data)
|
||||
|
|
|
|||
|
|
@ -27,19 +27,20 @@ def upgrade(migrate_engine):
|
|||
|
||||
UserModel: User = db.User
|
||||
|
||||
ghost_user = UserModel()
|
||||
ghost_user.name = UserModel.GHOST_USER.capitalize()
|
||||
ghost_user.username = UserModel.GHOST_USER
|
||||
ghost_user.lastname = "User"
|
||||
ghost_user.strict_creation_check = False
|
||||
ghost_user.email = UserModel.GHOST_USER_EMAIL
|
||||
ghost_user.active = False
|
||||
ghost_user.description = "System user to own assets of deleted users (does not consume license slot)"
|
||||
ghost_user.is_new_user = False
|
||||
if not User.get_by_username(UserModel.GHOST_USER):
|
||||
ghost_user = UserModel()
|
||||
ghost_user.name = UserModel.GHOST_USER.capitalize()
|
||||
ghost_user.username = UserModel.GHOST_USER
|
||||
ghost_user.lastname = "User"
|
||||
ghost_user.strict_creation_check = False
|
||||
ghost_user.email = UserModel.GHOST_USER_EMAIL
|
||||
ghost_user.active = False
|
||||
ghost_user.description = "System user to own assets of deleted users (does not consume license slot)"
|
||||
ghost_user.is_new_user = False
|
||||
|
||||
session = meta.Session()
|
||||
session.add(ghost_user)
|
||||
session.commit()
|
||||
session = meta.Session()
|
||||
session.add(ghost_user)
|
||||
session.commit()
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue