43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
"""add invitiations
|
|
|
|
Revision ID: 25bcba9b99a9
|
|
Revises: c99026ab9918
|
|
Create Date: 2018-10-23 15:03:12.641069
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '25bcba9b99a9'
|
|
down_revision = 'c99026ab9918'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('invitations',
|
|
sa.Column('time_created', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
sa.Column('time_updated', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
sa.Column('id', postgresql.UUID(as_uuid=True), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
|
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
|
|
sa.Column('workspace_id', postgresql.UUID(as_uuid=True), nullable=True),
|
|
sa.Column('valid', sa.Boolean(), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
|
sa.ForeignKeyConstraint(['workspace_id'], ['workspaces.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_invitations_user_id'), 'invitations', ['user_id'], unique=False)
|
|
op.create_index(op.f('ix_invitations_workspace_id'), 'invitations', ['workspace_id'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_invitations_workspace_id'), table_name='invitations')
|
|
op.drop_index(op.f('ix_invitations_user_id'), table_name='invitations')
|
|
op.drop_table('invitations')
|
|
# ### end Alembic commands ###
|