This repository was archived by the owner on Feb 8, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
✨ Update recipe dependency and enhance fee plugin functionality with magic constants #143
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -17,6 +17,39 @@ CREATE TYPE "tx_indexer_status_onchain" AS ENUM ( | |
| 'FAIL' | ||
| ); | ||
|
|
||
| CREATE FUNCTION "prevent_insert_if_policy_deleted"() RETURNS "trigger" | ||
| LANGUAGE "plpgsql" | ||
| AS $$ | ||
| BEGIN | ||
| IF NEW.deleted = true THEN | ||
| RAISE EXCEPTION 'Cannot insert a deleted policy'; | ||
| END IF; | ||
| RETURN NEW; | ||
| END; | ||
| $$; | ||
|
|
||
| CREATE FUNCTION "prevent_update_if_policy_deleted"() RETURNS "trigger" | ||
| LANGUAGE "plpgsql" | ||
| AS $$ | ||
| BEGIN | ||
| IF OLD.deleted = true THEN | ||
| RAISE EXCEPTION 'Cannot update a deleted policy'; | ||
| END IF; | ||
| RETURN NEW; | ||
| END; | ||
| $$; | ||
|
|
||
| CREATE FUNCTION "set_policy_inactive_on_delete"() RETURNS "trigger" | ||
| LANGUAGE "plpgsql" | ||
| AS $$ | ||
| BEGIN | ||
| IF NEW.deleted = true THEN | ||
| NEW.active := false; | ||
| END IF; | ||
| RETURN NEW; | ||
| END; | ||
| $$; | ||
|
|
||
| CREATE FUNCTION "update_updated_at_column"() RETURNS "trigger" | ||
| LANGUAGE "plpgsql" | ||
| AS $$ | ||
|
|
@@ -66,7 +99,8 @@ CREATE TABLE "plugin_policies" ( | |
| "recipe" "text" NOT NULL, | ||
| "active" boolean DEFAULT true NOT NULL, | ||
| "created_at" timestamp with time zone DEFAULT "now"() NOT NULL, | ||
| "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL | ||
| "updated_at" timestamp with time zone DEFAULT "now"() NOT NULL, | ||
| "deleted" boolean DEFAULT false NOT NULL | ||
| ); | ||
|
Comment on lines
100
to
104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion
You introduce the Add a trigger re-using the already defined +-- Keep the timestamp current on every row modification
+CREATE TRIGGER "update_plugin_policies_updated_at"
+ BEFORE UPDATE ON "plugin_policies"
+ FOR EACH ROW
+ EXECUTE FUNCTION "public"."update_updated_at_column"();Place it next to the other Also applies to: 162-166 🤖 Prompt for AI Agents |
||
|
|
||
| CREATE TABLE "scheduler" ( | ||
|
|
@@ -125,6 +159,12 @@ CREATE INDEX "idx_tx_indexer_key" ON "tx_indexer" USING "btree" ("chain_id", "pl | |
|
|
||
| CREATE INDEX "idx_tx_indexer_status_onchain_lost" ON "tx_indexer" USING "btree" ("status_onchain", "lost"); | ||
|
|
||
| CREATE TRIGGER "trg_prevent_insert_if_policy_deleted" BEFORE INSERT ON "plugin_policies" FOR EACH ROW EXECUTE FUNCTION "public"."prevent_insert_if_policy_deleted"(); | ||
|
|
||
| CREATE TRIGGER "trg_prevent_update_if_policy_deleted" BEFORE UPDATE ON "plugin_policies" FOR EACH ROW WHEN (("old"."deleted" = true)) EXECUTE FUNCTION "public"."prevent_update_if_policy_deleted"(); | ||
|
|
||
| CREATE TRIGGER "trg_set_policy_inactive_on_delete" BEFORE INSERT OR UPDATE ON "plugin_policies" FOR EACH ROW WHEN (("new"."deleted" = true)) EXECUTE FUNCTION "public"."set_policy_inactive_on_delete"(); | ||
|
|
||
| CREATE TRIGGER "update_fee_run_updated_at" BEFORE UPDATE ON "fee_run" FOR EACH ROW EXECUTE FUNCTION "public"."update_updated_at_column"(); | ||
|
|
||
| ALTER TABLE ONLY "fee" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.