pg-structure
pg-structure copied to clipboard
Error: 'uuid' cannot be found in CompositeType's name.
Hello
I'm getting the following error. The table in question, organization
does use composite types. However, I've tried with tables that do not have composite types or uuid types and I get the same error.
/home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/indexable-array/dist/index.js:491
throw new Error(`'${value}' cannot be found in ${possibleType || ""}${key}.`);
^
Error: 'uuid' cannot be found in CompositeType's name.
at Proxy.get (/home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/indexable-array/dist/index.js:491:19)
at new Column (/home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/pg-structure/dist/pg-structure/column.js:38:128)
at /home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/pg-structure/dist/main.js:184:29
at Array.forEach (<anonymous>)
at addColumns (/home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/pg-structure/dist/main.js:180:10)
at addObjects (/home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/pg-structure/dist/main.js:333:5)
at pgStructure (/home/bob/git/bobtech/bobby/node_modules/.pnpm/[email protected]/node_modules/pg-structure/dist/main.js:376:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async demo (/home/bob/git/bobtech/bobby/apps/bobby-api/dist/src/pgstruct.js:6:16)
Node.js v18.14.2
Sample
import pgStructure from "pg-structure";
async function demo() {
// Prefer to use environment variables or ".env" file for the credentials. See the ".env.example" file.
const db = await pgStructure({
host: "localhost",
port: 54322,
database: "postgres",
user: "postgres",
password: "postgres"
},
{ includeSchemas: ["public"] });
const table = db.get("organization");
// const columnNames = table.columns.map((c) => c.name);
// console.log("columnNames", columnNames);
// const columnTypeName = table.columns.get("options").type.name;
// const indexColumnNames = table.indexes.get("ix_mail").columns;
// const relatedTables = table.hasManyTables;
}
demo();