Migrator.NET - running SQL after schema migration is complete

182 views Asked by At

I would like to run some SQL after the schema migration has been performed.

Some points:

  1. If I execute the SQL during the Up function call, it is not executing with the latest schema version because the schema update takes effect afterwards.

  2. Calling Database.Commit() commits the changes immediately, but the connection is closed therefore cannot execute SQL.

  3. Calling my SQL in the AfterUp() function the connection is also closed.

How am I supposed to execute some SQL after the schema has been updated?

1

There are 1 answers

0
Nippysaurus On BEST ANSWER

Immediately after asking this question it hit me ... Create another migration which just does the data. It will have an open connection and will only be performed once the schema migration has passed.