Drizzle not creating table

Hello, Do I need to manually create the tables? I have schema set up but its not creating the tables?
8 Replies
TOSL
TOSL3mo ago
Share your schema. The most likely reason is because you aren't exporting the tables in your schema.
Mango
MangoOP3mo ago
// Guild Config
export const guildConfig = table("guildConfig", {
guildID: t.text("guildID").primaryKey(),
prefix: t.text("prefix").default(defaultData.guildConfig.prefix),
cmdDelete: t.integer("cmdDelete").default(defaultData.guildConfig.cmdDelete),
globalCooldown: t.integer("globalCooldown").default(defaultData.guildConfig.globalCooldown),
});
export const guildConfig = table("guildConfig", {
guildID: t.text("guildID").primaryKey(),
prefix: t.text("prefix").default(defaultData.guildConfig.prefix),
cmdDelete: t.integer("cmdDelete").default(defaultData.guildConfig.cmdDelete),
globalCooldown: t.integer("globalCooldown").default(defaultData.guildConfig.globalCooldown),
});
I am, It works through drizzle-kit push - but I assumed it gets auto created when we start the db.
TOSL
TOSL3mo ago
No, you have to push or generate & migrate.
Mango
MangoOP3mo ago
Is it possible to check if the tables exist and then push? Or can I just use push on startup everytime to make sure the tables exists?
TOSL
TOSL3mo ago
Why would need to push on startup everytime? Are you dropping your DB everytime? Push any time you make changes your schema and you're good to go
Mango
MangoOP3mo ago
No, I just want to make sure the tables exists, even if i create a new table, i want it to sync
TOSL
TOSL3mo ago
Drizzle won't duplicate tables.
Mango
MangoOP3mo ago
okay thats perfect thank you

Did you find this page helpful?