Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""adds template_type to projects

Revision ID: e145eeeae58e
Revises: 0d52976dc616
Create Date: 2025-05-13 09:35:41.864576+00:00

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "e145eeeae58e"
down_revision = "0d52976dc616"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"projects",
sa.Column(
"template_type",
sa.Enum("TEMPLATE", "STANDARD", name="projecttype"),
nullable=True,
),
)
# Update existing template projects
op.execute("UPDATE projects SET template_type='TEMPLATE' WHERE type='TEMPLATE'")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("projects", "template_type")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class ProjectType(enum.Enum):
STANDARD = "STANDARD"


class ProjectTemplateType(enum.Enum):
TEMPLATE = "TEMPLATE"
TUTORIAL = "TUTORIAL"
HYPERTOOL = "HYPERTOOL"


projects = sa.Table(
"projects",
metadata,
Expand All @@ -29,6 +35,13 @@ class ProjectType(enum.Enum):
default=ProjectType.STANDARD,
doc="Either standard or template types",
),
sa.Column(
"template_type",
sa.Enum(ProjectType),
nullable=True,
default=None,
doc="None if type is STANDARD, otherwise it is one of the ProjectTemplateType",
),
sa.Column(
"uuid",
sa.String,
Expand Down
Loading