@mastra/pg 1.23.0-alpha.4 → 1.23.0-alpha.5

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.
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.23.0-alpha.4"
6
+ version: "1.23.0-alpha.5"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.23.0-alpha.4",
2
+ "version": "1.23.0-alpha.5",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -23057,6 +23057,11 @@ var PgFactoryStorage = class extends _mastra_core_storage.FactoryStorage {
23057
23057
  if (!spec.nullable || spec.type === "uuid-pk" || spec.primaryKey) continue;
23058
23058
  await this.#pool.query(`ALTER TABLE "${schema.name}" ALTER COLUMN "${name}" DROP NOT NULL`);
23059
23059
  }
23060
+ for (const [name, spec] of Object.entries(schema.columns)) {
23061
+ if (spec.type !== "bigint") continue;
23062
+ const { rows } = await this.#pool.query(`SELECT data_type FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = $1 AND column_name = $2`, [schema.name, name]);
23063
+ if (rows[0]?.data_type === "integer") await this.#pool.query(`ALTER TABLE "${schema.name}" ALTER COLUMN "${name}" TYPE BIGINT`);
23064
+ }
23060
23065
  for (const index of schema.uniqueIndexes ?? []) {
23061
23066
  assertIdentifier("index", index.name);
23062
23067
  index.columns.forEach((column) => assertIdentifier("column", column));