-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4441 from freelawproject/4431-upgrade-to-pghistor…
…y-30 Upgrade to django-pghistory 3.4.0
- Loading branch information
Showing
24 changed files
with
2,987 additions
and
125 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
cl/alerts/migrations/0010_pghistory_v3_4_0_trigger_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Generated by Django 5.0.8 on 2024-09-10 16:53 | ||
|
||
import django.db.models.deletion | ||
import pgtrigger.compiler | ||
import pgtrigger.migrations | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("alerts", "0009_alter_alert_search_types_noop"), | ||
] | ||
|
||
operations = [ | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="alert", | ||
name="update_or_delete_snapshot_update", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="alert", | ||
name="update_or_delete_snapshot_delete", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="docketalert", | ||
name="update_or_delete_snapshot_delete", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="docketalert", | ||
name="update_or_delete_snapshot_update", | ||
), | ||
migrations.AlterField( | ||
model_name="alertevent", | ||
name="pgh_obj", | ||
field=models.ForeignKey( | ||
db_constraint=False, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="events", | ||
to="alerts.alert", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="docketalertevent", | ||
name="pgh_obj", | ||
field=models.ForeignKey( | ||
db_constraint=False, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="events", | ||
to="alerts.docketalert", | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="alert", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="update_update", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
condition='WHEN (OLD."alert_type" IS DISTINCT FROM (NEW."alert_type") OR OLD."date_last_hit" IS DISTINCT FROM (NEW."date_last_hit") OR OLD."id" IS DISTINCT FROM (NEW."id") OR OLD."name" IS DISTINCT FROM (NEW."name") OR OLD."query" IS DISTINCT FROM (NEW."query") OR OLD."rate" IS DISTINCT FROM (NEW."rate") OR OLD."secret_key" IS DISTINCT FROM (NEW."secret_key") OR OLD."user_id" IS DISTINCT FROM (NEW."user_id"))', | ||
func='INSERT INTO "alerts_alertevent" ("alert_type", "date_created", "date_last_hit", "date_modified", "id", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "query", "rate", "secret_key", "user_id") VALUES (OLD."alert_type", OLD."date_created", OLD."date_last_hit", OLD."date_modified", OLD."id", OLD."name", _pgh_attach_context(), NOW(), \'update\', OLD."id", OLD."query", OLD."rate", OLD."secret_key", OLD."user_id"); RETURN NULL;', | ||
hash="d10c466ad18caf5d1aeea5985af5c6e6e14e17d3", | ||
operation="UPDATE", | ||
pgid="pgtrigger_update_update_953db", | ||
table="alerts_alert", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="alert", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="delete_delete", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func='INSERT INTO "alerts_alertevent" ("alert_type", "date_created", "date_last_hit", "date_modified", "id", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "query", "rate", "secret_key", "user_id") VALUES (OLD."alert_type", OLD."date_created", OLD."date_last_hit", OLD."date_modified", OLD."id", OLD."name", _pgh_attach_context(), NOW(), \'delete\', OLD."id", OLD."query", OLD."rate", OLD."secret_key", OLD."user_id"); RETURN NULL;', | ||
hash="7c45dc1ce256430854bb607919cb01032db5ff5a", | ||
operation="DELETE", | ||
pgid="pgtrigger_delete_delete_2fa4e", | ||
table="alerts_alert", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="docketalert", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="update_update", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
condition='WHEN (OLD."alert_type" IS DISTINCT FROM (NEW."alert_type") OR OLD."date_last_hit" IS DISTINCT FROM (NEW."date_last_hit") OR OLD."docket_id" IS DISTINCT FROM (NEW."docket_id") OR OLD."id" IS DISTINCT FROM (NEW."id") OR OLD."secret_key" IS DISTINCT FROM (NEW."secret_key") OR OLD."user_id" IS DISTINCT FROM (NEW."user_id"))', | ||
func='INSERT INTO "alerts_docketalertevent" ("alert_type", "date_created", "date_last_hit", "date_modified", "docket_id", "id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "secret_key", "user_id") VALUES (OLD."alert_type", OLD."date_created", OLD."date_last_hit", OLD."date_modified", OLD."docket_id", OLD."id", _pgh_attach_context(), NOW(), \'update\', OLD."id", OLD."secret_key", OLD."user_id"); RETURN NULL;', | ||
hash="cf12ed58779f12bde3fd0bdaec1ac03cbc487dd3", | ||
operation="UPDATE", | ||
pgid="pgtrigger_update_update_5b7b3", | ||
table="alerts_docketalert", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="docketalert", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="delete_delete", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func='INSERT INTO "alerts_docketalertevent" ("alert_type", "date_created", "date_last_hit", "date_modified", "docket_id", "id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "secret_key", "user_id") VALUES (OLD."alert_type", OLD."date_created", OLD."date_last_hit", OLD."date_modified", OLD."docket_id", OLD."id", _pgh_attach_context(), NOW(), \'delete\', OLD."id", OLD."secret_key", OLD."user_id"); RETURN NULL;', | ||
hash="1ba35d31c8ea4a81ea2c41a1dcb4f57ad89b329e", | ||
operation="DELETE", | ||
pgid="pgtrigger_delete_delete_5ad6b", | ||
table="alerts_docketalert", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Generated by Django 5.0.8 on 2024-09-10 16:53 | ||
|
||
import django.db.models.deletion | ||
import pgtrigger.compiler | ||
import pgtrigger.migrations | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
( | ||
"api", | ||
"0010_remove_webhook_update_or_delete_snapshot_update_and_more", | ||
), | ||
] | ||
|
||
operations = [ | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="webhook", | ||
name="update_or_delete_snapshot_delete", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="webhook", | ||
name="update_or_delete_snapshot_update", | ||
), | ||
migrations.AlterField( | ||
model_name="webhookhistoryevent", | ||
name="pgh_obj", | ||
field=models.ForeignKey( | ||
db_constraint=False, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="events", | ||
to="api.webhook", | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="webhook", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="update_update", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
condition='WHEN (OLD."enabled" IS DISTINCT FROM (NEW."enabled") OR OLD."event_type" IS DISTINCT FROM (NEW."event_type") OR OLD."failure_count" IS DISTINCT FROM (NEW."failure_count") OR OLD."id" IS DISTINCT FROM (NEW."id") OR OLD."url" IS DISTINCT FROM (NEW."url") OR OLD."user_id" IS DISTINCT FROM (NEW."user_id") OR OLD."version" IS DISTINCT FROM (NEW."version"))', | ||
func='INSERT INTO "api_webhookhistoryevent" ("date_created", "date_modified", "enabled", "event_type", "failure_count", "id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "url", "user_id", "version") VALUES (OLD."date_created", OLD."date_modified", OLD."enabled", OLD."event_type", OLD."failure_count", OLD."id", _pgh_attach_context(), NOW(), \'update\', OLD."id", OLD."url", OLD."user_id", OLD."version"); RETURN NULL;', | ||
hash="7f59f4f4c58dbace852130b00bbc731277c71574", | ||
operation="UPDATE", | ||
pgid="pgtrigger_update_update_a1c57", | ||
table="api_webhook", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="webhook", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="delete_delete", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func='INSERT INTO "api_webhookhistoryevent" ("date_created", "date_modified", "enabled", "event_type", "failure_count", "id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "url", "user_id", "version") VALUES (OLD."date_created", OLD."date_modified", OLD."enabled", OLD."event_type", OLD."failure_count", OLD."id", _pgh_attach_context(), NOW(), \'delete\', OLD."id", OLD."url", OLD."user_id", OLD."version"); RETURN NULL;', | ||
hash="2a7c2d234520eeeef098f08c9f09b6f825f13826", | ||
operation="DELETE", | ||
pgid="pgtrigger_delete_delete_30383", | ||
table="api_webhook", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
cl/audio/migrations/0010_pghistory_v3_4_0_trigger_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Generated by Django 5.0.8 on 2024-09-10 16:53 | ||
|
||
import django.db.models.deletion | ||
import pgtrigger.compiler | ||
import pgtrigger.migrations | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
( | ||
"audio", | ||
"0009_alter_audio_stt_status_alter_audioevent_stt_status_noop", | ||
), | ||
] | ||
|
||
operations = [ | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="audio", | ||
name="update_or_delete_snapshot_update", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="audio", | ||
name="update_or_delete_snapshot_delete", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="audiopanel", | ||
name="update_or_delete_snapshot_update", | ||
), | ||
pgtrigger.migrations.RemoveTrigger( | ||
model_name="audiopanel", | ||
name="update_or_delete_snapshot_delete", | ||
), | ||
migrations.AlterField( | ||
model_name="audioevent", | ||
name="pgh_obj", | ||
field=models.ForeignKey( | ||
db_constraint=False, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="events", | ||
to="audio.audio", | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="audio", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="update_update", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
condition='WHEN (OLD."blocked" IS DISTINCT FROM (NEW."blocked") OR OLD."case_name" IS DISTINCT FROM (NEW."case_name") OR OLD."case_name_full" IS DISTINCT FROM (NEW."case_name_full") OR OLD."case_name_short" IS DISTINCT FROM (NEW."case_name_short") OR OLD."date_blocked" IS DISTINCT FROM (NEW."date_blocked") OR OLD."docket_id" IS DISTINCT FROM (NEW."docket_id") OR OLD."download_url" IS DISTINCT FROM (NEW."download_url") OR OLD."duration" IS DISTINCT FROM (NEW."duration") OR OLD."filepath_ia" IS DISTINCT FROM (NEW."filepath_ia") OR OLD."ia_upload_failure_count" IS DISTINCT FROM (NEW."ia_upload_failure_count") OR OLD."id" IS DISTINCT FROM (NEW."id") OR OLD."judges" IS DISTINCT FROM (NEW."judges") OR OLD."local_path_mp3" IS DISTINCT FROM (NEW."local_path_mp3") OR OLD."local_path_original_file" IS DISTINCT FROM (NEW."local_path_original_file") OR OLD."processing_complete" IS DISTINCT FROM (NEW."processing_complete") OR OLD."sha1" IS DISTINCT FROM (NEW."sha1") OR OLD."source" IS DISTINCT FROM (NEW."source") OR OLD."stt_source" IS DISTINCT FROM (NEW."stt_source") OR OLD."stt_status" IS DISTINCT FROM (NEW."stt_status") OR OLD."stt_transcript" IS DISTINCT FROM (NEW."stt_transcript"))', | ||
func='INSERT INTO "audio_audioevent" ("blocked", "case_name", "case_name_full", "case_name_short", "date_blocked", "date_created", "date_modified", "docket_id", "download_url", "duration", "filepath_ia", "ia_upload_failure_count", "id", "judges", "local_path_mp3", "local_path_original_file", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "processing_complete", "sha1", "source", "stt_source", "stt_status", "stt_transcript") VALUES (OLD."blocked", OLD."case_name", OLD."case_name_full", OLD."case_name_short", OLD."date_blocked", OLD."date_created", OLD."date_modified", OLD."docket_id", OLD."download_url", OLD."duration", OLD."filepath_ia", OLD."ia_upload_failure_count", OLD."id", OLD."judges", OLD."local_path_mp3", OLD."local_path_original_file", _pgh_attach_context(), NOW(), \'update\', OLD."id", OLD."processing_complete", OLD."sha1", OLD."source", OLD."stt_source", OLD."stt_status", OLD."stt_transcript"); RETURN NULL;', | ||
hash="666831a578b79c48bc3a26d307bad268ce4e4e07", | ||
operation="UPDATE", | ||
pgid="pgtrigger_update_update_581d8", | ||
table="audio_audio", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="audio", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="delete_delete", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func='INSERT INTO "audio_audioevent" ("blocked", "case_name", "case_name_full", "case_name_short", "date_blocked", "date_created", "date_modified", "docket_id", "download_url", "duration", "filepath_ia", "ia_upload_failure_count", "id", "judges", "local_path_mp3", "local_path_original_file", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "processing_complete", "sha1", "source", "stt_source", "stt_status", "stt_transcript") VALUES (OLD."blocked", OLD."case_name", OLD."case_name_full", OLD."case_name_short", OLD."date_blocked", OLD."date_created", OLD."date_modified", OLD."docket_id", OLD."download_url", OLD."duration", OLD."filepath_ia", OLD."ia_upload_failure_count", OLD."id", OLD."judges", OLD."local_path_mp3", OLD."local_path_original_file", _pgh_attach_context(), NOW(), \'delete\', OLD."id", OLD."processing_complete", OLD."sha1", OLD."source", OLD."stt_source", OLD."stt_status", OLD."stt_transcript"); RETURN NULL;', | ||
hash="3cd590791fb720db3c7ec3d0a8ecd7de9f7d9e84", | ||
operation="DELETE", | ||
pgid="pgtrigger_delete_delete_15ad9", | ||
table="audio_audio", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="audiopanel", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="insert_insert", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func='INSERT INTO "audio_audiopanelevent" ("audio_id", "id", "person_id", "pgh_context_id", "pgh_created_at", "pgh_label") VALUES (NEW."audio_id", NEW."id", NEW."person_id", _pgh_attach_context(), NOW(), \'insert\'); RETURN NULL;', | ||
hash="2f84722ed145863e5187a0488f6aad725927f1ac", | ||
operation="INSERT", | ||
pgid="pgtrigger_insert_insert_b8778", | ||
table="audio_audio_panel", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
pgtrigger.migrations.AddTrigger( | ||
model_name="audiopanel", | ||
trigger=pgtrigger.compiler.Trigger( | ||
name="delete_delete", | ||
sql=pgtrigger.compiler.UpsertTriggerSql( | ||
func='INSERT INTO "audio_audiopanelevent" ("audio_id", "id", "person_id", "pgh_context_id", "pgh_created_at", "pgh_label") VALUES (OLD."audio_id", OLD."id", OLD."person_id", _pgh_attach_context(), NOW(), \'delete\'); RETURN NULL;', | ||
hash="61df118b866f8dbcf1c9b4f7d90281c98aeaec4f", | ||
operation="DELETE", | ||
pgid="pgtrigger_delete_delete_cae12", | ||
table="audio_audio_panel", | ||
when="AFTER", | ||
), | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.