mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
* add: use ruff instead of flake8 * Update ruff switches and remove flake8 plugins * fix: ignore linting rules * fix: ignore I001 * fix: spaces before noqa --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
"""Add Fields and FieldEntries tables
|
|
|
|
Revision ID: 75e8ab9a0014
|
|
Revises: 0366ba6575ca
|
|
Create Date: 2020-08-19 00:36:17.579497
|
|
|
|
"""
|
|
from alembic import op # noqa: I001
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "75e8ab9a0014"
|
|
down_revision = "0366ba6575ca"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"fields",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("name", sa.Text(), nullable=True),
|
|
sa.Column("type", sa.String(length=80), nullable=True),
|
|
sa.Column("field_type", sa.String(length=80), nullable=True),
|
|
sa.Column("description", sa.Text(), nullable=True),
|
|
sa.Column("required", sa.Boolean(), nullable=True),
|
|
sa.Column("public", sa.Boolean(), nullable=True),
|
|
sa.Column("editable", sa.Boolean(), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"field_entries",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("type", sa.String(length=80), nullable=True),
|
|
sa.Column("value", sa.JSON(), nullable=True),
|
|
sa.Column("field_id", sa.Integer(), nullable=True),
|
|
sa.Column("user_id", sa.Integer(), nullable=True),
|
|
sa.Column("team_id", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(["field_id"], ["fields.id"], ondelete="CASCADE"),
|
|
sa.ForeignKeyConstraint(["team_id"], ["teams.id"], ondelete="CASCADE"),
|
|
sa.ForeignKeyConstraint(["user_id"], ["users.id"], ondelete="CASCADE"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table("field_entries")
|
|
op.drop_table("fields")
|
|
# ### end Alembic commands ###
|