-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8085193
commit c57b3d6
Showing
6 changed files
with
154 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c57b3d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial Migration
Traditionally there are two ways to create a database compatible with a Signum Application:
Run
GenerateEnvironment
test, to create a small database with sample data that can be used as a starting point to run all the other unit tests.Run SQL and C# migrations to adapt a production-like database to the latest requirements of the application.
Both alternatives, however, start very similarly: by calling
Adminiatrator.CreateDatabase
. This method deletes all the tables, views, indexes, foreigner keys in the database (if any) and then creates a new empty database with all the tables as required by the applications.Unfortunately, this process was typically executed straight away, without storing the script to generate the tables in a Initial Migration.
This is ok for the
GenerateEnvironment
case, but not if we want to make a reproducible chain of migrations that is able to generate the current production schema from an empty database.This new feature helps developers that do not have a production-like database at hand to create a new SQL migration in development time.
Still, creating SQL migrations on a database where most tables are empty has some risks: Creating Unique Indexes, not nullable columns or new foreign keys could be misleadingly easy in your dev machine but could not work in live.
How it works
There are two ways of creating an Initial Migration from your
Terminal
applications:Create New Database
, just after it deletes all the tables, it will suggest creating an initial migration (ifMigrations
folder is empty) or execute existing migrations.c57b3d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a great useful improvement
Thanks 🙏
c57b3d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job 👍