-
Notifications
You must be signed in to change notification settings - Fork 7
Dbm
(As you'll have seen in the Intro) the dbm tool, which is included via Nuget, allows you to update your database schema in line with changes to your code.
!!! WARNING !!!
PLEASE DON'T BLINDLY RUN THIS AGAINST YOUR PRODUCTION DATABASE.
Usage is pretty simple, make sure your dev-db file is correct and then simply execute dbm telling it where dev-db.ini is located. Clearly, you can have multiple .ini files, corresponding to your dev, uat, staging, production environments.
Just running dbm.exe will provide you with (some) helpful hints as to how to use it. This is mostly what you'll need:
dbm -s -c dev-db.ini
dbm -s -c dev-db.ini -l migrate.sql
dbm -m -c dev-db.ini
Note, that this runs the Seeder, see next.
Seeding allows you to generate initial data. See Seeding for more details.
dbm -e -c dev-db.ini
Add -v to output logging. This is particularly useful to see what's going on. There is a common issue whereby the dbm tool appears to keep regenerating indexes on a table. This is usually because the pluralizer is not working in the same way both directions. You can add the table names manually to dev-db.ini