@morpho-dev/router 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cli.js +292 -122
  2. package/dist/drizzle/migrations/0000_setup_single_migration_folder.sql +64 -64
  3. package/dist/drizzle/migrations/0001_add-trigger-for-consumed-events.sql +5 -5
  4. package/dist/drizzle/migrations/0002_insert-status-code.sql +1 -1
  5. package/dist/drizzle/migrations/0003_update-triggers-for-consumed-events.sql +1 -1
  6. package/dist/drizzle/migrations/0004_drop-status-offers-foreign-key-constraint.sql +1 -1
  7. package/dist/drizzle/migrations/0005_add-index-to-boost-group-query-and-offer-hash.sql +1 -1
  8. package/dist/drizzle/migrations/0006_add-callbacks-and-positions-relations.sql +11 -11
  9. package/dist/drizzle/migrations/0008_validation.sql +10 -10
  10. package/dist/drizzle/migrations/0009_add-transfers-table.sql +4 -4
  11. package/dist/drizzle/migrations/0010_add-price.sql +1 -1
  12. package/dist/drizzle/migrations/0011_nullable-callback-amount.sql +1 -1
  13. package/dist/drizzle/migrations/0012_add-position-asset.sql +1 -1
  14. package/dist/drizzle/migrations/0013_remove-depecrated-domains.sql +13 -13
  15. package/dist/drizzle/migrations/0014_rename-offers-v2-into-offers.sql +19 -19
  16. package/dist/drizzle/migrations/0015_add-lots-table.sql +3 -3
  17. package/dist/drizzle/migrations/0016_merkle-metadata.sql +7 -7
  18. package/dist/drizzle/migrations/0017_dusty_the_hunter.sql +1 -1
  19. package/dist/drizzle/migrations/0018_add_chain_collector_constraints.sql +3 -3
  20. package/dist/drizzle/migrations/0019_add-obligation-units-shares.sql +2 -2
  21. package/dist/drizzle/migrations/0020_add-session.sql +1 -1
  22. package/dist/drizzle/migrations/0021_drop_chain_collector_epoch_indexes.sql +2 -2
  23. package/dist/drizzle/migrations/0021_migrate-rate-to-price.sql +6 -6
  24. package/dist/drizzle/migrations/0022_consolidate-price.sql +5 -5
  25. package/dist/drizzle/migrations/0023_remove-block-number-for-collaterals.sql +1 -1
  26. package/dist/drizzle/migrations/0024_add-obligation-id-to-lots.sql +8 -0
  27. package/dist/drizzle/migrations/0025_rename-price-to-tick.sql +202 -0
  28. package/dist/drizzle/migrations/meta/0000_snapshot.json +48 -48
  29. package/dist/drizzle/migrations/meta/0001_snapshot.json +48 -48
  30. package/dist/drizzle/migrations/meta/0002_snapshot.json +48 -48
  31. package/dist/drizzle/migrations/meta/0003_snapshot.json +48 -48
  32. package/dist/drizzle/migrations/meta/0004_snapshot.json +47 -47
  33. package/dist/drizzle/migrations/meta/0005_snapshot.json +47 -47
  34. package/dist/drizzle/migrations/meta/0006_snapshot.json +61 -61
  35. package/dist/drizzle/migrations/meta/0008_snapshot.json +62 -62
  36. package/dist/drizzle/migrations/meta/0009_snapshot.json +66 -66
  37. package/dist/drizzle/migrations/meta/0010_snapshot.json +66 -66
  38. package/dist/drizzle/migrations/meta/0013_snapshot.json +48 -48
  39. package/dist/drizzle/migrations/meta/0014_snapshot.json +48 -48
  40. package/dist/drizzle/migrations/meta/0015_snapshot.json +52 -52
  41. package/dist/drizzle/migrations/meta/0016_snapshot.json +61 -61
  42. package/dist/drizzle/migrations/meta/0017_snapshot.json +61 -61
  43. package/dist/drizzle/migrations/meta/0018_snapshot.json +62 -62
  44. package/dist/drizzle/migrations/meta/0019_snapshot.json +62 -62
  45. package/dist/drizzle/migrations/meta/0023_snapshot.json +62 -62
  46. package/dist/drizzle/migrations/meta/0024_snapshot.json +1448 -0
  47. package/dist/drizzle/migrations/meta/0025_snapshot.json +1448 -0
  48. package/dist/drizzle/migrations/meta/_journal.json +14 -0
  49. package/dist/index.browser.d.mts +103 -33
  50. package/dist/index.browser.d.mts.map +1 -1
  51. package/dist/index.browser.d.ts +103 -33
  52. package/dist/index.browser.d.ts.map +1 -1
  53. package/dist/index.browser.js +298 -146
  54. package/dist/index.browser.js.map +1 -1
  55. package/dist/index.browser.mjs +293 -147
  56. package/dist/index.browser.mjs.map +1 -1
  57. package/dist/index.node.d.mts +182 -63
  58. package/dist/index.node.d.mts.map +1 -1
  59. package/dist/index.node.d.ts +182 -63
  60. package/dist/index.node.d.ts.map +1 -1
  61. package/dist/index.node.js +342 -127
  62. package/dist/index.node.js.map +1 -1
  63. package/dist/index.node.mjs +337 -128
  64. package/dist/index.node.mjs.map +1 -1
  65. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
