@vantreeseba/drizzle-graphql 1.0.2 → 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 CHANGED
@@ -2208,11 +2208,13 @@ var generateSchemaData3 = (db, schema, relations, relationsDepthLimit, prefixes,
2208
2208
 
2209
2209
  // src/index.ts
2210
2210
  var buildSchema = (db, config) => {
2211
- const schema = db._.fullSchema;
2212
2211
  const relations = db._.relations;
2213
- if (!schema) {
2212
+ const schema = db._.fullSchema ?? Object.fromEntries(
2213
+ Object.entries(relations).filter(([, config2]) => config2?.table != null).map(([key, config2]) => [key, config2.table])
2214
+ );
2215
+ if (!schema || !Object.keys(schema).length) {
2214
2216
  throw new Error(
2215
- "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!"
2217
+ "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."
2216
2218
  );
2217
2219
  }
2218
2220
  const prefixes = {