Skip to content
markjerz edited this page Jan 8, 2016 · 3 revisions

(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:

Generate a migration script

dbm -s -c dev-db.ini

Write a migration script to disk

dbm -s -c dev-db.ini -l migrate.sql

Perform a migration there and then

dbm -m -c dev-db.ini

Note, that this runs the Seeder, see next.

Just run the Seeder

Seeding allows you to generate initial data. See Seeding for more details.

dbm -e -c dev-db.ini

Output Verbose

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

Documentation

Queries
Configuration
Tools

Clone this wiki locally