mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
Add user_uid column to file_data table
This commit is contained in:
parent
7406bf7da1
commit
23be257db0
@ -69,6 +69,7 @@ class FileDataModel(db.Model):
|
|||||||
date_created = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
date_created = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
||||||
file_model_id = db.Column(db.Integer, db.ForeignKey('file.id'))
|
file_model_id = db.Column(db.Integer, db.ForeignKey('file.id'))
|
||||||
file_model = db.relationship("FileModel", foreign_keys=[file_model_id])
|
file_model = db.relationship("FileModel", foreign_keys=[file_model_id])
|
||||||
|
user_uid = db.Column(db.String, db.ForeignKey('user.uid'), nullable=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
27
migrations/versions/30e017a03948_.py
Normal file
27
migrations/versions/30e017a03948_.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
"""add user_uid column to file_data table
|
||||||
|
|
||||||
|
Revision ID: 30e017a03948
|
||||||
|
Revises: bbf064082623
|
||||||
|
Create Date: 2021-07-06 10:39:04.661704
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '30e017a03948'
|
||||||
|
down_revision = 'bbf064082623'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.add_column('file_data', sa.Column('user_uid', sa.String(), nullable=True))
|
||||||
|
op.create_foreign_key(None, 'file_data', 'user', ['user_uid'], ['uid'])
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# op.drop_constraint('file_data_user_uid_fkey', 'file_data', type_='foreignkey')
|
||||||
|
# op.execute("update file_data set user_uid = NULL WHERE user_uid IS NOT NULL")
|
||||||
|
op.drop_column('file_data', 'user_uid')
|
Loading…
x
Reference in New Issue
Block a user