Fix migration

This commit is contained in:
rubenwardy 2021-11-25 10:51:54 +00:00
parent a04b2542b5
commit 95c0fb8a70
2 changed files with 6 additions and 10 deletions

@ -11,6 +11,11 @@ def populate(session):
admin_user.rank = UserRank.ADMIN admin_user.rank = UserRank.ADMIN
session.add(admin_user) session.add(admin_user)
system_user = User("ContentDB", active=False)
system_user.email_confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
system_user.rank = UserRank.BOT
session.add(system_user)
session.add(MinetestRelease("None", 0)) session.add(MinetestRelease("None", 0))
session.add(MinetestRelease("0.4.16/17", 32)) session.add(MinetestRelease("0.4.16/17", 32))
session.add(MinetestRelease("5.0", 37)) session.add(MinetestRelease("5.0", 37))
@ -22,7 +27,7 @@ def populate(session):
for tag in ["Inventory", "Mapgen", "Building", for tag in ["Inventory", "Mapgen", "Building",
"Mobs and NPCs", "Tools", "Player effects", "Mobs and NPCs", "Tools", "Player effects",
"Environment", "Transport", "Maintenance", "Plants and farming", "Environment", "Transport", "Maintenance", "Plants and farming",
"PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]: "PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer", "Featured"]:
row = Tag(tag) row = Tag(tag)
tags[row.name] = row tags[row.name] = row
session.add(row) session.add(row)

@ -25,15 +25,6 @@ def upgrade():
op.execute("COMMIT") op.execute("COMMIT")
op.execute("ALTER TYPE userrank ADD VALUE 'BOT' AFTER 'EDITOR'") op.execute("ALTER TYPE userrank ADD VALUE 'BOT' AFTER 'EDITOR'")
conn = op.get_bind()
system_user = User("ContentDB", active=False)
system_user.email_confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
system_user.rank = UserRank.BOT
session = orm.Session(bind=conn)
session.add(system_user)
session.commit()
def downgrade(): def downgrade():
pass pass