Dump changes
This commit is contained in:
parent
b49c6ced26
commit
a4b572dcc7
40 changed files with 186 additions and 37 deletions
39
app/migrations/versions/2a84260bc774_add_roles.py
Normal file
39
app/migrations/versions/2a84260bc774_add_roles.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"""Add roles
|
||||
|
||||
Revision ID: 2a84260bc774
|
||||
Revises: 646ae6f3e17a
|
||||
Create Date: 2021-02-28 23:06:29.207602
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2a84260bc774'
|
||||
down_revision = '646ae6f3e17a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('roles',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=64), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('creation_date', sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.add_column('users', sa.Column('role_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'users', 'roles', ['role_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'users', type_='foreignkey')
|
||||
op.drop_column('users', 'role_id')
|
||||
op.drop_table('roles')
|
||||
# ### end Alembic commands ###
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue