I’ve been working with ReadyRoll quite a bit the last few months, and wanted to start putting out some information. I’m looking to do a longer series, but here’s a quick post on getting started.
When you install ReadyRoll, you get a new project type under SQL Server.
This is a database project that will track all changes to your database as a series of migration scripts. Let’s get started. I’ll choose this and give it a name.
Once I do this, I get the ReadyRoll window with some information. What I really want to do here is point this to my existing database. Right now it’s looking at a LocalDB instance.
I’ll click the configure link and get the Connection String dialog. This is the database that mirrors one of the SSC databases, with lots of objects in it.
Once I’ve done this, the project will use this database. The Shadow database will also be on this instance.
I need to make one other change and set the correct version in the Project Settings.
Now, back to the ReadyRoll window. I’ve configured the DB connection, so I can ignore that. What I want to do is import my database, getting a baseline script.
I click that and ReadyRoll creates a Shadow database (since one doesn’t exist) and begins to import objects.
Once that’s done, I get a list.
And a migration script.
This is my baseline, starting script. This contains all the objects that exist in the database at this point. These are also added to the Schema-Model, but I can ignore those. I’m going to work on the database itself.
The ReadyRoll widget notes this was an import, and there’s no need to deploy anything since these aren’t changes, but just the state of the db.
I can see this if I do a Visual Studio build. Note the message in the middle: No migrations pending deployment. The changes in script 1 (001_20160614-1249_sjones.sql) are already in the db.
Now I can make changes to my database and get new scripts. Add a table in the designer?
When I click Update (and Generate Script), I get a new migration script.
Note that I just generated this script. I’ll write more about this process later, but for now, I’ll click Deploy Project to execute this against my database. When I do that, VS does a build, and one migration is executed.
Add a procedure?
Generate a new migration script.
And so it goes. I can work with my database in VS and get new scripts. I can also do an import if someone else makes changes to the database from their own machine with VS, SSMS, SQLCMD, isql, etc. The import will generate another migration script that gets added.
This is a really basic look at ReadyRoll, but it will get you started. I’ll tackle more topics and different ways of working with database development in another series of posts.