nexusql 0.9.7 → 0.9.9

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
@@ -1862,7 +1862,7 @@ var Database = class _Database {
1862
1862
  [ext]
1863
1863
  );
1864
1864
  if (!result.rows[0]?.exists) {
1865
- throw new Error(`Extension "${ext}" was not installed`);
1865
+ throw new Error(`Extension ${quotedExt} was not installed`);
1866
1866
  }
1867
1867
  } catch (error) {
1868
1868
  const message = error instanceof Error ? error.message : String(error);
@@ -3654,8 +3654,16 @@ async function gen(options = {}) {
3654
3654
  const tempDb = db.withDatabase(tempDbName);
3655
3655
  let migrationSql = "";
3656
3656
  try {
3657
+ const hasVectorType = targetSql.toLowerCase().includes("vector");
3658
+ const extensions = [...config.extensions];
3659
+ if (hasVectorType && !extensions.includes("vector")) {
3660
+ spinner.info(
3661
+ "Detected 'vector' type usage - auto-enabling vector extension"
3662
+ );
3663
+ extensions.push("vector");
3664
+ }
3657
3665
  spinner.start("Installing extensions...");
3658
- await tempDb.installExtensions(config.extensions);
3666
+ await tempDb.installExtensions(extensions);
3659
3667
  if (config.extensions.includes("vector")) {
3660
3668
  const vectorCheck = await tempDb.query(
3661
3669
  "SELECT typname FROM pg_type WHERE typname = 'vector'"
@@ -3669,14 +3677,6 @@ async function gen(options = {}) {
3669
3677
  }
3670
3678
  spinner.succeed("Installed db extensions");
3671
3679
  spinner.start("Loading schema into temp database...");
3672
- if (targetSql.toLowerCase().includes("vector")) {
3673
- const vectorLines = targetSql.split("\n").filter(
3674
- (line) => line.toLowerCase().includes("vector")
3675
- );
3676
- console.log("\n[DEBUG] SQL lines with 'vector':");
3677
- vectorLines.forEach((line) => console.log(" ", line.trim()));
3678
- console.log("");
3679
- }
3680
3680
  await tempDb.exec(targetSql);
3681
3681
  spinner.succeed("Loaded schema into temp database");
3682
3682
  if (options.verbose) {