@axiom-lattice/pg-stores 1.0.84 → 1.0.85

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/pg-stores",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "PG stores implementation for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -23,8 +23,8 @@
23
23
  "@langchain/langgraph-checkpoint-postgres": "1.0.0",
24
24
  "pg": "^8.16.3",
25
25
  "uuid": "^9.0.1",
26
- "@axiom-lattice/core": "2.1.93",
27
- "@axiom-lattice/protocols": "2.1.47"
26
+ "@axiom-lattice/core": "2.1.94",
27
+ "@axiom-lattice/protocols": "2.1.48"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.11.24",
@@ -111,6 +111,15 @@ export class MigrationManager {
111
111
  const pkColumn = pkCheck.rows[0]?.column_name;
112
112
  const constraintName = pkCheck.rows[0]?.constraint_name;
113
113
  if (pkColumn === 'version' && constraintName) {
114
+ // Deduplicate names before changing PK. Under the old schema, the
115
+ // same migration name could be inserted at multiple versions by
116
+ // different MigrationManagers. Keep only the highest version.
117
+ await client.query(`
118
+ DELETE FROM lattice_schema_migrations a
119
+ USING lattice_schema_migrations b
120
+ WHERE a.name = b.name AND a.version < b.version
121
+ `);
122
+
114
123
  await client.query(
115
124
  `ALTER TABLE lattice_schema_migrations DROP CONSTRAINT ${constraintName}`
116
125
  );