mirror of
https://github.com/rommapp/romm.git
synced 2026-03-03 02:37:02 +00:00
Merge pull request #2937 from rommapp/romfile-category-cheat
Add CHEAT to RomFile category types
This commit is contained in:
63
backend/alembic/versions/0067_romfile_category_enum_cheat.py
Normal file
63
backend/alembic/versions/0067_romfile_category_enum_cheat.py
Normal file
@@ -0,0 +1,63 @@
|
||||
"""Update rom_file.category column enum
|
||||
|
||||
Revision ID: 0067_romfile_category_enum_cheat
|
||||
Revises: 0066_fix_empty_flashpoint_id
|
||||
Create Date: 2026-01-25 10:03:00.00000
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
|
||||
from utils.database import is_postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "0067_romfile_category_enum_cheat"
|
||||
down_revision = "0066_fix_empty_flashpoint_id"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
connection = op.get_bind()
|
||||
|
||||
if is_postgresql(connection):
|
||||
rom_file_category_enum = ENUM(
|
||||
"GAME",
|
||||
"DLC",
|
||||
"HACK",
|
||||
"MANUAL",
|
||||
"PATCH",
|
||||
"UPDATE",
|
||||
"MOD",
|
||||
"DEMO",
|
||||
"TRANSLATION",
|
||||
"PROTOTYPE",
|
||||
"CHEAT",
|
||||
name="romfilecategory",
|
||||
create_type=False,
|
||||
)
|
||||
rom_file_category_enum.create(connection, checkfirst=True)
|
||||
else:
|
||||
rom_file_category_enum = sa.Enum(
|
||||
"GAME",
|
||||
"DLC",
|
||||
"HACK",
|
||||
"MANUAL",
|
||||
"PATCH",
|
||||
"UPDATE",
|
||||
"MOD",
|
||||
"DEMO",
|
||||
"TRANSLATION",
|
||||
"PROTOTYPE",
|
||||
"CHEAT",
|
||||
name="romfilecategory",
|
||||
)
|
||||
|
||||
with op.batch_alter_table("rom_files", schema=None) as batch_op:
|
||||
batch_op.alter_column("category", type_=rom_file_category_enum, nullable=True)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
@@ -47,6 +47,7 @@ class RomFileCategory(enum.StrEnum):
|
||||
DEMO = "demo"
|
||||
TRANSLATION = "translation"
|
||||
PROTOTYPE = "prototype"
|
||||
CHEAT = "cheat"
|
||||
|
||||
|
||||
class SiblingRom(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user