import user model changes from authnid
This commit is contained in:
parent
5b8eb03f4e
commit
0f8e303afa
38
alembic/versions/1f57f784ed5b_update_user_from_authnid.py
Normal file
38
alembic/versions/1f57f784ed5b_update_user_from_authnid.py
Normal file
@ -0,0 +1,38 @@
|
||||
"""update_user_from_authnid
|
||||
|
||||
Revision ID: 1f57f784ed5b
|
||||
Revises: 55ba973d08b9
|
||||
Create Date: 2018-07-30 16:53:05.945005
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1f57f784ed5b'
|
||||
down_revision = '55ba973d08b9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('dod_id', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('email', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('first_name', sa.String(), nullable=True))
|
||||
op.add_column('users', sa.Column('last_name', sa.String(), nullable=True))
|
||||
op.create_unique_constraint(None, 'users', ['dod_id'])
|
||||
op.create_unique_constraint(None, 'users', ['email'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'users', type_='unique')
|
||||
op.drop_constraint(None, 'users', type_='unique')
|
||||
op.drop_column('users', 'last_name')
|
||||
op.drop_column('users', 'first_name')
|
||||
op.drop_column('users', 'email')
|
||||
op.drop_column('users', 'dod_id')
|
||||
# ### end Alembic commands ###
|
@ -1,4 +1,4 @@
|
||||
from sqlalchemy import String, ForeignKey, Column
|
||||
from sqlalchemy import String, ForeignKey, Column, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
@ -16,6 +16,11 @@ class User(Base):
|
||||
atat_role = relationship("Role")
|
||||
workspace_roles = relationship("WorkspaceRole", backref="user")
|
||||
|
||||
email = Column(String, unique=True)
|
||||
dod_id = Column(String, unique=True)
|
||||
first_name = Column(String)
|
||||
last_name = Column(String)
|
||||
|
||||
@property
|
||||
def atat_permissions(self):
|
||||
return self.atat_role.permissions
|
||||
|
Loading…
x
Reference in New Issue
Block a user