"""create_project_tables Revision ID: f5772dd5cd55 Revises: 32b02c118683 Create Date: 2026-05-31 13:59:30.308076 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = 'f5772dd5cd55' down_revision: Union[str, None] = '32b02c118683' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('projects', sa.Column('id', sa.String(length=36), nullable=False), sa.Column('account_id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('status', sa.String(length=20), nullable=False), sa.Column('start_date', sa.DateTime(timezone=True), nullable=True), sa.Column('end_date', sa.DateTime(timezone=True), nullable=True), sa.Column('budget', sa.Float(), nullable=True), sa.Column('total_costs', sa.Float(), nullable=False), sa.Column('notes', sa.Text(), nullable=True), sa.Column('custom_fields', sa.Text(), nullable=True), sa.Column('custom_field_defs', sa.Text(), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), sa.ForeignKeyConstraint(['account_id'], ['accounts.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('project_function_groups', sa.Column('id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('project_id', sa.String(length=36), nullable=False), sa.Column('sort_order', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('sub_projects', sa.Column('id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('project_id', sa.String(length=36), nullable=False), sa.Column('parent_id', sa.String(length=36), nullable=True), sa.Column('sort_order', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['parent_id'], ['sub_projects.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) op.create_table('project_functions', sa.Column('id', sa.String(length=36), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('function_group_id', sa.String(length=36), nullable=False), sa.Column('quantity', sa.Float(), nullable=False), sa.Column('daily_costs', sa.Float(), nullable=False), sa.Column('total_costs', sa.Float(), nullable=False), sa.Column('sort_order', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['function_group_id'], ['project_function_groups.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id') ) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_table('project_functions') op.drop_table('sub_projects') op.drop_table('project_function_groups') op.drop_table('projects') # ### end Alembic commands ###