Enhancement: RunAfterCreateDatabase folder
ferventcoder opened this issue · 10 comments
This should have scripts that run only once, and only after a database is created. If you are hitting an existing database, these should not run.
This will run just after the alter database statements. This will not run if the database is created during a restore.
Fixed in 5ec9b4c
Fixed sql 2000 here: a184588
Oh excellent. This is exactly what I wanted for baseline work.
:D
Is it by design that this also doesn't run if you specify a custom script for CreateDatabaseCustomScript, for example?
/cds=%sql.files.directory%\custom_db_create.sql
It doesn't if you do not return true that a db was created, this is true.
Cheers Rob,
For the time being I've lumped the custom database create logic in with one of the scripts in the runAfterCreateDatabase folder and it does a load of ALTER DATABASE statements. It seems a bit clunky though. Is there a simple way for me to return true that a db was created when using -cds ?
yeah, just take a look here at how we do it: https://github.com/chucknorris/roundhouse/blob/master/product/roundhouse.databases.sqlserver/SqlServerDatabase.cs#L145
Worked perfectly, thanks @ferventcoder