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
Check schema consistency test #92
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
|
|
||
| CREATE TYPE "plugin_id" AS ENUM ( | ||
| 'vultisig-dca-0000', | ||
| 'vultisig-payroll-0000', | ||
| 'vultisig-fees-feee' | ||
| ); | ||
|
|
||
| CREATE TYPE "transaction_status" AS ENUM ( | ||
| 'PENDING', | ||
| 'SIGNING_FAILED', | ||
| 'SIGNED', | ||
| 'BROADCAST', | ||
| 'MINED', | ||
| 'REJECTED' | ||
| ); | ||
|
|
||
| CREATE TYPE "trigger_status" AS ENUM ( | ||
| 'PENDING', | ||
| 'RUNNING' | ||
| ); | ||
|
|
||
| CREATE TYPE "tx_indexer_status" AS ENUM ( | ||
| 'PROPOSED', | ||
| 'VERIFIED', | ||
| 'SIGNED' | ||
| ); | ||
|
|
||
| CREATE TYPE "tx_indexer_status_onchain" AS ENUM ( | ||
| 'PENDING', | ||
| 'SUCCESS', | ||
| 'FAIL' | ||
| ); | ||
|
|
||
| CREATE TABLE "plugin_policies" ( | ||
| "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, | ||
| "public_key" "text" NOT NULL, | ||
| "plugin_id" "plugin_id" NOT NULL, | ||
| "plugin_version" "text" NOT NULL, | ||
| "policy_version" integer NOT NULL, | ||
| "signature" "text" NOT NULL, | ||
| "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 | ||
| ); | ||
|
|
||
| CREATE TABLE "time_triggers" ( | ||
| "id" integer NOT NULL, | ||
| "policy_id" "uuid" NOT NULL, | ||
| "cron_expression" "text" NOT NULL, | ||
| "start_time" timestamp without time zone NOT NULL, | ||
| "end_time" timestamp without time zone, | ||
| "frequency" integer NOT NULL, | ||
| "interval" integer NOT NULL, | ||
| "last_execution" timestamp without time zone, | ||
| "status" "trigger_status" NOT NULL, | ||
| "created_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP | ||
| ); | ||
|
|
||
| CREATE SEQUENCE "time_triggers_id_seq" | ||
| AS integer | ||
| START WITH 1 | ||
| INCREMENT BY 1 | ||
| NO MINVALUE | ||
| NO MAXVALUE | ||
| CACHE 1; | ||
|
|
||
| ALTER SEQUENCE "time_triggers_id_seq" OWNED BY "public"."time_triggers"."id"; | ||
|
|
||
| CREATE TABLE "transaction_history" ( | ||
| "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, | ||
| "policy_id" "uuid" NOT NULL, | ||
| "tx_body" "text" NOT NULL, | ||
| "tx_hash" "text" NOT NULL, | ||
| "status" "transaction_status" NOT NULL, | ||
| "created_at" timestamp with time zone DEFAULT "now"(), | ||
| "updated_at" timestamp with time zone DEFAULT "now"(), | ||
| "metadata" "jsonb", | ||
| "error_message" "text" | ||
| ); | ||
|
|
||
| CREATE TABLE "tx_indexer" ( | ||
| "id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL, | ||
| "plugin_id" character varying(255) NOT NULL, | ||
| "tx_hash" character varying(255), | ||
| "chain_id" integer NOT NULL, | ||
| "policy_id" "uuid" NOT NULL, | ||
| "from_public_key" character varying(255) NOT NULL, | ||
| "proposed_tx_hex" "text" NOT NULL, | ||
| "status" "tx_indexer_status" DEFAULT 'PROPOSED'::"public"."tx_indexer_status" NOT NULL, | ||
| "status_onchain" "tx_indexer_status_onchain", | ||
| "lost" boolean DEFAULT false NOT NULL, | ||
| "broadcasted_at" timestamp without time zone, | ||
| "created_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
| "updated_at" timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL | ||
| ); | ||
|
|
||
| ALTER TABLE ONLY "time_triggers" ALTER COLUMN "id" SET DEFAULT "nextval"('"public"."time_triggers_id_seq"'::"regclass"); | ||
|
|
||
| ALTER TABLE ONLY "plugin_policies" | ||
| ADD CONSTRAINT "plugin_policies_pkey" PRIMARY KEY ("id"); | ||
|
|
||
| ALTER TABLE ONLY "time_triggers" | ||
| ADD CONSTRAINT "time_triggers_pkey" PRIMARY KEY ("id"); | ||
|
|
||
| ALTER TABLE ONLY "transaction_history" | ||
| ADD CONSTRAINT "transaction_history_pkey" PRIMARY KEY ("id"); | ||
|
|
||
| ALTER TABLE ONLY "tx_indexer" | ||
| ADD CONSTRAINT "tx_indexer_pkey" PRIMARY KEY ("id"); | ||
|
|
||
| ALTER TABLE ONLY "transaction_history" | ||
| ADD CONSTRAINT "unique_tx_hash" UNIQUE ("tx_hash"); | ||
|
|
||
|
Comment on lines
+112
to
+114
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. Redundant index on Also applies to: 129-129 🤖 Prompt for AI Agents |
||
| CREATE INDEX "idx_plugin_policies_active" ON "plugin_policies" USING "btree" ("active"); | ||
|
|
||
| CREATE INDEX "idx_plugin_policies_plugin_id" ON "plugin_policies" USING "btree" ("plugin_id"); | ||
|
|
||
| CREATE INDEX "idx_plugin_policies_public_key" ON "plugin_policies" USING "btree" ("public_key"); | ||
|
|
||
| CREATE INDEX "idx_time_triggers_policy_id" ON "time_triggers" USING "btree" ("policy_id"); | ||
|
|
||
| CREATE INDEX "idx_time_triggers_start_time" ON "time_triggers" USING "btree" ("start_time"); | ||
|
|
||
| CREATE INDEX "idx_transaction_history_policy_id" ON "transaction_history" USING "btree" ("policy_id"); | ||
|
|
||
| CREATE INDEX "idx_transaction_history_status" ON "transaction_history" USING "btree" ("status"); | ||
|
|
||
| CREATE INDEX "idx_transaction_history_tx_hash" ON "transaction_history" USING "btree" ("tx_hash"); | ||
|
|
||
| CREATE INDEX "idx_tx_indexer_status_onchain_lost" ON "tx_indexer" USING "btree" ("status_onchain", "lost"); | ||
|
|
||
| ALTER TABLE ONLY "transaction_history" | ||
| ADD CONSTRAINT "fk_policy" FOREIGN KEY ("policy_id") REFERENCES "plugin_policies"("id"); | ||
|
|
||
| ALTER TABLE ONLY "time_triggers" | ||
| ADD CONSTRAINT "time_triggers_policy_id_fkey" FOREIGN KEY ("policy_id") REFERENCES "plugin_policies"("id"); | ||
|
Comment on lines
+133
to
+137
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. Duplicate foreign key for 🤖 Prompt for AI Agents |
||
|
|
||
| ALTER TABLE ONLY "transaction_history" | ||
| ADD CONSTRAINT "transaction_history_policy_id_fkey" FOREIGN KEY ("policy_id") REFERENCES "plugin_policies"("id"); | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in enum value ‘vultisig-fees-feee’.
The third entry in the
plugin_idenum has an extra ‘e’. Please confirm the intended plugin identifier and correct this value.🤖 Prompt for AI Agents