mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
More work on igrations
This commit is contained in:
parent
70beba164b
commit
389d2b413e
@ -14,7 +14,7 @@ class DataStoreModel(db.Model):
|
||||
task_spec = db.Column(db.String)
|
||||
spec_id = db.Column(db.String)
|
||||
user_id = db.Column(db.String, nullable=True)
|
||||
file_id = db.Column(db.Integer, db.ForeignKey('file.id'), nullable=True)
|
||||
# file_id = db.Column(db.Integer, db.ForeignKey('file.id'), nullable=True)
|
||||
document_id = db.Column(db.Integer, db.ForeignKey('document.id'), nullable=True)
|
||||
value = db.Column(db.String)
|
||||
|
||||
|
@ -105,7 +105,7 @@ class FileModel(db.Model):
|
||||
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'), nullable=True)
|
||||
task_spec = db.Column(db.String, nullable=True)
|
||||
irb_doc_code = db.Column(db.String, nullable=True) # Code reference to the documents.xlsx reference file.
|
||||
data_stores = relationship(DataStoreModel, cascade="all,delete", backref="file")
|
||||
# data_stores = relationship(DataStoreModel, cascade="all,delete", backref="file")
|
||||
|
||||
|
||||
class File(object):
|
||||
|
@ -74,8 +74,12 @@ def upgrade():
|
||||
# except Exception as e:
|
||||
# app.logger.info(
|
||||
# f'Error migrating file data. File ID: {file_model.id}, File Data ID: {file_data_model.id}, Original error: {e}')
|
||||
op.drop_constraint('file_id_key', 'data_store', type_='foreignkey')
|
||||
# op.drop_column('data_store', 'file_id')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.execute('DELETE FROM document;')
|
||||
# op.add_column('data_store', sa.Column('file_id', sa.Integer(), nullable=True))
|
||||
# op.create_foreign_key('file_id_key', 'data_store', 'file', ['file_id'], ['id'])
|
||||
op.execute('UPDATE data_store SET document_id = null')
|
||||
op.execute('DELETE FROM document;')
|
||||
|
@ -44,6 +44,6 @@ def upgrade():
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('document_id_key', 'data_store', type_='foreignkey')
|
||||
op.drop_column('data_store', 'document_id')
|
||||
op.drop_table('document')
|
||||
# op.drop_column('data_store', 'document_id')
|
||||
# op.drop_constraint('document_id_key', 'data_store', type_='foreignkey')
|
||||
|
Loading…
x
Reference in New Issue
Block a user