Migration and existing policy issues

When I run migrations, it fails to execute cause it says " applying migrations...PostgresError: policy 'foo' for table 'bar' already exists". First migration was fine, but now, every time I try to add a new migration file it fails on that. Ideas on how to go around it? I'm using postgres on supabase with RLS.
5 Replies
Mykhailo
Mykhailo5mo ago
Hey @ar7casper. I think you can add create if not exists to your migration smth like this create if not exists 'foo'>
Qing @ quotion.co
Hey Mykhailo, thank you, this resolved my issue as well. Should drizzle generate this " IF NOT EXISTS" statement in migration sql directly? I feel this is helpful in many scenarios.
ar7casper
ar7casper5mo ago
@Qing @ quotion.co Can you drop your statement? Something's off
Mykhailo
Mykhailo5mo ago
Hey @Qing @ quotion.co, as of now, Drizzle does not generate the 'IF NOT EXISTS' statement in migration SQL directly. However, in the future, there will be an option to generate SQL with or without the 'IF NOT EXISTS' statement.
Qing @ quotion.co
Thanks, that would be perfect fine.
Want results from more Discord servers?
Add your server