Question

Photo of David Stevens

0

Tips for building a new database?

Has anyone found a way to run Rock migrations faster?   Using the core Rock:develop branch, there are a few hundred migrations that have to be run to set up a fresh database.

Once the database is set up, I found that Backup Devices are the best way to quickly switch versions:

Screenshot 2015-06-17 10.08.08.png

The backup device can be referenced in a backup/restore statement:

    alter database [Rock] set single_user with rollback immediate
    restore database [Rock] from people with replace
    alter database [Rock] set multi_user

When you switch to single_user mode, you'll drop all connections for a few seconds but this can be done in the background while VS/Rock is running.

  • Photo of David Leigh

    0

    EF Migrations are designed to be incremental, so there is no way to avoid running all of the migrations in sequence.

    However, the Rock.Migrations.dll is becoming quite large and will only continue to grow in future versions.

    One approach that could address this problem in the future would be to redefine the Initial Migration for each major release of Rock so that it would only migrate from a fully patched version of the previous major release. This would remove the need to carry the entire migration history into each new major release of the product.

    Your "quick-switch" backup solution seems like the best option for now!