- CREATE TYPE "router_v1.6"."status_code" AS ENUM('VALID', 'NOT_ENOUGH_LIQUIDITY');--> statement-breakpoint
2
- CREATE TABLE "router_v1.6"."chains" (
1
+ CREATE TYPE "router_v1.7"."status_code" AS ENUM('VALID', 'NOT_ENOUGH_LIQUIDITY');--> statement-breakpoint
2
+ CREATE TABLE "router_v1.7"."chains" (
3
3
  "chain_id" bigint NOT NULL,
4
4
  "block_number" bigint NOT NULL,
5
5
  "epoch" numeric(78, 0) DEFAULT '0' NOT NULL,
6
6
  "updated_at" timestamp DEFAULT now() NOT NULL
7
7
  );
8
8
  --> statement-breakpoint
9
- CREATE TABLE "router_v1.6"."collectors" (
9
+ CREATE TABLE "router_v1.7"."collectors" (
10
10
  "chain_id" bigint NOT NULL,
11
11
  "name" text NOT NULL,
12
12
  "block_number" bigint NOT NULL,
@@ -14,7 +14,7 @@ CREATE TABLE "router_v1.6"."collectors" (
14
14
  "updated_at" timestamp DEFAULT now() NOT NULL
15
15
  );
16
16
  --> statement-breakpoint
17
- CREATE TABLE "router_v1.6"."consumed_per_user_and_nonce" (
17
+ CREATE TABLE "router_v1.7"."consumed_per_user_and_nonce" (
18
18
  "id" varchar(255) PRIMARY KEY NOT NULL,
19
19
  "chain_id" bigint NOT NULL,
20
20
  "offering" varchar(42) NOT NULL,
@@ -24,7 +24,7 @@ CREATE TABLE "router_v1.6"."consumed_per_user_and_nonce" (
24
24
  "created_at" timestamp DEFAULT now() NOT NULL
25
25
  );
26
26
  --> statement-breakpoint
27
- CREATE TABLE "router_v1.6"."consumed_events" (
27
+ CREATE TABLE "router_v1.7"."consumed_events" (
28
28
  "event_id" varchar(128) PRIMARY KEY NOT NULL,
29
29
  "chain_id" bigint NOT NULL,
30
30
  "maker" varchar(42) NOT NULL,
@@ -34,7 +34,7 @@ CREATE TABLE "router_v1.6"."consumed_events" (
34
34
  "created_at" timestamp DEFAULT now() NOT NULL
35
35
  );
36
36
  --> statement-breakpoint
37
- CREATE TABLE "router_v1.6"."groups" (
37
+ CREATE TABLE "router_v1.7"."groups" (
38
38
  "chain_id" bigint NOT NULL,
39
39
  "maker" varchar(42) NOT NULL,
40
40
  "group" varchar(66) NOT NULL,
@@ -44,7 +44,7 @@ CREATE TABLE "router_v1.6"."groups" (
44
44
  CONSTRAINT "groups_pk" PRIMARY KEY("chain_id","maker","group")
45
45
  );
46
46
  --> statement-breakpoint
47
- CREATE TABLE "router_v1.6"."liquidity_links" (
47
+ CREATE TABLE "router_v1.7"."liquidity_links" (
48
48
  "parent_pool_id" varchar(255) NOT NULL,
49
49
  "child_pool_id" varchar(255) NOT NULL,
50
50
  "priority" integer NOT NULL,
@@ -53,14 +53,14 @@ CREATE TABLE "router_v1.6"."liquidity_links" (
53
53
  CONSTRAINT "liquidity_links_pk" PRIMARY KEY("parent_pool_id","priority")
54
54
  );
55
55
  --> statement-breakpoint
56
- CREATE TABLE "router_v1.6"."liquidity_pools" (
56
+ CREATE TABLE "router_v1.7"."liquidity_pools" (
57
57
  "id" varchar(255) PRIMARY KEY NOT NULL,
58
58
  "amount" numeric(78, 0) NOT NULL,
59
59
  "block_number" bigint NOT NULL,
60
60
  "updated_at" timestamp DEFAULT now() NOT NULL
61
61
  );
62
62
  --> statement-breakpoint
63
- CREATE TABLE "router_v1.6"."obligation_collaterals" (
63
+ CREATE TABLE "router_v1.7"."obligation_collaterals" (
64
64
  "obligation_id" varchar(66) NOT NULL,
65
65
  "asset" varchar(42) NOT NULL,
66
66
  "oracle" varchar(42) NOT NULL,
@@ -68,7 +68,7 @@ CREATE TABLE "router_v1.6"."obligation_collaterals" (
68
68
  CONSTRAINT "obligation_collaterals_pk" PRIMARY KEY("obligation_id","asset")
69
69
  );
70
70
  --> statement-breakpoint
71
- CREATE TABLE "router_v1.6"."obligation_collaterals_v2" (
71
+ CREATE TABLE "router_v1.7"."obligation_collaterals_v2" (
72
72
  "obligation_id" varchar(66) NOT NULL,
73
73
  "asset" varchar(42) NOT NULL,
74
74
  "oracle_chain_id" bigint NOT NULL,
@@ -79,14 +79,14 @@ CREATE TABLE "router_v1.6"."obligation_collaterals_v2" (
79
79
  CONSTRAINT "obligation_collaterals_v2_pk" PRIMARY KEY("obligation_id","asset")
80
80
  );
81
81
  --> statement-breakpoint
82
- CREATE TABLE "router_v1.6"."obligations" (
82
+ CREATE TABLE "router_v1.7"."obligations" (
83
83
  "obligation_id" varchar(66) PRIMARY KEY NOT NULL,
84
84
  "chain_id" bigint NOT NULL,
85
85
  "loan_token" varchar(42) NOT NULL,
86
86
  "maturity" integer NOT NULL
87
87
  );
88
88
  --> statement-breakpoint
89
- CREATE TABLE "router_v1.6"."offer_liquidity_pools" (
89
+ CREATE TABLE "router_v1.7"."offer_liquidity_pools" (
90
90
  "offer_hash" varchar(66) NOT NULL,
91
91
  "pool_id" varchar(255) NOT NULL,
92
92
  "amount" numeric(78, 0) NOT NULL,
@@ -95,14 +95,14 @@ CREATE TABLE "router_v1.6"."offer_liquidity_pools" (
95
95
  CONSTRAINT "offer_liquidity_pools_pk" PRIMARY KEY("offer_hash","pool_id")
96
96
  );
97
97
  --> statement-breakpoint
98
- CREATE TABLE "router_v1.6"."offer_status" (
98
+ CREATE TABLE "router_v1.7"."offer_status" (
99
99
  "offer_hash" varchar(66) PRIMARY KEY NOT NULL,
100
100
  "status_id" serial NOT NULL,
101
101
  "block_number" bigint NOT NULL,
102
102
  "updated_at" timestamp DEFAULT now() NOT NULL
103
103
  );
104
104
  --> statement-breakpoint
105
- CREATE TABLE "router_v1.6"."offers" (
105
+ CREATE TABLE "router_v1.7"."offers" (
106
106
  "hash" varchar(66) PRIMARY KEY NOT NULL,
107
107
  "obligation_id" varchar(66) NOT NULL,
108
108
  "offering" varchar(42) NOT NULL,
@@ -123,7 +123,7 @@ CREATE TABLE "router_v1.6"."offers" (
123
123
  "block_number" bigint NOT NULL
124
124
  );
125
125
  --> statement-breakpoint
126
- CREATE TABLE "router_v1.6"."offers_v2" (
126
+ CREATE TABLE "router_v1.7"."offers_v2" (
127
127
  "hash" varchar(66) PRIMARY KEY NOT NULL,
128
128
  "obligation_id" varchar(66) NOT NULL,
129
129
  "assets" numeric(78, 0) NOT NULL,
@@ -142,7 +142,7 @@ CREATE TABLE "router_v1.6"."offers_v2" (
142
142
  "updated_at" timestamp DEFAULT now() NOT NULL
143
143
  );
144
144
  --> statement-breakpoint
145
- CREATE TABLE "router_v1.6"."oracles" (
145
+ CREATE TABLE "router_v1.7"."oracles" (
146
146
  "chain_id" bigint NOT NULL,
147
147
  "address" varchar(42) NOT NULL,
148
148
  "block_number" bigint NOT NULL,
@@ -150,55 +150,55 @@ CREATE TABLE "router_v1.6"."oracles" (
150
150
  CONSTRAINT "oracles_pk" PRIMARY KEY("chain_id","address")
151
151
  );
152
152
  --> statement-breakpoint
153
- CREATE TABLE "router_v1.6"."status" (
153
+ CREATE TABLE "router_v1.7"."status" (
154
154
  "id" serial PRIMARY KEY NOT NULL,
155
- "code" "router_v1.6"."status_code",
155
+ "code" "router_v1.7"."status_code",
156
156
  CONSTRAINT "status_code_unique" UNIQUE("code")
157
157
  );
158
158
  --> statement-breakpoint
159
- ALTER TABLE "router_v1.6"."consumed_events" ADD CONSTRAINT "consumed_events_groups_fk" FOREIGN KEY ("chain_id","maker","group") REFERENCES "router_v1.6"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
160
- ALTER TABLE "router_v1.6"."liquidity_links" ADD CONSTRAINT "liquidity_links_parent_pool_id_liquidity_pools_id_fk" FOREIGN KEY ("parent_pool_id") REFERENCES "router_v1.6"."liquidity_pools"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
161
- ALTER TABLE "router_v1.6"."liquidity_links" ADD CONSTRAINT "liquidity_links_child_pool_id_liquidity_pools_id_fk" FOREIGN KEY ("child_pool_id") REFERENCES "router_v1.6"."liquidity_pools"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
162
- ALTER TABLE "router_v1.6"."obligation_collaterals" ADD CONSTRAINT "obligation_collaterals_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.6"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
163
- ALTER TABLE "router_v1.6"."obligation_collaterals_v2" ADD CONSTRAINT "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.6"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
164
- ALTER TABLE "router_v1.6"."obligation_collaterals_v2" ADD CONSTRAINT "obligation_collaterals_v2_oracles_fk" FOREIGN KEY ("oracle_chain_id","oracle_address") REFERENCES "router_v1.6"."oracles"("chain_id","address") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
165
- ALTER TABLE "router_v1.6"."offer_liquidity_pools" ADD CONSTRAINT "offer_liquidity_pools_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
166
- ALTER TABLE "router_v1.6"."offer_liquidity_pools" ADD CONSTRAINT "offer_liquidity_pools_pool_id_liquidity_pools_id_fk" FOREIGN KEY ("pool_id") REFERENCES "router_v1.6"."liquidity_pools"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
167
- ALTER TABLE "router_v1.6"."offer_status" ADD CONSTRAINT "offer_status_offer_hash_offers_v2_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers_v2"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
168
- ALTER TABLE "router_v1.6"."offer_status" ADD CONSTRAINT "offer_status_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.6"."status"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
169
- ALTER TABLE "router_v1.6"."offers" ADD CONSTRAINT "offers_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.6"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
170
- ALTER TABLE "router_v1.6"."offers_v2" ADD CONSTRAINT "offers_v2_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.6"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
171
- ALTER TABLE "router_v1.6"."offers_v2" ADD CONSTRAINT "offers_v2_groups_fk" FOREIGN KEY ("group_chain_id","group_maker","group_group") REFERENCES "router_v1.6"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
172
- CREATE UNIQUE INDEX "chains_id_epoch_idx" ON "router_v1.6"."chains" USING btree ("chain_id","epoch");--> statement-breakpoint
173
- CREATE UNIQUE INDEX "collectors_chain_name_epoch_idx" ON "router_v1.6"."collectors" USING btree ("chain_id","name","epoch");--> statement-breakpoint
174
- CREATE INDEX "consumed_per_user_and_nonce_chain_id_offering_nonce_block_number_idx" ON "router_v1.6"."consumed_per_user_and_nonce" USING btree ("chain_id","offering","nonce","block_number" desc);--> statement-breakpoint
175
- CREATE INDEX "consumed_events_group_idx" ON "router_v1.6"."consumed_events" USING btree ("chain_id","maker","group");--> statement-breakpoint
176
- CREATE INDEX "consumed_events_block_number_idx" ON "router_v1.6"."consumed_events" USING btree ("block_number");--> statement-breakpoint
177
- CREATE INDEX "groups_chain_id_maker_group_consumed_idx" ON "router_v1.6"."groups" USING btree ("chain_id","maker","group","consumed");--> statement-breakpoint
178
- CREATE INDEX "liquidity_links_parent_pool_id_idx" ON "router_v1.6"."liquidity_links" USING btree ("parent_pool_id");--> statement-breakpoint
179
- CREATE INDEX "liquidity_links_child_pool_id_idx" ON "router_v1.6"."liquidity_links" USING btree ("child_pool_id");--> statement-breakpoint
180
- CREATE INDEX "obligation_collaterals_obligation_id_idx" ON "router_v1.6"."obligation_collaterals" USING btree ("obligation_id");--> statement-breakpoint
181
- CREATE INDEX "obligation_collaterals_v2_obligation_id_idx" ON "router_v1.6"."obligation_collaterals_v2" USING btree ("obligation_id");--> statement-breakpoint
182
- CREATE INDEX "obligation_collaterals_v2_oracle_fk_idx" ON "router_v1.6"."obligation_collaterals_v2" USING btree ("oracle_chain_id","oracle_address");--> statement-breakpoint
183
- CREATE INDEX "offer_liquidity_pools_pool_id_idx" ON "router_v1.6"."offer_liquidity_pools" USING btree ("pool_id");--> statement-breakpoint
184
- CREATE INDEX "offer_status_status_hash_idx" ON "router_v1.6"."offer_status" USING btree ("status_id","offer_hash");--> statement-breakpoint
185
- CREATE INDEX "offers_obligation_id_idx" ON "router_v1.6"."offers" USING btree ("obligation_id");--> statement-breakpoint
186
- CREATE INDEX "offers_offering_idx" ON "router_v1.6"."offers" USING btree ("offering");--> statement-breakpoint
187
- CREATE INDEX "offers_buy_idx" ON "router_v1.6"."offers" USING btree ("buy");--> statement-breakpoint
188
- CREATE INDEX "offers_chain_id_idx" ON "router_v1.6"."offers" USING btree ("chain_id");--> statement-breakpoint
189
- CREATE INDEX "offers_loan_token_idx" ON "router_v1.6"."offers" USING btree ("loan_token");--> statement-breakpoint
190
- CREATE INDEX "offers_maturity_idx" ON "router_v1.6"."offers" USING btree ("maturity");--> statement-breakpoint
191
- CREATE INDEX "offers_expiry_idx" ON "router_v1.6"."offers" USING btree ("expiry");--> statement-breakpoint
192
- CREATE INDEX "offers_rate_idx" ON "router_v1.6"."offers" USING btree ("rate");--> statement-breakpoint
193
- CREATE INDEX "offers_assets_idx" ON "router_v1.6"."offers" USING btree ("assets");--> statement-breakpoint
194
- CREATE INDEX "offers_created_at_idx" ON "router_v1.6"."offers" USING btree ("created_at");--> statement-breakpoint
195
- CREATE INDEX "offers_block_number_idx" ON "router_v1.6"."offers" USING btree ("block_number");--> statement-breakpoint
196
- CREATE INDEX "offers_rate_hash_idx" ON "router_v1.6"."offers" USING btree ("rate","hash");--> statement-breakpoint
197
- CREATE INDEX "offers_maturity_hash_idx" ON "router_v1.6"."offers" USING btree ("maturity","hash");--> statement-breakpoint
198
- CREATE INDEX "offers_expiry_hash_idx" ON "router_v1.6"."offers" USING btree ("expiry","hash");--> statement-breakpoint
199
- CREATE INDEX "offers_assets_hash_idx" ON "router_v1.6"."offers" USING btree ("assets","hash");--> statement-breakpoint
200
- CREATE INDEX "offers_rate_created_at_assets_hash_idx" ON "router_v1.6"."offers" USING btree ("rate","created_at" asc,"assets" desc,"hash" asc);--> statement-breakpoint
201
- CREATE INDEX "offers_v2_group_fk_idx" ON "router_v1.6"."offers_v2" USING btree ("group_chain_id","group_maker","group_group");--> statement-breakpoint
202
- CREATE INDEX "offers_v2_group_winner_sell_side_idx" ON "router_v1.6"."offers_v2" USING btree ("group_chain_id","group_maker","group_group","rate" desc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
203
- CREATE INDEX "offers_v2_group_winner_buy_side_idx" ON "router_v1.6"."offers_v2" USING btree ("group_chain_id","group_maker","group_group","rate" asc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
204
- CREATE INDEX "offers_v2_obligation_id_side_idx" ON "router_v1.6"."offers_v2" USING btree ("obligation_id","buy");
159
+ ALTER TABLE "router_v1.7"."consumed_events" ADD CONSTRAINT "consumed_events_groups_fk" FOREIGN KEY ("chain_id","maker","group") REFERENCES "router_v1.7"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
160
+ ALTER TABLE "router_v1.7"."liquidity_links" ADD CONSTRAINT "liquidity_links_parent_pool_id_liquidity_pools_id_fk" FOREIGN KEY ("parent_pool_id") REFERENCES "router_v1.7"."liquidity_pools"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
161
+ ALTER TABLE "router_v1.7"."liquidity_links" ADD CONSTRAINT "liquidity_links_child_pool_id_liquidity_pools_id_fk" FOREIGN KEY ("child_pool_id") REFERENCES "router_v1.7"."liquidity_pools"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
162
+ ALTER TABLE "router_v1.7"."obligation_collaterals" ADD CONSTRAINT "obligation_collaterals_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.7"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
163
+ ALTER TABLE "router_v1.7"."obligation_collaterals_v2" ADD CONSTRAINT "obligation_collaterals_v2_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.7"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
164
+ ALTER TABLE "router_v1.7"."obligation_collaterals_v2" ADD CONSTRAINT "obligation_collaterals_v2_oracles_fk" FOREIGN KEY ("oracle_chain_id","oracle_address") REFERENCES "router_v1.7"."oracles"("chain_id","address") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
165
+ ALTER TABLE "router_v1.7"."offer_liquidity_pools" ADD CONSTRAINT "offer_liquidity_pools_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
166
+ ALTER TABLE "router_v1.7"."offer_liquidity_pools" ADD CONSTRAINT "offer_liquidity_pools_pool_id_liquidity_pools_id_fk" FOREIGN KEY ("pool_id") REFERENCES "router_v1.7"."liquidity_pools"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
167
+ ALTER TABLE "router_v1.7"."offer_status" ADD CONSTRAINT "offer_status_offer_hash_offers_v2_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers_v2"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
168
+ ALTER TABLE "router_v1.7"."offer_status" ADD CONSTRAINT "offer_status_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.7"."status"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
169
+ ALTER TABLE "router_v1.7"."offers" ADD CONSTRAINT "offers_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.7"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
170
+ ALTER TABLE "router_v1.7"."offers_v2" ADD CONSTRAINT "offers_v2_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.7"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
171
+ ALTER TABLE "router_v1.7"."offers_v2" ADD CONSTRAINT "offers_v2_groups_fk" FOREIGN KEY ("group_chain_id","group_maker","group_group") REFERENCES "router_v1.7"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
172
+ CREATE UNIQUE INDEX "chains_id_epoch_idx" ON "router_v1.7"."chains" USING btree ("chain_id","epoch");--> statement-breakpoint
173
+ CREATE UNIQUE INDEX "collectors_chain_name_epoch_idx" ON "router_v1.7"."collectors" USING btree ("chain_id","name","epoch");--> statement-breakpoint
174
+ CREATE INDEX "consumed_per_user_and_nonce_chain_id_offering_nonce_block_number_idx" ON "router_v1.7"."consumed_per_user_and_nonce" USING btree ("chain_id","offering","nonce","block_number" desc);--> statement-breakpoint
175
+ CREATE INDEX "consumed_events_group_idx" ON "router_v1.7"."consumed_events" USING btree ("chain_id","maker","group");--> statement-breakpoint
176
+ CREATE INDEX "consumed_events_block_number_idx" ON "router_v1.7"."consumed_events" USING btree ("block_number");--> statement-breakpoint
177
+ CREATE INDEX "groups_chain_id_maker_group_consumed_idx" ON "router_v1.7"."groups" USING btree ("chain_id","maker","group","consumed");--> statement-breakpoint
178
+ CREATE INDEX "liquidity_links_parent_pool_id_idx" ON "router_v1.7"."liquidity_links" USING btree ("parent_pool_id");--> statement-breakpoint
179
+ CREATE INDEX "liquidity_links_child_pool_id_idx" ON "router_v1.7"."liquidity_links" USING btree ("child_pool_id");--> statement-breakpoint
180
+ CREATE INDEX "obligation_collaterals_obligation_id_idx" ON "router_v1.7"."obligation_collaterals" USING btree ("obligation_id");--> statement-breakpoint
181
+ CREATE INDEX "obligation_collaterals_v2_obligation_id_idx" ON "router_v1.7"."obligation_collaterals_v2" USING btree ("obligation_id");--> statement-breakpoint
182
+ CREATE INDEX "obligation_collaterals_v2_oracle_fk_idx" ON "router_v1.7"."obligation_collaterals_v2" USING btree ("oracle_chain_id","oracle_address");--> statement-breakpoint
183
+ CREATE INDEX "offer_liquidity_pools_pool_id_idx" ON "router_v1.7"."offer_liquidity_pools" USING btree ("pool_id");--> statement-breakpoint
184
+ CREATE INDEX "offer_status_status_hash_idx" ON "router_v1.7"."offer_status" USING btree ("status_id","offer_hash");--> statement-breakpoint
185
+ CREATE INDEX "offers_obligation_id_idx" ON "router_v1.7"."offers" USING btree ("obligation_id");--> statement-breakpoint
186
+ CREATE INDEX "offers_offering_idx" ON "router_v1.7"."offers" USING btree ("offering");--> statement-breakpoint
187
+ CREATE INDEX "offers_buy_idx" ON "router_v1.7"."offers" USING btree ("buy");--> statement-breakpoint
188
+ CREATE INDEX "offers_chain_id_idx" ON "router_v1.7"."offers" USING btree ("chain_id");--> statement-breakpoint
189
+ CREATE INDEX "offers_loan_token_idx" ON "router_v1.7"."offers" USING btree ("loan_token");--> statement-breakpoint
190
+ CREATE INDEX "offers_maturity_idx" ON "router_v1.7"."offers" USING btree ("maturity");--> statement-breakpoint
191
+ CREATE INDEX "offers_expiry_idx" ON "router_v1.7"."offers" USING btree ("expiry");--> statement-breakpoint
192
+ CREATE INDEX "offers_rate_idx" ON "router_v1.7"."offers" USING btree ("rate");--> statement-breakpoint
193
+ CREATE INDEX "offers_assets_idx" ON "router_v1.7"."offers" USING btree ("assets");--> statement-breakpoint
194
+ CREATE INDEX "offers_created_at_idx" ON "router_v1.7"."offers" USING btree ("created_at");--> statement-breakpoint
195
+ CREATE INDEX "offers_block_number_idx" ON "router_v1.7"."offers" USING btree ("block_number");--> statement-breakpoint
196
+ CREATE INDEX "offers_rate_hash_idx" ON "router_v1.7"."offers" USING btree ("rate","hash");--> statement-breakpoint
197
+ CREATE INDEX "offers_maturity_hash_idx" ON "router_v1.7"."offers" USING btree ("maturity","hash");--> statement-breakpoint
198
+ CREATE INDEX "offers_expiry_hash_idx" ON "router_v1.7"."offers" USING btree ("expiry","hash");--> statement-breakpoint
199
+ CREATE INDEX "offers_assets_hash_idx" ON "router_v1.7"."offers" USING btree ("assets","hash");--> statement-breakpoint
200
+ CREATE INDEX "offers_rate_created_at_assets_hash_idx" ON "router_v1.7"."offers" USING btree ("rate","created_at" asc,"assets" desc,"hash" asc);--> statement-breakpoint
201
+ CREATE INDEX "offers_v2_group_fk_idx" ON "router_v1.7"."offers_v2" USING btree ("group_chain_id","group_maker","group_group");--> statement-breakpoint
202
+ CREATE INDEX "offers_v2_group_winner_sell_side_idx" ON "router_v1.7"."offers_v2" USING btree ("group_chain_id","group_maker","group_group","rate" desc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
203
+ CREATE INDEX "offers_v2_group_winner_buy_side_idx" ON "router_v1.7"."offers_v2" USING btree ("group_chain_id","group_maker","group_group","rate" asc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
204
+ CREATE INDEX "offers_v2_obligation_id_side_idx" ON "router_v1.7"."offers_v2" USING btree ("obligation_id","buy");
@@ -20,12 +20,12 @@ BEGIN
20
20
  v_delta := NEW.amount - OLD.amount;
21
21
  ELSE
22
22
  -- move: undo old...
23
- UPDATE "router_v1.6"."groups" g
23
+ UPDATE "router_v1.7"."groups" g
24
24
  SET consumed = (g.consumed - OLD.amount)
25
25
  WHERE g.chain_id = OLD.chain_id AND g.maker = OLD.maker AND g."group" = OLD."group";
26
26
 
27
27
  -- ...apply new
28
- UPDATE "router_v1.6"."groups" g
28
+ UPDATE "router_v1.7"."groups" g
29
29
  SET consumed = (g.consumed + NEW.amount)
30
30
  WHERE g.chain_id = NEW.chain_id AND g.maker = NEW.maker AND g."group" = NEW."group";
31
31
 
@@ -42,7 +42,7 @@ BEGIN
42
42
  RAISE EXCEPTION 'Unsupported TG_OP %', TG_OP;
43
43
  END IF;
44
44
 
45
- UPDATE "router_v1.6"."groups" g
45
+ UPDATE "router_v1.7"."groups" g
46
46
  SET consumed = (g.consumed + v_delta)
47
47
  WHERE g.chain_id = v_chain_id AND g.maker = v_maker AND g."group" = v_group;
48
48
 
@@ -51,8 +51,8 @@ END;
51
51
  $$; --> statement-breakpoint
52
52
 
53
53
  -- trigger names can’t be schema-qualified
54
- DROP TRIGGER IF EXISTS trg_consumed_events ON "router_v1.6"."consumed_events"; --> statement-breakpoint
54
+ DROP TRIGGER IF EXISTS trg_consumed_events ON "router_v1.7"."consumed_events"; --> statement-breakpoint
55
55
 
56
56
  CREATE TRIGGER trg_consumed_events
57
- AFTER INSERT OR UPDATE OR DELETE ON "router_v1.6"."consumed_events"
57
+ AFTER INSERT OR UPDATE OR DELETE ON "router_v1.7"."consumed_events"
58
58
  FOR EACH ROW EXECUTE FUNCTION apply_group_consumed_delta();
@@ -1 +1 @@
1
- INSERT INTO "router_v1.6"."status" ("code") VALUES ('VALID'), ('NOT_ENOUGH_LIQUIDITY');
1
+ INSERT INTO "router_v1.7"."status" ("code") VALUES ('VALID'), ('NOT_ENOUGH_LIQUIDITY');
@@ -1,3 +1,3 @@
1
1
  -- drop old row-level trigger (if present)
2
- DROP TRIGGER IF EXISTS trg_consumed_events ON "router_v1.6"."consumed_events"; --> statement-breakpoint
2
+ DROP TRIGGER IF EXISTS trg_consumed_events ON "router_v1.7"."consumed_events"; --> statement-breakpoint
3
3
  DROP FUNCTION IF EXISTS apply_group_consumed_delta() CASCADE;
@@ -1 +1 @@
1
- ALTER TABLE "router_v1.6"."offer_status" DROP CONSTRAINT "offer_status_offer_hash_offers_v2_hash_fk";
1
+ ALTER TABLE "router_v1.7"."offer_status" DROP CONSTRAINT "offer_status_offer_hash_offers_v2_hash_fk";
@@ -1 +1 @@
1
- CREATE INDEX "offers_v2_group_and_hash_idx" ON "router_v1.6"."offers_v2" USING btree ("group_chain_id","group_maker","group_group","hash");
1
+ CREATE INDEX "offers_v2_group_and_hash_idx" ON "router_v1.7"."offers_v2" USING btree ("group_chain_id","group_maker","group_group","hash");
@@ -1,5 +1,5 @@
1
- CREATE TYPE "router_v1.6"."position_type" AS ENUM('erc20', 'vault_v1');--> statement-breakpoint
2
- CREATE TABLE "router_v1.6"."callbacks" (
1
+ CREATE TYPE "router_v1.7"."position_type" AS ENUM('erc20', 'vault_v1');--> statement-breakpoint
2
+ CREATE TABLE "router_v1.7"."callbacks" (
3
3
  "id" varchar(66) PRIMARY KEY NOT NULL,
4
4
  "position_chain_id" bigint NOT NULL,
5
5
  "position_contract" varchar(42) NOT NULL,
@@ -7,18 +7,18 @@ CREATE TABLE "router_v1.6"."callbacks" (
7
7
  "amount" numeric(78, 0) NOT NULL
8
8
  );
9
9
  --> statement-breakpoint
10
- CREATE TABLE "router_v1.6"."offers_callbacks" (
10
+ CREATE TABLE "router_v1.7"."offers_callbacks" (
11
11
  "offer_hash" varchar(66) NOT NULL,
12
12
  "callback_id" varchar(66),
13
13
  CONSTRAINT "offers_callbacks_pk" PRIMARY KEY("offer_hash","callback_id")
14
14
  );
15
15
  --> statement-breakpoint
16
- CREATE TABLE "router_v1.6"."position_types" (
16
+ CREATE TABLE "router_v1.7"."position_types" (
17
17
  "id" serial PRIMARY KEY NOT NULL,
18
- "type" "router_v1.6"."position_type" NOT NULL
18
+ "type" "router_v1.7"."position_type" NOT NULL
19
19
  );
20
20
  --> statement-breakpoint
21
- CREATE TABLE "router_v1.6"."positions" (
21
+ CREATE TABLE "router_v1.7"."positions" (
22
22
  "chain_id" bigint NOT NULL,
23
23
  "contract" varchar(42) NOT NULL,
24
24
  "user" varchar(42) NOT NULL,
@@ -29,9 +29,9 @@ CREATE TABLE "router_v1.6"."positions" (
29
29
  CONSTRAINT "positions_pk" PRIMARY KEY("chain_id","contract","user")
30
30
  );
31
31
  --> statement-breakpoint
32
- ALTER TABLE "router_v1.6"."offer_status" DROP CONSTRAINT "offer_status_status_id_status_id_fk";
32
+ ALTER TABLE "router_v1.7"."offer_status" DROP CONSTRAINT "offer_status_status_id_status_id_fk";
33
33
  --> statement-breakpoint
34
- ALTER TABLE "router_v1.6"."callbacks" ADD CONSTRAINT "callbacks_positions_fk" FOREIGN KEY ("position_chain_id","position_contract","position_user") REFERENCES "router_v1.6"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
35
- ALTER TABLE "router_v1.6"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_offer_hash_offers_v2_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers_v2"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
36
- ALTER TABLE "router_v1.6"."positions" ADD CONSTRAINT "positions_position_type_id_position_types_id_fk" FOREIGN KEY ("position_type_id") REFERENCES "router_v1.6"."position_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
37
- ALTER TABLE "router_v1.6"."offer_status" ADD CONSTRAINT "offer_status_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.6"."status"("id") ON DELETE no action ON UPDATE no action;
34
+ ALTER TABLE "router_v1.7"."callbacks" ADD CONSTRAINT "callbacks_positions_fk" FOREIGN KEY ("position_chain_id","position_contract","position_user") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
35
+ ALTER TABLE "router_v1.7"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_offer_hash_offers_v2_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers_v2"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
36
+ ALTER TABLE "router_v1.7"."positions" ADD CONSTRAINT "positions_position_type_id_position_types_id_fk" FOREIGN KEY ("position_type_id") REFERENCES "router_v1.7"."position_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
37
+ ALTER TABLE "router_v1.7"."offer_status" ADD CONSTRAINT "offer_status_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.7"."status"("id") ON DELETE no action ON UPDATE no action;
@@ -1,15 +1,15 @@
1
- CREATE TABLE "router_v1.6"."validations" (
1
+ CREATE TABLE "router_v1.7"."validations" (
2
2
  "offer_hash" varchar(66) PRIMARY KEY NOT NULL,
3
3
  "status_id" integer NOT NULL,
4
4
  "updated_at" timestamp DEFAULT now() NOT NULL
5
5
  );
6
6
  --> statement-breakpoint
7
- DELETE FROM "router_v1.6"."status" WHERE "code" = 'NOT_ENOUGH_LIQUIDITY';--> statement-breakpoint
8
- DROP TABLE "router_v1.6"."offer_status" CASCADE;--> statement-breakpoint
9
- ALTER TABLE "router_v1.6"."status" ALTER COLUMN "code" SET DATA TYPE text;--> statement-breakpoint
10
- UPDATE "router_v1.6"."status" SET "code" = 'SIMULATION_ERROR' WHERE "code" = 'NOT_ENOUGH_LIQUIDITY';--> statement-breakpoint
11
- DROP TYPE "router_v1.6"."status_code";--> statement-breakpoint
12
- CREATE TYPE "router_v1.6"."status_code" AS ENUM('VALID', 'SIMULATION_ERROR');--> statement-breakpoint
13
- ALTER TABLE "router_v1.6"."status" ALTER COLUMN "code" SET DATA TYPE "router_v1.6"."status_code" USING "code"::"router_v1.6"."status_code";--> statement-breakpoint
14
- ALTER TABLE "router_v1.6"."validations" ADD CONSTRAINT "validations_offer_hash_offers_v2_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers_v2"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
15
- ALTER TABLE "router_v1.6"."validations" ADD CONSTRAINT "validations_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.6"."status"("id") ON DELETE no action ON UPDATE no action;
7
+ DELETE FROM "router_v1.7"."status" WHERE "code" = 'NOT_ENOUGH_LIQUIDITY';--> statement-breakpoint
8
+ DROP TABLE "router_v1.7"."offer_status" CASCADE;--> statement-breakpoint
9
+ ALTER TABLE "router_v1.7"."status" ALTER COLUMN "code" SET DATA TYPE text;--> statement-breakpoint
10
+ UPDATE "router_v1.7"."status" SET "code" = 'SIMULATION_ERROR' WHERE "code" = 'NOT_ENOUGH_LIQUIDITY';--> statement-breakpoint
11
+ DROP TYPE "router_v1.7"."status_code";--> statement-breakpoint
12
+ CREATE TYPE "router_v1.7"."status_code" AS ENUM('VALID', 'SIMULATION_ERROR');--> statement-breakpoint
13
+ ALTER TABLE "router_v1.7"."status" ALTER COLUMN "code" SET DATA TYPE "router_v1.7"."status_code" USING "code"::"router_v1.7"."status_code";--> statement-breakpoint
14
+ ALTER TABLE "router_v1.7"."validations" ADD CONSTRAINT "validations_offer_hash_offers_v2_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers_v2"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
15
+ ALTER TABLE "router_v1.7"."validations" ADD CONSTRAINT "validations_status_id_status_id_fk" FOREIGN KEY ("status_id") REFERENCES "router_v1.7"."status"("id") ON DELETE no action ON UPDATE no action;
@@ -1,4 +1,4 @@
1
- CREATE TABLE "router_v1.6"."transfers" (
1
+ CREATE TABLE "router_v1.7"."transfers" (
2
2
  "event_id" varchar(128) PRIMARY KEY NOT NULL,
3
3
  "chain_id" bigint NOT NULL,
4
4
  "contract" varchar(42) NOT NULL,
@@ -9,6 +9,6 @@ CREATE TABLE "router_v1.6"."transfers" (
9
9
  "created_at" timestamp DEFAULT now() NOT NULL
10
10
  );
11
11
  --> statement-breakpoint
12
- ALTER TABLE "router_v1.6"."transfers" ADD CONSTRAINT "transfers_positions_from_fk" FOREIGN KEY ("chain_id","contract","from") REFERENCES "router_v1.6"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
13
- ALTER TABLE "router_v1.6"."transfers" ADD CONSTRAINT "transfers_positions_to_fk" FOREIGN KEY ("chain_id","contract","to") REFERENCES "router_v1.6"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
14
- CREATE INDEX "transfers_chain_contract_user_idx" ON "router_v1.6"."transfers" USING btree ("chain_id","contract","from","to","block_number");
12
+ ALTER TABLE "router_v1.7"."transfers" ADD CONSTRAINT "transfers_positions_from_fk" FOREIGN KEY ("chain_id","contract","from") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
13
+ ALTER TABLE "router_v1.7"."transfers" ADD CONSTRAINT "transfers_positions_to_fk" FOREIGN KEY ("chain_id","contract","to") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
14
+ CREATE INDEX "transfers_chain_contract_user_idx" ON "router_v1.7"."transfers" USING btree ("chain_id","contract","from","to","block_number");
@@ -1 +1 @@
1
- ALTER TABLE "router_v1.6"."oracles" ADD COLUMN "price" numeric(78, 0);
1
+ ALTER TABLE "router_v1.7"."oracles" ADD COLUMN "price" numeric(78, 0);
@@ -1 +1 @@
1
- ALTER TABLE "router_v1.6"."callbacks" ALTER COLUMN "amount" DROP NOT NULL;
1
+ ALTER TABLE "router_v1.7"."callbacks" ALTER COLUMN "amount" DROP NOT NULL;
@@ -1 +1 @@
1
- ALTER TABLE "router_v1.6"."positions" ADD COLUMN asset VARCHAR(42);
1
+ ALTER TABLE "router_v1.7"."positions" ADD COLUMN asset VARCHAR(42);
@@ -1,13 +1,13 @@
1
- ALTER TABLE "router_v1.6"."consumed_per_user_and_nonce" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
2
- ALTER TABLE "router_v1.6"."liquidity_links" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
3
- ALTER TABLE "router_v1.6"."liquidity_pools" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
4
- ALTER TABLE "router_v1.6"."obligation_collaterals" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
5
- ALTER TABLE "router_v1.6"."offer_liquidity_pools" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
6
- ALTER TABLE "router_v1.6"."offers" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
7
- DROP TABLE "router_v1.6"."consumed_per_user_and_nonce" CASCADE;--> statement-breakpoint
8
- DROP TABLE "router_v1.6"."liquidity_links" CASCADE;--> statement-breakpoint
9
- DROP TABLE "router_v1.6"."liquidity_pools" CASCADE;--> statement-breakpoint
10
- DROP TABLE "router_v1.6"."obligation_collaterals" CASCADE;--> statement-breakpoint
11
- DROP TABLE "router_v1.6"."offer_liquidity_pools" CASCADE;--> statement-breakpoint
12
- DROP TABLE "router_v1.6"."offers" CASCADE;--> statement-breakpoint
13
- ALTER TABLE "router_v1.6"."callbacks" ALTER COLUMN "amount" DROP NOT NULL;
1
+ ALTER TABLE "router_v1.7"."consumed_per_user_and_nonce" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
2
+ ALTER TABLE "router_v1.7"."liquidity_links" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
3
+ ALTER TABLE "router_v1.7"."liquidity_pools" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
4
+ ALTER TABLE "router_v1.7"."obligation_collaterals" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
5
+ ALTER TABLE "router_v1.7"."offer_liquidity_pools" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
6
+ ALTER TABLE "router_v1.7"."offers" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
7
+ DROP TABLE "router_v1.7"."consumed_per_user_and_nonce" CASCADE;--> statement-breakpoint
8
+ DROP TABLE "router_v1.7"."liquidity_links" CASCADE;--> statement-breakpoint
9
+ DROP TABLE "router_v1.7"."liquidity_pools" CASCADE;--> statement-breakpoint
10
+ DROP TABLE "router_v1.7"."obligation_collaterals" CASCADE;--> statement-breakpoint
11
+ DROP TABLE "router_v1.7"."offer_liquidity_pools" CASCADE;--> statement-breakpoint
12
+ DROP TABLE "router_v1.7"."offers" CASCADE;--> statement-breakpoint
13
+ ALTER TABLE "router_v1.7"."callbacks" ALTER COLUMN "amount" DROP NOT NULL;
@@ -1,23 +1,23 @@
1
- ALTER TABLE "router_v1.6"."offers_v2" RENAME TO "offers";--> statement-breakpoint
2
- ALTER TABLE "router_v1.6"."offers_callbacks" DROP CONSTRAINT "offers_callbacks_offer_hash_offers_v2_hash_fk";
1
+ ALTER TABLE "router_v1.7"."offers_v2" RENAME TO "offers";--> statement-breakpoint
2
+ ALTER TABLE "router_v1.7"."offers_callbacks" DROP CONSTRAINT "offers_callbacks_offer_hash_offers_v2_hash_fk";
3
3
  --> statement-breakpoint
4
- ALTER TABLE "router_v1.6"."offers" DROP CONSTRAINT "offers_v2_obligation_id_obligations_obligation_id_fk";
4
+ ALTER TABLE "router_v1.7"."offers" DROP CONSTRAINT "offers_v2_obligation_id_obligations_obligation_id_fk";
5
5
  --> statement-breakpoint
6
- ALTER TABLE "router_v1.6"."offers" DROP CONSTRAINT "offers_v2_groups_fk";
6
+ ALTER TABLE "router_v1.7"."offers" DROP CONSTRAINT "offers_v2_groups_fk";
7
7
  --> statement-breakpoint
8
- ALTER TABLE "router_v1.6"."validations" DROP CONSTRAINT "validations_offer_hash_offers_v2_hash_fk";
8
+ ALTER TABLE "router_v1.7"."validations" DROP CONSTRAINT "validations_offer_hash_offers_v2_hash_fk";
9
9
  --> statement-breakpoint
10
- DROP INDEX "router_v1.6"."offers_v2_group_fk_idx";--> statement-breakpoint
11
- DROP INDEX "router_v1.6"."offers_v2_group_and_hash_idx";--> statement-breakpoint
12
- DROP INDEX "router_v1.6"."offers_v2_group_winner_sell_side_idx";--> statement-breakpoint
13
- DROP INDEX "router_v1.6"."offers_v2_group_winner_buy_side_idx";--> statement-breakpoint
14
- DROP INDEX "router_v1.6"."offers_v2_obligation_id_side_idx";--> statement-breakpoint
15
- ALTER TABLE "router_v1.6"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
16
- ALTER TABLE "router_v1.6"."offers" ADD CONSTRAINT "offers_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.6"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
17
- ALTER TABLE "router_v1.6"."offers" ADD CONSTRAINT "offers_groups_fk" FOREIGN KEY ("group_chain_id","group_maker","group_group") REFERENCES "router_v1.6"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
18
- ALTER TABLE "router_v1.6"."validations" ADD CONSTRAINT "validations_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
19
- CREATE INDEX "offers_group_fk_idx" ON "router_v1.6"."offers" USING btree ("group_chain_id","group_maker","group_group");--> statement-breakpoint
20
- CREATE INDEX "offers_group_and_hash_idx" ON "router_v1.6"."offers" USING btree ("group_chain_id","group_maker","group_group","hash");--> statement-breakpoint
21
- CREATE INDEX "offers_group_winner_sell_side_idx" ON "router_v1.6"."offers" USING btree ("group_chain_id","group_maker","group_group","rate" desc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
22
- CREATE INDEX "offers_group_winner_buy_side_idx" ON "router_v1.6"."offers" USING btree ("group_chain_id","group_maker","group_group","rate" asc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
23
- CREATE INDEX "offers_obligation_id_side_idx" ON "router_v1.6"."offers" USING btree ("obligation_id","buy");
10
+ DROP INDEX "router_v1.7"."offers_v2_group_fk_idx";--> statement-breakpoint
11
+ DROP INDEX "router_v1.7"."offers_v2_group_and_hash_idx";--> statement-breakpoint
12
+ DROP INDEX "router_v1.7"."offers_v2_group_winner_sell_side_idx";--> statement-breakpoint
13
+ DROP INDEX "router_v1.7"."offers_v2_group_winner_buy_side_idx";--> statement-breakpoint
14
+ DROP INDEX "router_v1.7"."offers_v2_obligation_id_side_idx";--> statement-breakpoint
15
+ ALTER TABLE "router_v1.7"."offers_callbacks" ADD CONSTRAINT "offers_callbacks_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
16
+ ALTER TABLE "router_v1.7"."offers" ADD CONSTRAINT "offers_obligation_id_obligations_obligation_id_fk" FOREIGN KEY ("obligation_id") REFERENCES "router_v1.7"."obligations"("obligation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
17
+ ALTER TABLE "router_v1.7"."offers" ADD CONSTRAINT "offers_groups_fk" FOREIGN KEY ("group_chain_id","group_maker","group_group") REFERENCES "router_v1.7"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
18
+ ALTER TABLE "router_v1.7"."validations" ADD CONSTRAINT "validations_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
19
+ CREATE INDEX "offers_group_fk_idx" ON "router_v1.7"."offers" USING btree ("group_chain_id","group_maker","group_group");--> statement-breakpoint
20
+ CREATE INDEX "offers_group_and_hash_idx" ON "router_v1.7"."offers" USING btree ("group_chain_id","group_maker","group_group","hash");--> statement-breakpoint
21
+ CREATE INDEX "offers_group_winner_sell_side_idx" ON "router_v1.7"."offers" USING btree ("group_chain_id","group_maker","group_group","rate" desc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
22
+ CREATE INDEX "offers_group_winner_buy_side_idx" ON "router_v1.7"."offers" USING btree ("group_chain_id","group_maker","group_group","rate" asc,"block_number" asc,"assets" desc,"hash" asc);--> statement-breakpoint
23
+ CREATE INDEX "offers_obligation_id_side_idx" ON "router_v1.7"."offers" USING btree ("obligation_id","buy");
@@ -1,4 +1,4 @@
1
- CREATE TABLE "router_v1.6"."lots" (
1
+ CREATE TABLE "router_v1.7"."lots" (
2
2
  "chain_id" bigint NOT NULL,
3
3
  "user" varchar(42) NOT NULL,
4
4
  "contract" varchar(42) NOT NULL,
@@ -8,5 +8,5 @@ CREATE TABLE "router_v1.6"."lots" (
8
8
  CONSTRAINT "lots_pk" PRIMARY KEY("chain_id","user","contract","group")
9
9
  );
10
10
  --> statement-breakpoint
11
- ALTER TABLE "router_v1.6"."lots" ADD CONSTRAINT "lots_positions_fk" FOREIGN KEY ("chain_id","contract","user") REFERENCES "router_v1.6"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
12
- ALTER TABLE "router_v1.6"."lots" ADD CONSTRAINT "lots_groups_fk" FOREIGN KEY ("chain_id","user","group") REFERENCES "router_v1.6"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;
11
+ ALTER TABLE "router_v1.7"."lots" ADD CONSTRAINT "lots_positions_fk" FOREIGN KEY ("chain_id","contract","user") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
12
+ ALTER TABLE "router_v1.7"."lots" ADD CONSTRAINT "lots_groups_fk" FOREIGN KEY ("chain_id","user","group") REFERENCES "router_v1.7"."groups"("chain_id","maker","group") ON DELETE cascade ON UPDATE no action;
@@ -1,11 +1,11 @@
1
- CREATE TABLE "router_v1.6"."merkle_paths" (
1
+ CREATE TABLE "router_v1.7"."merkle_paths" (
2
2
  "offer_hash" varchar(66) PRIMARY KEY NOT NULL,
3
3
  "tree_root" varchar(66) NOT NULL,
4
4
  "proof_nodes" text NOT NULL,
5
5
  "created_at" timestamp DEFAULT now() NOT NULL
6
6
  );
7
7
  --> statement-breakpoint
8
- CREATE TABLE "router_v1.6"."offsets" (
8
+ CREATE TABLE "router_v1.7"."offsets" (
9
9
  "chain_id" bigint NOT NULL,
10
10
  "user" varchar(42) NOT NULL,
11
11
  "contract" varchar(42) NOT NULL,
@@ -14,13 +14,13 @@ CREATE TABLE "router_v1.6"."offsets" (
14
14
  CONSTRAINT "offsets_pk" PRIMARY KEY("chain_id","user","contract","group")
15
15
  );
16
16
  --> statement-breakpoint
17
- CREATE TABLE "router_v1.6"."trees" (
17
+ CREATE TABLE "router_v1.7"."trees" (
18
18
  "root" varchar(66) PRIMARY KEY NOT NULL,
19
19
  "root_signature" varchar(132) NOT NULL,
20
20
  "created_at" timestamp DEFAULT now() NOT NULL
21
21
  );
22
22
  --> statement-breakpoint
23
- ALTER TABLE "router_v1.6"."merkle_paths" ADD CONSTRAINT "merkle_paths_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.6"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
24
- ALTER TABLE "router_v1.6"."merkle_paths" ADD CONSTRAINT "merkle_paths_tree_root_trees_root_fk" FOREIGN KEY ("tree_root") REFERENCES "router_v1.6"."trees"("root") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
25
- ALTER TABLE "router_v1.6"."offsets" ADD CONSTRAINT "offsets_positions_fk" FOREIGN KEY ("chain_id","contract","user") REFERENCES "router_v1.6"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
26
- CREATE INDEX "merkle_paths_tree_root_idx" ON "router_v1.6"."merkle_paths" USING btree ("tree_root");
23
+ ALTER TABLE "router_v1.7"."merkle_paths" ADD CONSTRAINT "merkle_paths_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "router_v1.7"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
24
+ ALTER TABLE "router_v1.7"."merkle_paths" ADD CONSTRAINT "merkle_paths_tree_root_trees_root_fk" FOREIGN KEY ("tree_root") REFERENCES "router_v1.7"."trees"("root") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
25
+ ALTER TABLE "router_v1.7"."offsets" ADD CONSTRAINT "offsets_positions_fk" FOREIGN KEY ("chain_id","contract","user") REFERENCES "router_v1.7"."positions"("chain_id","contract","user") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
26
+ CREATE INDEX "merkle_paths_tree_root_idx" ON "router_v1.7"."merkle_paths" USING btree ("tree_root");
@@ -1 +1 @@
1
- ALTER TABLE "router_v1.6"."offers" DROP COLUMN "nonce";
1
+ ALTER TABLE "router_v1.7"."offers" DROP COLUMN "nonce";
@@ -1,3 +1,3 @@
1
- CREATE UNIQUE INDEX "chains_chain_id_idx" ON "router_v1.6"."chains" USING btree ("chain_id");--> statement-breakpoint
2
- CREATE UNIQUE INDEX "collectors_chain_name_idx" ON "router_v1.6"."collectors" USING btree ("chain_id","name");--> statement-breakpoint
3
- ALTER TABLE "router_v1.6"."collectors" ADD CONSTRAINT "collectors_chain_id_chains_chain_id_fk" FOREIGN KEY ("chain_id") REFERENCES "router_v1.6"."chains"("chain_id") ON DELETE no action ON UPDATE no action;
1
+ CREATE UNIQUE INDEX "chains_chain_id_idx" ON "router_v1.7"."chains" USING btree ("chain_id");--> statement-breakpoint
2
+ CREATE UNIQUE INDEX "collectors_chain_name_idx" ON "router_v1.7"."collectors" USING btree ("chain_id","name");--> statement-breakpoint
3
+ ALTER TABLE "router_v1.7"."collectors" ADD CONSTRAINT "collectors_chain_id_chains_chain_id_fk" FOREIGN KEY ("chain_id") REFERENCES "router_v1.7"."chains"("chain_id") ON DELETE no action ON UPDATE no action;
@@ -1,2 +1,2 @@
1
- ALTER TABLE "router_v1.6"."offers" ADD COLUMN "obligation_units" numeric(78, 0) DEFAULT '0' NOT NULL;--> statement-breakpoint
2
- ALTER TABLE "router_v1.6"."offers" ADD COLUMN "obligation_shares" numeric(78, 0) DEFAULT '0' NOT NULL;
1
+ ALTER TABLE "router_v1.7"."offers" ADD COLUMN "obligation_units" numeric(78, 0) DEFAULT '0' NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "router_v1.7"."offers" ADD COLUMN "obligation_shares" numeric(78, 0) DEFAULT '0' NOT NULL;
@@ -1 +1 @@
1
- ALTER TABLE "router_v1.6"."offers" ADD COLUMN "session" varchar(66) NOT NULL DEFAULT '0x0000000000000000000000000000000000000000000000000000000000000000';
1
+ ALTER TABLE "router_v1.7"."offers" ADD COLUMN "session" varchar(66) NOT NULL DEFAULT '0x0000000000000000000000000000000000000000000000000000000000000000';
@@ -1,2 +1,2 @@
1
- DROP INDEX IF EXISTS "router_v1.6"."collectors_chain_name_epoch_idx";--> statement-breakpoint
2
- DROP INDEX IF EXISTS "router_v1.6"."chains_id_epoch_idx";--> statement-breakpoint
1
+ DROP INDEX IF EXISTS "router_v1.7"."collectors_chain_name_epoch_idx";--> statement-breakpoint
2
+ DROP INDEX IF EXISTS "router_v1.7"."chains_id_epoch_idx";--> statement-breakpoint