nexusql 0.9.1 → 0.9.3
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/cli.js +22 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3217,6 +3217,13 @@ var Database = class _Database {
|
|
|
3217
3217
|
for (const ext of extensions) {
|
|
3218
3218
|
try {
|
|
3219
3219
|
await this.exec(`CREATE EXTENSION IF NOT EXISTS "${ext}";`);
|
|
3220
|
+
const result = await this.queryParams(
|
|
3221
|
+
`SELECT EXISTS(SELECT 1 FROM pg_extension WHERE extname = $1) as exists`,
|
|
3222
|
+
[ext]
|
|
3223
|
+
);
|
|
3224
|
+
if (!result.rows[0]?.exists) {
|
|
3225
|
+
throw new Error(`Extension "${ext}" was not installed`);
|
|
3226
|
+
}
|
|
3220
3227
|
} catch (error) {
|
|
3221
3228
|
const message = error instanceof Error ? error.message : String(error);
|
|
3222
3229
|
throw new Error(
|
|
@@ -3407,7 +3414,18 @@ async function gen(options = {}) {
|
|
|
3407
3414
|
try {
|
|
3408
3415
|
spinner.start("Installing extensions...");
|
|
3409
3416
|
await tempDb.installExtensions(config.extensions);
|
|
3410
|
-
|
|
3417
|
+
if (config.extensions.includes("vector")) {
|
|
3418
|
+
const vectorCheck = await tempDb.query(
|
|
3419
|
+
"SELECT typname FROM pg_type WHERE typname = 'vector'"
|
|
3420
|
+
);
|
|
3421
|
+
if (vectorCheck.rows.length === 0) {
|
|
3422
|
+
spinner.fail("Vector extension installed but vector type not found!");
|
|
3423
|
+
throw new Error(
|
|
3424
|
+
"pgvector extension was installed but the 'vector' type is not available. This usually means pgvector is not properly installed on your PostgreSQL server."
|
|
3425
|
+
);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
spinner.succeed("Installed db extensions");
|
|
3411
3429
|
spinner.start("Loading schema into temp database...");
|
|
3412
3430
|
await tempDb.exec(targetSql);
|
|
3413
3431
|
spinner.succeed("Loaded schema into temp database");
|
|
@@ -3446,6 +3464,9 @@ ${commentSql}` : `-- Comment changes
|
|
|
3446
3464
|
${commentSql}`;
|
|
3447
3465
|
}
|
|
3448
3466
|
spinner.succeed("Checked comment changes");
|
|
3467
|
+
} catch (error) {
|
|
3468
|
+
spinner.fail("Failed to generate migration diff");
|
|
3469
|
+
throw error;
|
|
3449
3470
|
} finally {
|
|
3450
3471
|
spinner.start("Cleaning up temp database...");
|
|
3451
3472
|
try {
|