Add collection of user metadata: name and company
This commit is contained in:
parent
909be766c9
commit
0f2eb61f4a
14 changed files with 178 additions and 33 deletions
|
@ -0,0 +1,44 @@
|
|||
"""Add user metadata fields
|
||||
|
||||
Revision ID: 491a530df230
|
||||
Revises: 6c7014e84a5e
|
||||
Create Date: 2016-11-04 18:03:05.237408
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '491a530df230'
|
||||
down_revision = '6c7014e84a5e'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from util.migrate import UTF8CharField
|
||||
|
||||
def upgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('user', sa.Column('company', UTF8CharField(length=255), nullable=True))
|
||||
op.add_column('user', sa.Column('name', UTF8CharField(length=255), nullable=True))
|
||||
### end Alembic commands ###
|
||||
|
||||
op.bulk_insert(tables.userpromptkind,
|
||||
[
|
||||
{'name':'enter_name'},
|
||||
{'name':'enter_company'},
|
||||
])
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('user', 'name')
|
||||
op.drop_column('user', 'company')
|
||||
### end Alembic commands ###
|
||||
|
||||
op.execute(
|
||||
(tables.userpromptkind.delete()
|
||||
.where(tables.userpromptkind.c.name == op.inline_literal('enter_name')))
|
||||
)
|
||||
|
||||
op.execute(
|
||||
(tables.userpromptkind.delete()
|
||||
.where(tables.userpromptkind.c.name == op.inline_literal('enter_company')))
|
||||
)
|
Reference in a new issue