"""Initial migration Revision ID: e086ef589d03 Revises: Create Date: 2024-05-11 12:30:52.296666 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'e086ef589d03' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('organizations', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('users', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('name', sa.String(length=128), nullable=True), sa.Column('email', sa.String(length=128), nullable=False), sa.Column('password', sa.String(length=256), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email') ) op.create_table('document_folders', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('organization_id', sa.Integer(), nullable=True), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_by', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['created_by'], ['users.id'], ), sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name', 'organization_id') ) op.create_table('organization_roles', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('organization_id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('role', sa.String(length=128), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('organization_id', 'user_id') ) op.create_table('documents', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('organization_id', sa.Integer(), nullable=False), sa.Column('folder_id', sa.Integer(), nullable=True), sa.Column('title', sa.String(length=128), nullable=True), sa.Column('slug', sa.String(length=128), nullable=False), sa.Column('search_query', sa.String(length=128), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('created_by', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['created_by'], ['users.id'], ), sa.ForeignKeyConstraint(['folder_id'], ['document_folders.id'], ), sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('slug') ) op.create_table('document_drafts', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('document_id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('content', sa.String(length=128), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['document_id'], ['documents.id'], ), sa.PrimaryKeyConstraint('id') ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('document_drafts') op.drop_table('documents') op.drop_table('organization_roles') op.drop_table('document_folders') op.drop_table('users') op.drop_table('organizations') # ### end Alembic commands ###