Wait for CockroachDB Command to Finish

140 views Asked by At

I currently have a .sql file with the likes of:

DROP VIEW IF EXISTS vw_example;

CREATE VIEW vw_example as
SELECT a FROM b;

When running this command as part of a flyway migration, if the view already exists, it fails, as if the create command is not waiting for the DROP IF EXISTS to finish.

I know SQL server has a GO type keyword. Is there a way to sort of tell cockroachdb to wait for the first command?

1

There are 1 answers

0
sallu On BEST ANSWER

As per the issue mentioned in the link, it is better to have the drop and create scripts in different migration files as flyway runs each migration in a single transaction.