fatribz
fatribz
DTDrizzle Team
Created by xamarot on 7/23/2023 in #help
Schema issues with split files, relational queries
import { createRequire } from 'module';
import fs from 'fs';

const require = createRequire(import.meta.url);

export default fs.readdirSync(__dirname).reduce((schema: any, file: string) => {
if (file == "index.ts") return schema;
Object.assign(schema, require(/* @vite-ignore */ __dirname + '/' + file));
return schema;
}, {});
import { createRequire } from 'module';
import fs from 'fs';

const require = createRequire(import.meta.url);

export default fs.readdirSync(__dirname).reduce((schema: any, file: string) => {
if (file == "index.ts") return schema;
Object.assign(schema, require(/* @vite-ignore */ __dirname + '/' + file));
return schema;
}, {});
dynamic import of schema files in a directory, exported into one object
14 replies