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/index.js
CHANGED
|
@@ -1855,6 +1855,13 @@ var Database = class _Database {
|
|
|
1855
1855
|
for (const ext of extensions) {
|
|
1856
1856
|
try {
|
|
1857
1857
|
await this.exec(`CREATE EXTENSION IF NOT EXISTS "${ext}";`);
|
|
1858
|
+
const result = await this.queryParams(
|
|
1859
|
+
`SELECT EXISTS(SELECT 1 FROM pg_extension WHERE extname = $1) as exists`,
|
|
1860
|
+
[ext]
|
|
1861
|
+
);
|
|
1862
|
+
if (!result.rows[0]?.exists) {
|
|
1863
|
+
throw new Error(`Extension "${ext}" was not installed`);
|
|
1864
|
+
}
|
|
1858
1865
|
} catch (error) {
|
|
1859
1866
|
const message = error instanceof Error ? error.message : String(error);
|
|
1860
1867
|
throw new Error(
|
|
@@ -3647,7 +3654,18 @@ async function gen(options = {}) {
|
|
|
3647
3654
|
try {
|
|
3648
3655
|
spinner.start("Installing extensions...");
|
|
3649
3656
|
await tempDb.installExtensions(config.extensions);
|
|
3650
|
-
|
|
3657
|
+
if (config.extensions.includes("vector")) {
|
|
3658
|
+
const vectorCheck = await tempDb.query(
|
|
3659
|
+
"SELECT typname FROM pg_type WHERE typname = 'vector'"
|
|
3660
|
+
);
|
|
3661
|
+
if (vectorCheck.rows.length === 0) {
|
|
3662
|
+
spinner.fail("Vector extension installed but vector type not found!");
|
|
3663
|
+
throw new Error(
|
|
3664
|
+
"pgvector extension was installed but the 'vector' type is not available. This usually means pgvector is not properly installed on your PostgreSQL server."
|
|
3665
|
+
);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
spinner.succeed("Installed db extensions");
|
|
3651
3669
|
spinner.start("Loading schema into temp database...");
|
|
3652
3670
|
await tempDb.exec(targetSql);
|
|
3653
3671
|
spinner.succeed("Loaded schema into temp database");
|
|
@@ -3686,6 +3704,9 @@ ${commentSql}` : `-- Comment changes
|
|
|
3686
3704
|
${commentSql}`;
|
|
3687
3705
|
}
|
|
3688
3706
|
spinner.succeed("Checked comment changes");
|
|
3707
|
+
} catch (error) {
|
|
3708
|
+
spinner.fail("Failed to generate migration diff");
|
|
3709
|
+
throw error;
|
|
3689
3710
|
} finally {
|
|
3690
3711
|
spinner.start("Cleaning up temp database...");
|
|
3691
3712
|
try {
|