Replies: 1 comment
-
Hi all. Working arround, I think this could solve the issue above For those scripts that are "baseline", add the following code snippet at the beginning, to prevent it from being executed when the database is already with tables IF EXISTS(SELECT * FROM sys.tables where [name] not in ('changelog'))
BEGIN
PRINT 'This is a baseline script and this DB already have tables, so it will be skipped'
SET NOEXEC ON
END
... all you script here...
SET NOEXEC OFF // Optional This allow us to create a complete brand new database in a test environment due that DB is empty but be skipped in prod due it's already with tables. remember, this use case is for when the database already exists in production but you still have to have a script that creates it completely and it must be part of your code repository. It works for me! Thank you all |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am assuming that with StartVersion I can do the same as with the FlyWay baseline command.
This is very useful for evolving databases that already exist. What I do is run StartVersion = 1 in production and then create my script with V0 and this way it will never try to migrate the whole script, only versions greater than 1, which is great.
My question is, what happens if I want to re-generate a "baseline" 1 year later. The correct thing would be to create a new script that contains the entire database, delete all other migration scripts and execute a StartVersion with a version greater than the new scipt.
But this is not possible because of this validation
Evolve/src/Evolve/Evolve.cs
Line 919 in f9c3a27
Any suggestion?
Beta Was this translation helpful? Give feedback.
All reactions