add alembic migration

This commit is contained in:
justcool393 2023-07-12 12:43:45 -05:00
parent 6b114571bb
commit 94db9eeefb

View file

@ -0,0 +1,118 @@
"""get rid of unused badges
Revision ID: 81af51e4e42b
Revises: ea282d7c711c
Create Date: 2023-07-12 17:20:36.195291+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '81af51e4e42b'
down_revision = 'ea282d7c711c'
branch_labels = None
depends_on = None
def upgrade():
# drop lootbox and agendaposter columns then...
op.drop_column('users', 'lootboxes_bought')
op.drop_column('users', 'agendaposter')
# drop early badges then...
for i in range(16, 17 + 1):
op.execute(f"DELETE FROM badge_defs WHERE id={i};")
# update patron badges then...
desc_map: dict[int, str] = {
21: "Patron I",
22: "Patron II",
23: "Patron III",
24: "Patron IV",
25: "Patron V",
26: "Patron VI",
}
for id, desc in desc_map.items():
op.execute(f"UPDATE badge_defs SET name='{desc}' WHERE id={id};")
# delete late badges! :)
for i in range(59, 105 + 1):
op.execute(f"DELETE FROM badge_defs WHERE id={i};")
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('agendaposter', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False))
op.add_column('users', sa.Column('lootboxes_bought', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False))
table: sa.sql.expression.TableClause = sa.table(
"badge_defs",
sa.column("id"), sa.column("name"), sa.column("description"),
)
op.bulk_insert(table, [
{"id": 16, "name": "Marsey Master", "description": "Contributed 10 (or more!!!!) Marsey emojis ✨",},
{"id": 17, "name": "Marsey Artisan", "description": "Contributed a Marsey emoji ✨",},
{"id": 21, "name": "Paypig", "description": "Contributed at least $5",},
{"id": 22, "name": "Renthog", "description": "Contributed at least $10",},
{"id": 23, "name": "Landchad", "description": "Contributed at least $20",},
{"id": 24, "name": "Terminally online turboautist", "description": "Contributed at least $50",},
{"id": 25, "name": "Marsey''s Sugar Daddy", "description": "Contributed at least $100",},
{"id": 26, "name": "JIDF Bankroller", "description": "Contributed at least $250",},
{"id": 27, "name": "Rich Bich", "description": "Contributed at least $500",},
{"id": 28, "name": "Chud", "description": "Forced to use the chud theme",},
{"id": 59, "name": "Lolcow", "description": "Beautiful and valid milk provider",},
{"id": 60, "name": "Unironically Retarded", "description": "Demonstrated a wholesale inability to read the room",},
{"id": 61, "name": "Lab Rat", "description": "Helped test features in development",},
{"id": 62, "name": "Master Baiter", "description": "For outstanding achievement in the field of catching fish",},
{"id": 63, "name": "Balls", "description": "I wrote carp on my balls as a sign of submission",},
{"id": 64, "name": "The Other Kind Of Good Journalist", "description": "Contributed positive media attention to the site",},
{"id": 65, "name": "2021 Spooooooky Marsey Artist", "description": "Contributed a VERY SCARY Marsey for Halloween 2021!",},
{"id": 66, "name": "Sk8r Boi", "description": "Certifies that this user is NOT a poser",},
{"id": 67, "name": "Unpausable", "description": "Spent 40,000 coins on an unpausable profile anthem",},
{"id": 68, "name": "Pause Button", "description": "Spent 20,000 coins on a profile anthem pause button",},
{"id": 69, "name": "Little Big Spender", "description": "Dropped 10,000 coins at the shop",},
{"id": 70, "name": "Big Spender", "description": "Dropped 100,000 coins at the shop",},
{"id": 71, "name": "Big Big Spender", "description": "Dropped 250,000 coins at the shop",},
{"id": 72, "name": "Big Big Big Spender", "description": "Dropped 500,000 coins at the shop",},
{"id": 73, "name": "Le Rich Gentlesir", "description": "Spent a fucking million coins at the shop",},
{"id": 74, "name": "Grass Toucher", "description": "Awarded for molesting plant life",},
{"id": 75, "name": "Halloween 21", "description": "Awarded for surviving Homoween 2021",},
{"id": 76, "name": "Low Roller", "description": "Bought 10 lootboxes",},
{"id": 77, "name": "Middle Roller", "description": "Bought 50 lootboxes",},
{"id": 78, "name": "High Roller", "description": "Bought 150 lootboxes",},
{"id": 79, "name": "Merchant", "description": "Contributed a new line of product to Marsey''s Coin Emporium",},
{"id": 80, "name": "Artist Laureate", "description": "",},
{"id": 81, "name": "Patron of the Arts", "description": "Sponsored the creation of an approved Marsey",},
{"id": 83, "name": "All-Seeing Eye", "description": "Can view private profiles",},
{"id": 84, "name": "Alt-Seeing Eye", "description": "Can see alts",},
{"id": 85, "name": "Sigma User", "description": "",},
{"id": 86, "name": "Holly Jolly Marsey Artist", "description": "Contributed a VERY JOLLY Marsey for Christmas 2021!",},
{"id": 87, "name": "Unblockable", "description": "This user is unblockable",},
{"id": 88, "name": "Provider", "description": "This user provided a bountiful feast for Thanksgiving",},
{"id": 89, "name": "Dinner", "description": "Yes, it is edible",},
{"id": 90, "name": "Fish", "description": "This user cannot be unfollowed",},
{"id": 91, "name": "Grinch", "description": "This user is a joyless grinch who pays money to avoid having fun",},
{"id": 92, "name": "NFT Artist", "description": "Drew a marsey that was used as an NFT",},
{"id": 93, "name": "NFT Owner", "description": "Bought a marsey NFT",},
{"id": 94, "name": "Progressive Stack Award", "description": "Upvotes/downvotes on this user''s posts and comments have double the ranking effect",},
{"id": 95, "name": "Bird Site Award", "description": "This user is limited to 140 characters",},
{"id": 96, "name": "Flairlock Award", "description": "This user''s flair has been locked by someone else",},
{"id": 97, "name": "Pizzashill Award", "description": "This user has to make their posts and comments more than 280 characters",},
{"id": 98, "name": "Marsey Award", "description": "This user is limited to posting marseys",},
{"id": 99, "name": "Sidebar Artist", "description": "Contributed artwork featured on the sidebar",},
{"id": 100, "name": "True Believer", "description": "This user sees through communist lies",},
{"id": 101, "name": "Banner Artist", "description": "Contributed a banner image to the site",},
{"id": 102, "name": "Christmas 21", "description": "Awarded for surviving Fistmas 2021",},
{"id": 103, "name": "Benefactor", "description": "Gave the Benefactor award to someone",},
{"id": 104, "name": "BADASS OUTLAW", "description": "Bad boy who does not play by the rules",},
{"id": 105, "name": "SCAM", "description": "lmao get fucked retard",}
])
# ### end Alembic commands ###