@secondlayer/shared 6.41.0 → 6.41.1

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.
@@ -1,4 +1,5 @@
1
1
  import { type Kysely, sql } from "kysely";
2
+ import { onChainPlane } from "../src/db/migration-role.ts";
2
3
 
3
4
  // Drop the vestigial `canonical` column from the burnchain reward tables
4
5
  // (plan f062). 0083 reserved it for a future mark-non-canonical reorg path;
@@ -12,49 +13,56 @@ import { type Kysely, sql } from "kysely";
12
13
  // handler's per-height DELETE. Tables are small (≤2 reward rows + slot rows
13
14
  // per burn block), so in-place DDL under the 30s lock_timeout is fine.
14
15
  export async function up(db: Kysely<unknown>): Promise<void> {
15
- await sql`SET lock_timeout = '30s'`.execute(db);
16
-
17
- await sql`DROP INDEX IF EXISTS burn_block_rewards_canonical_height_idx`.execute(
18
- db,
19
- );
20
- await sql`DROP INDEX IF EXISTS burn_block_reward_slots_canonical_height_idx`.execute(
21
- db,
22
- );
23
-
24
- await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_height_idx ON burn_block_rewards (burn_block_height)`.execute(
25
- db,
26
- );
27
- await sql`CREATE INDEX IF NOT EXISTS burn_block_reward_slots_height_idx ON burn_block_reward_slots (burn_block_height)`.execute(
28
- db,
29
- );
30
-
31
- await sql`ALTER TABLE burn_block_rewards DROP COLUMN IF EXISTS canonical`.execute(
32
- db,
33
- );
34
- await sql`ALTER TABLE burn_block_reward_slots DROP COLUMN IF EXISTS canonical`.execute(
35
- db,
36
- );
16
+ // Chain-plane tables only — under the split this must no-op on TARGET
17
+ // (the platform DB has no burnchain tables; unguarded CREATE INDEX there
18
+ // fails with 42P01 even with IF NOT EXISTS).
19
+ await onChainPlane(async () => {
20
+ await sql`SET lock_timeout = '30s'`.execute(db);
21
+
22
+ await sql`DROP INDEX IF EXISTS burn_block_rewards_canonical_height_idx`.execute(
23
+ db,
24
+ );
25
+ await sql`DROP INDEX IF EXISTS burn_block_reward_slots_canonical_height_idx`.execute(
26
+ db,
27
+ );
28
+
29
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_height_idx ON burn_block_rewards (burn_block_height)`.execute(
30
+ db,
31
+ );
32
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_reward_slots_height_idx ON burn_block_reward_slots (burn_block_height)`.execute(
33
+ db,
34
+ );
35
+
36
+ await sql`ALTER TABLE burn_block_rewards DROP COLUMN IF EXISTS canonical`.execute(
37
+ db,
38
+ );
39
+ await sql`ALTER TABLE burn_block_reward_slots DROP COLUMN IF EXISTS canonical`.execute(
40
+ db,
41
+ );
42
+ });
37
43
  }
38
44
 
39
45
  export async function down(db: Kysely<unknown>): Promise<void> {
40
- await sql`SET lock_timeout = '30s'`.execute(db);
41
-
42
- await sql`ALTER TABLE burn_block_rewards ADD COLUMN IF NOT EXISTS canonical BOOLEAN NOT NULL DEFAULT true`.execute(
43
- db,
44
- );
45
- await sql`ALTER TABLE burn_block_reward_slots ADD COLUMN IF NOT EXISTS canonical BOOLEAN NOT NULL DEFAULT true`.execute(
46
- db,
47
- );
48
-
49
- await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_canonical_height_idx ON burn_block_rewards (canonical, burn_block_height)`.execute(
50
- db,
51
- );
52
- await sql`CREATE INDEX IF NOT EXISTS burn_block_reward_slots_canonical_height_idx ON burn_block_reward_slots (canonical, burn_block_height)`.execute(
53
- db,
54
- );
55
-
56
- await sql`DROP INDEX IF EXISTS burn_block_rewards_height_idx`.execute(db);
57
- await sql`DROP INDEX IF EXISTS burn_block_reward_slots_height_idx`.execute(
58
- db,
59
- );
46
+ await onChainPlane(async () => {
47
+ await sql`SET lock_timeout = '30s'`.execute(db);
48
+
49
+ await sql`ALTER TABLE burn_block_rewards ADD COLUMN IF NOT EXISTS canonical BOOLEAN NOT NULL DEFAULT true`.execute(
50
+ db,
51
+ );
52
+ await sql`ALTER TABLE burn_block_reward_slots ADD COLUMN IF NOT EXISTS canonical BOOLEAN NOT NULL DEFAULT true`.execute(
53
+ db,
54
+ );
55
+
56
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_canonical_height_idx ON burn_block_rewards (canonical, burn_block_height)`.execute(
57
+ db,
58
+ );
59
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_reward_slots_canonical_height_idx ON burn_block_reward_slots (canonical, burn_block_height)`.execute(
60
+ db,
61
+ );
62
+
63
+ await sql`DROP INDEX IF EXISTS burn_block_rewards_height_idx`.execute(db);
64
+ await sql`DROP INDEX IF EXISTS burn_block_reward_slots_height_idx`.execute(
65
+ db,
66
+ );
67
+ });
60
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "6.41.0",
3
+ "version": "6.41.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",