@vantreeseba/drizzle-graphql 1.0.1 → 1.0.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/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2234,11 +2234,13 @@ var generateSchemaData3 = (db, schema, relations, relationsDepthLimit, prefixes,
|
|
|
2234
2234
|
|
|
2235
2235
|
// src/index.ts
|
|
2236
2236
|
var buildSchema = (db, config) => {
|
|
2237
|
-
const schema = db._.fullSchema;
|
|
2238
2237
|
const relations = db._.relations;
|
|
2239
|
-
|
|
2238
|
+
const schema = db._.fullSchema ?? Object.fromEntries(
|
|
2239
|
+
Object.entries(relations).filter(([, config2]) => config2?.table != null).map(([key, config2]) => [key, config2.table])
|
|
2240
|
+
);
|
|
2241
|
+
if (!schema || !Object.keys(schema).length) {
|
|
2240
2242
|
throw new Error(
|
|
2241
|
-
"Drizzle-GraphQL Error: Schema not found in drizzle instance.
|
|
2243
|
+
"Drizzle-GraphQL Error: Schema not found in drizzle instance. Pass relations (from buildRelations/defineRelations) to the drizzle constructor so drizzle-graphql can detect your tables."
|
|
2242
2244
|
);
|
|
2243
2245
|
}
|
|
2244
2246
|
const prefixes = {
|