-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb8093c
commit 8f5ba8d
Showing
4 changed files
with
92 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Add user roles | ||
Revision ID: 1a0ea61b9a91 | ||
Revises: 44f16b57d26f | ||
Create Date: 2015-11-23 12:54:42.724658 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '1a0ea61b9a91' | ||
down_revision = '44f16b57d26f' | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy import DDL | ||
|
||
from digital_ale.models import ArrayOfEnum | ||
|
||
|
||
def upgrade(): | ||
#alembic doesn't create Enum if nested in Array | ||
op.execute(DDL("CREATE TYPE user_role as ENUM('admin', 'editor')")) | ||
### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('tbl_user', sa.Column('roles', ArrayOfEnum(sa.Enum('admin', 'editor', name='user_role')), nullable=True)) | ||
### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
op.execute(DDL('Drop type user_role')) | ||
### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('tbl_user', 'roles') | ||
### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters