@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.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
- if (!schema) {
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. Make sure you're using drizzle-orm v0.30.9 or above and schema is passed to drizzle constructor!"
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 = {