revise migration chain
This commit is contained in:
parent
848bbf9c12
commit
2aa3fbb129
@ -1,7 +1,7 @@
|
||||
"""add provisional column to users
|
||||
|
||||
Revision ID: 5284ac1ac77c
|
||||
Revises: 25bcba9b99a9
|
||||
Revises: e0fc3cd315c1
|
||||
Create Date: 2018-10-25 11:04:49.879393
|
||||
|
||||
"""
|
||||
@ -11,7 +11,7 @@ import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5284ac1ac77c'
|
||||
down_revision = '25bcba9b99a9'
|
||||
down_revision = 'e0fc3cd315c1'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""add invitations
|
||||
|
||||
Revision ID: 25bcba9b99a9
|
||||
Revision ID: 994a80ee92c9
|
||||
Revises: 9c24c609878a
|
||||
Create Date: 2018-10-23 15:03:12.641069
|
||||
Create Date: 2018-10-30 16:49:53.688621
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '25bcba9b99a9'
|
||||
revision = '994a80ee92c9'
|
||||
down_revision = '9c24c609878a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@ -23,28 +23,28 @@ def upgrade():
|
||||
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('status', sa.Enum('ACCEPTED', 'REVOKED', 'PENDING', 'REJECTED', name='status', native_enum=False), nullable=True),
|
||||
sa.Column('workspace_role_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('inviter_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('token', sa.String(), nullable=True),
|
||||
sa.Column('status', sa.Enum('ACCEPTED', 'REVOKED', 'PENDING', 'REJECTED', name='status', native_enum=False), nullable=True),
|
||||
sa.Column('expiration_time', sa.TIMESTAMP(timezone=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.Column('token', sa.String(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['inviter_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['workspace_id'], ['workspaces.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.ForeignKeyConstraint(['workspace_role_id'], ['workspace_roles.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_inviter_id'), 'invitations', ['inviter_id'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_workspace_id'), 'invitations', ['workspace_id'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_token'), 'invitations', ['token'], unique=True)
|
||||
op.create_index(op.f('ix_invitations_token'), 'invitations', ['token'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_user_id'), 'invitations', ['user_id'], unique=False)
|
||||
op.create_index(op.f('ix_invitations_workspace_role_id'), 'invitations', ['workspace_role_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_workspace_role_id'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_user_id'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_inviter_id'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_token'), table_name='invitations')
|
||||
op.drop_index(op.f('ix_invitations_inviter_id'), table_name='invitations')
|
||||
op.drop_table('invitations')
|
||||
# ### end Alembic commands ###
|
@ -1,42 +0,0 @@
|
||||
"""change invitation relationship to workspace role
|
||||
|
||||
Revision ID: d1ea7f3ee4be
|
||||
Revises: 5284ac1ac77c
|
||||
Create Date: 2018-10-30 14:09:42.277467
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd1ea7f3ee4be'
|
||||
down_revision = '5284ac1ac77c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('invitations', sa.Column('workspace_role_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.create_index(op.f('ix_invitations_workspace_role_id'), 'invitations', ['workspace_role_id'], unique=False)
|
||||
op.drop_index('ix_invitations_token', table_name='invitations')
|
||||
op.create_index(op.f('ix_invitations_token'), 'invitations', ['token'], unique=False)
|
||||
op.drop_index('ix_invitations_workspace_id', table_name='invitations')
|
||||
op.drop_constraint('invitations_workspace_id_fkey', 'invitations', type_='foreignkey')
|
||||
op.create_foreign_key(None, 'invitations', 'workspace_roles', ['workspace_role_id'], ['id'])
|
||||
op.drop_column('invitations', 'workspace_id')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('invitations', sa.Column('workspace_id', postgresql.UUID(), autoincrement=False, nullable=True))
|
||||
op.drop_constraint(None, 'invitations', type_='foreignkey')
|
||||
op.create_foreign_key('invitations_workspace_id_fkey', 'invitations', 'workspaces', ['workspace_id'], ['id'])
|
||||
op.create_index('ix_invitations_workspace_id', 'invitations', ['workspace_id'], unique=False)
|
||||
op.drop_index(op.f('ix_invitations_token'), table_name='invitations')
|
||||
op.create_index('ix_invitations_token', 'invitations', ['token'], unique=True)
|
||||
op.drop_index(op.f('ix_invitations_workspace_role_id'), table_name='invitations')
|
||||
op.drop_column('invitations', 'workspace_role_id')
|
||||
# ### end Alembic commands ###
|
@ -1,7 +1,7 @@
|
||||
"""add status to workspace_roles
|
||||
|
||||
Revision ID: e0fc3cd315c1
|
||||
Revises: d1ea7f3ee4be
|
||||
Revises: 994a80ee92c9
|
||||
Create Date: 2018-10-30 14:36:51.047876
|
||||
|
||||
"""
|
||||
@ -11,7 +11,7 @@ import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e0fc3cd315c1'
|
||||
down_revision = 'd1ea7f3ee4be'
|
||||
down_revision = '994a80ee92c9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user