@code-partner/codepipe-hub 0.14.1-dev.388.g455782fa → 0.14.1-dev.389.g16ca7a21

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 (2) hide show
  1. package/hub/dist/index.js +14 -2
  2. package/package.json +1 -1
package/hub/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var PLATFORM_VERSION;
13
13
  var init_version_generated = __esm({
14
14
  "../packages/shared/dist/version.generated.js"() {
15
15
  "use strict";
16
- PLATFORM_VERSION = "0.14.1-dev.388.g455782fa";
16
+ PLATFORM_VERSION = "0.14.1-dev.389.g16ca7a21";
17
17
  }
18
18
  });
19
19
 
@@ -4505,6 +4505,11 @@ function applySqliteMigrations(client) {
4505
4505
  client.raw.pragma("busy_timeout = 0");
4506
4506
  }
4507
4507
  }
4508
+ function assertNotAhead(current, known, what) {
4509
+ if (current > known) {
4510
+ throw new Error(`${what} was migrated by a newer build (schema ${current}; this build knows ${known}). Run the newer codepipe, or start from a fresh data directory.`);
4511
+ }
4512
+ }
4508
4513
  function applyLadder(client) {
4509
4514
  client.raw.exec(`CREATE TABLE IF NOT EXISTS schema_version (
4510
4515
  version INTEGER PRIMARY KEY,
@@ -4513,6 +4518,7 @@ function applyLadder(client) {
4513
4518
  )`);
4514
4519
  const row = client.raw.prepare(`SELECT MAX(version) AS v FROM schema_version`).get();
4515
4520
  let current = row.v ?? 0;
4521
+ assertNotAhead(current, SQLITE_SCHEMA_VERSION, "this database");
4516
4522
  for (const m of SQLITE_MIGRATIONS) {
4517
4523
  if (m.version <= current)
4518
4524
  continue;
@@ -4772,6 +4778,11 @@ function applyLocalHostMigrations(client) {
4772
4778
  )`);
4773
4779
  const row = client.raw.prepare(`SELECT MAX(version) AS v FROM host_schema_version`).get();
4774
4780
  let current = row.v ?? 0;
4781
+ if (current > LOCAL_HOST_SCHEMA_VERSION) {
4782
+ throw new Error(
4783
+ `this local hub store was migrated by a newer build (host schema ${current}; this build knows ${LOCAL_HOST_SCHEMA_VERSION}). Run the newer codepipe, or start from a fresh data directory.`
4784
+ );
4785
+ }
4775
4786
  for (const m of LOCAL_HOST_MIGRATIONS) {
4776
4787
  if (m.version <= current) continue;
4777
4788
  const apply = client.raw.transaction(() => {
@@ -4786,7 +4797,7 @@ function applyLocalHostMigrations(client) {
4786
4797
  client.raw.pragma("busy_timeout = 0");
4787
4798
  }
4788
4799
  }
4789
- var LOCAL_HOST_MIGRATIONS;
4800
+ var LOCAL_HOST_MIGRATIONS, LOCAL_HOST_SCHEMA_VERSION;
4790
4801
  var init_schema_local = __esm({
4791
4802
  "src/db/schema-local.ts"() {
4792
4803
  "use strict";
@@ -5361,6 +5372,7 @@ CREATE INDEX idx_model_search_project ON model_search_index(project_id);
5361
5372
  sql: `ALTER TABLE projects ADD COLUMN routing_json TEXT;`
5362
5373
  }
5363
5374
  ];
5375
+ LOCAL_HOST_SCHEMA_VERSION = LOCAL_HOST_MIGRATIONS[LOCAL_HOST_MIGRATIONS.length - 1].version;
5364
5376
  }
5365
5377
  });
5366
5378
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-partner/codepipe-hub",
3
- "version": "0.14.1-dev.388.g455782fa",
3
+ "version": "0.14.1-dev.389.g16ca7a21",
4
4
  "description": "The CodePipe hub, packaged for one machine: the CLI installs it on demand for the local profile.",
5
5
  "type": "module",
6
6
  "main": "./hub/dist/index.js",