From c510759df3c7510d3a2bb5928a76f03d758f4284 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 4 Jan 2019 13:35:14 -0500 Subject: [PATCH] Remove the foreign key constraint from the kind field on the logentry3 table --- data/database.py | 2 +- data/migrations/versions/6ec8726c0ace_add_logentry3_table.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/data/database.py b/data/database.py index 883d82664..120aee6f3 100644 --- a/data/database.py +++ b/data/database.py @@ -1041,7 +1041,7 @@ class LogEntry2(BaseModel): class LogEntry3(BaseModel): id = BigAutoField() - kind = ForeignKeyField(LogEntryKind) + kind = IntegerField(db_column='kind_id') account = IntegerField(db_column='account_id') performer = IntegerField(null=True, db_column='performer_id') repository = IntegerField(null=True, db_column='repository_id') diff --git a/data/migrations/versions/6ec8726c0ace_add_logentry3_table.py b/data/migrations/versions/6ec8726c0ace_add_logentry3_table.py index c2310fdd1..ce0165e36 100644 --- a/data/migrations/versions/6ec8726c0ace_add_logentry3_table.py +++ b/data/migrations/versions/6ec8726c0ace_add_logentry3_table.py @@ -25,12 +25,10 @@ def upgrade(tables, tester): sa.Column('datetime', sa.DateTime(), nullable=False), sa.Column('ip', sa.String(length=255), nullable=True), sa.Column('metadata_json', sa.Text(), nullable=False), - sa.ForeignKeyConstraint(['kind_id'], ['logentrykind.id'], name=op.f('fk_logentry3_kind_id_logentrykind')), sa.PrimaryKeyConstraint('id', name=op.f('pk_logentry3')) ) op.create_index('logentry3_account_id_datetime', 'logentry3', ['account_id', 'datetime'], unique=False) op.create_index('logentry3_datetime', 'logentry3', ['datetime'], unique=False) - op.create_index('logentry3_kind_id', 'logentry3', ['kind_id'], unique=False) op.create_index('logentry3_performer_id_datetime', 'logentry3', ['performer_id', 'datetime'], unique=False) op.create_index('logentry3_repository_id_datetime_kind_id', 'logentry3', ['repository_id', 'datetime', 'kind_id'], unique=False) # ### end Alembic commands ###