mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Migration to add folder_permissions to invited_users table
Added a new JSONB column, folder_permissions, to the invited_users table to store a list of folders that an invited user can see. This is nullable for now, but will be changed to be non-nullable and back-populated later.
This commit is contained in:
@@ -8,7 +8,8 @@ from sqlalchemy.ext.associationproxy import association_proxy
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
from sqlalchemy.dialects.postgresql import (
|
||||
UUID,
|
||||
JSON
|
||||
JSON,
|
||||
JSONB,
|
||||
)
|
||||
from sqlalchemy import UniqueConstraint, CheckConstraint, Index
|
||||
from notifications_utils.columns import Columns
|
||||
@@ -1692,6 +1693,7 @@ class InvitedUser(db.Model):
|
||||
nullable=False,
|
||||
default=SMS_AUTH_TYPE
|
||||
)
|
||||
folder_permissions = db.Column(JSONB(none_as_null=True), nullable=True, default=[])
|
||||
|
||||
# would like to have used properties for this but haven't found a way to make them
|
||||
# play nice with marshmallow yet
|
||||
|
||||
21
migrations/versions/0280_invited_user_folder_perms.py
Normal file
21
migrations/versions/0280_invited_user_folder_perms.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0280_invited_user_folder_perms
|
||||
Revises: 0279_remove_fk_to_users
|
||||
Create Date: 2019-03-11 14:38:28.010082
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0280_invited_user_folder_perms'
|
||||
down_revision = '0279_remove_fk_to_users'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('invited_users', sa.Column('folder_permissions', postgresql.JSONB(none_as_null=True, astext_type=sa.Text()), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('invited_users', 'folder_permissions')
|
||||
Reference in New Issue
Block a user