Loading migrations/versions/2e1f46b9b26d_.py 0 → 100644 +30 −0 Original line number Diff line number Diff line """empty message Revision ID: 2e1f46b9b26d Revises: f8d48cce72cb Create Date: 2018-11-21 12:05:48.329156 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2e1f46b9b26d' down_revision = 'f8d48cce72cb' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_index(op.f('ix_submission_project_id'), 'submission', ['project_id'], unique=False) op.create_index(op.f('ix_submission_user_id'), 'submission', ['user_id'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_submission_user_id'), table_name='submission') op.drop_index(op.f('ix_submission_project_id'), table_name='submission') # ### end Alembic commands ### portal/database/models.py +2 −2 Original line number Diff line number Diff line Loading @@ -880,10 +880,10 @@ class Submission(db.Model, EntityBase): note = db.Column(JSONEncodedDict()) source_hash = db.Column(db.String(64)) user_id = db.Column(db.String(36), db.ForeignKey( 'user.id', ondelete='cascade'), nullable=False) 'user.id', ondelete='cascade'), nullable=False, index=True) user = db.relationship("User", back_populates="submissions", uselist=False) project_id = db.Column(db.String(36), db.ForeignKey( 'project.id', ondelete='cascade'), nullable=False) 'project.id', ondelete='cascade'), nullable=False, index=True) project = db.relationship("Project", uselist=False) review = db.relationship("Review", back_populates="submission", cascade="all, delete-orphan", passive_deletes=True, uselist=False) Loading Loading
migrations/versions/2e1f46b9b26d_.py 0 → 100644 +30 −0 Original line number Diff line number Diff line """empty message Revision ID: 2e1f46b9b26d Revises: f8d48cce72cb Create Date: 2018-11-21 12:05:48.329156 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2e1f46b9b26d' down_revision = 'f8d48cce72cb' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_index(op.f('ix_submission_project_id'), 'submission', ['project_id'], unique=False) op.create_index(op.f('ix_submission_user_id'), 'submission', ['user_id'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_submission_user_id'), table_name='submission') op.drop_index(op.f('ix_submission_project_id'), table_name='submission') # ### end Alembic commands ###
portal/database/models.py +2 −2 Original line number Diff line number Diff line Loading @@ -880,10 +880,10 @@ class Submission(db.Model, EntityBase): note = db.Column(JSONEncodedDict()) source_hash = db.Column(db.String(64)) user_id = db.Column(db.String(36), db.ForeignKey( 'user.id', ondelete='cascade'), nullable=False) 'user.id', ondelete='cascade'), nullable=False, index=True) user = db.relationship("User", back_populates="submissions", uselist=False) project_id = db.Column(db.String(36), db.ForeignKey( 'project.id', ondelete='cascade'), nullable=False) 'project.id', ondelete='cascade'), nullable=False, index=True) project = db.relationship("Project", uselist=False) review = db.relationship("Review", back_populates="submission", cascade="all, delete-orphan", passive_deletes=True, uselist=False) Loading