|
| 1 | +# Generated by Django 4.2.3 on 2024-03-07 02:35 |
| 2 | + |
| 3 | +from django.db import migrations, models |
| 4 | +import pgtrigger.compiler |
| 5 | +import pgtrigger.migrations |
| 6 | + |
| 7 | + |
| 8 | +class Migration(migrations.Migration): |
| 9 | + dependencies = [ |
| 10 | + ("baseapp_files", "0001_initial"), |
| 11 | + ] |
| 12 | + |
| 13 | + operations = [ |
| 14 | + pgtrigger.migrations.RemoveTrigger( |
| 15 | + model_name="file", |
| 16 | + name="snapshot_insert", |
| 17 | + ), |
| 18 | + pgtrigger.migrations.RemoveTrigger( |
| 19 | + model_name="file", |
| 20 | + name="snapshot_update", |
| 21 | + ), |
| 22 | + migrations.AddField( |
| 23 | + model_name="fileevent", |
| 24 | + name="pgh_operation", |
| 25 | + field=models.IntegerField( |
| 26 | + choices=[ |
| 27 | + (1, "Insert"), |
| 28 | + (2, "Update"), |
| 29 | + (3, "Delete"), |
| 30 | + (4, "Insertorupdate"), |
| 31 | + ], |
| 32 | + null=True, |
| 33 | + ), |
| 34 | + ), |
| 35 | + pgtrigger.migrations.AddTrigger( |
| 36 | + model_name="file", |
| 37 | + trigger=pgtrigger.compiler.Trigger( |
| 38 | + name="snapshot_insert", |
| 39 | + sql=pgtrigger.compiler.UpsertTriggerSql( |
| 40 | + func='INSERT INTO "baseapp_files_fileevent" ("content_type", "created", "created_by_id", "description", "file", "file_name", "file_size", "id", "modified", "name", "parent_content_type_id", "parent_object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "pgh_operation", "updated") VALUES (NEW."content_type", NEW."created", NEW."created_by_id", NEW."description", NEW."file", NEW."file_name", NEW."file_size", NEW."id", NEW."modified", NEW."name", NEW."parent_content_type_id", NEW."parent_object_id", _pgh_attach_context(), NOW(), \'snapshot\', NEW."id", 1, NEW."updated"); RETURN NULL;', |
| 41 | + hash="df20bf9549839bb058bec50b2ec00b48b1dcb66c", |
| 42 | + operation="INSERT", |
| 43 | + pgid="pgtrigger_snapshot_insert_03cf9", |
| 44 | + table="baseapp_files_file", |
| 45 | + when="AFTER", |
| 46 | + ), |
| 47 | + ), |
| 48 | + ), |
| 49 | + pgtrigger.migrations.AddTrigger( |
| 50 | + model_name="file", |
| 51 | + trigger=pgtrigger.compiler.Trigger( |
| 52 | + name="snapshot_update", |
| 53 | + sql=pgtrigger.compiler.UpsertTriggerSql( |
| 54 | + condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)", |
| 55 | + func='INSERT INTO "baseapp_files_fileevent" ("content_type", "created", "created_by_id", "description", "file", "file_name", "file_size", "id", "modified", "name", "parent_content_type_id", "parent_object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "pgh_operation", "updated") VALUES (NEW."content_type", NEW."created", NEW."created_by_id", NEW."description", NEW."file", NEW."file_name", NEW."file_size", NEW."id", NEW."modified", NEW."name", NEW."parent_content_type_id", NEW."parent_object_id", _pgh_attach_context(), NOW(), \'snapshot\', NEW."id", 2, NEW."updated"); RETURN NULL;', |
| 56 | + hash="a4b2ac3b6afa90f1fb04a72fd1d2a81064d6824d", |
| 57 | + operation="UPDATE", |
| 58 | + pgid="pgtrigger_snapshot_update_11b9c", |
| 59 | + table="baseapp_files_file", |
| 60 | + when="AFTER", |
| 61 | + ), |
| 62 | + ), |
| 63 | + ), |
| 64 | + pgtrigger.migrations.AddTrigger( |
| 65 | + model_name="file", |
| 66 | + trigger=pgtrigger.compiler.Trigger( |
| 67 | + name="snapshot_delete", |
| 68 | + sql=pgtrigger.compiler.UpsertTriggerSql( |
| 69 | + func='INSERT INTO "baseapp_files_fileevent" ("content_type", "created", "created_by_id", "description", "file", "file_name", "file_size", "id", "modified", "name", "parent_content_type_id", "parent_object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "pgh_operation", "updated") VALUES (OLD."content_type", OLD."created", OLD."created_by_id", OLD."description", OLD."file", OLD."file_name", OLD."file_size", OLD."id", OLD."modified", OLD."name", OLD."parent_content_type_id", OLD."parent_object_id", _pgh_attach_context(), NOW(), \'snapshot\', OLD."id", 3, OLD."updated"); RETURN NULL;', |
| 70 | + hash="ce527d470682a74377bb63ac788dc32f5d10a52f", |
| 71 | + operation="DELETE", |
| 72 | + pgid="pgtrigger_snapshot_delete_09e63", |
| 73 | + table="baseapp_files_file", |
| 74 | + when="AFTER", |
| 75 | + ), |
| 76 | + ), |
| 77 | + ), |
| 78 | + ] |
0 commit comments