Define shared columns
hello ,
please i'm trying to create some shared columns definition in able to be used in multiple tables .
my file structure :
-> database/tables/<table_name>.ts : containing table definition + relations + schemas + types
-> database/tables/utils.ts: containing the shared functions + columns definitions
-> database/tables/index.ts : export all the tables + utils
here is where i define the shared columns : ( database/tables/utils.ts)
error:
3 Replies
Hello, when does this error occur?
Here a demo of shared columns https://drizzle.run/hoec133o0ktmw3hndjm0qkx0
Drizzle Run
Shared columns - Drizzle Run
If you have a circular dependencies, is it possible that you import
utils.ts
from index.ts
in your tables?
You can't do that since utils.ts
is also imported in index.ts
thanks Raphaël for the quick response ,
I've just rescanned my tables and i've found a nasty '.'
thanks for mentioning that🙏🏻