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
TOSL4w ago
Share your schema. The most likely reason is because you aren't exporting the tables in your schema.
Mango
MangoOP4w 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
TOSL4w ago
No, you have to push or generate & migrate.
Mango
MangoOP4w 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
TOSL4w 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
MangoOP4w ago
No, I just want to make sure the tables exists, even if i create a new table, i want it to sync
TOSL
TOSL4w ago
Drizzle won't duplicate tables.
Mango
MangoOP4w ago
okay thats perfect thank you

Did you find this page helpful?