@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.
package/dist/index.js
CHANGED
|
@@ -23033,6 +23033,11 @@ var PgFactoryStorage = class extends FactoryStorage {
|
|
|
23033
23033
|
if (!spec.nullable || spec.type === "uuid-pk" || spec.primaryKey) continue;
|
|
23034
23034
|
await this.#pool.query(`ALTER TABLE "${schema.name}" ALTER COLUMN "${name}" DROP NOT NULL`);
|
|
23035
23035
|
}
|
|
23036
|
+
for (const [name, spec] of Object.entries(schema.columns)) {
|
|
23037
|
+
if (spec.type !== "bigint") continue;
|
|
23038
|
+
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]);
|
|
23039
|
+
if (rows[0]?.data_type === "integer") await this.#pool.query(`ALTER TABLE "${schema.name}" ALTER COLUMN "${name}" TYPE BIGINT`);
|
|
23040
|
+
}
|
|
23036
23041
|
for (const index of schema.uniqueIndexes ?? []) {
|
|
23037
23042
|
assertIdentifier("index", index.name);
|
|
23038
23043
|
index.columns.forEach((column) => assertIdentifier("column", column));
|