I also assume you are familiar with the general problems of creating database migrations, such as generating DDL diff files, etc. This of course assumes you have good working knowledge of DDL and SQL, as well as some general understanding of database administration.

If you are new to DBIx::Class I really recommend you perform that tutorial first, and review its documentation.

This tutorial identifies the problem we are trying to solve, walks though increasingly complicated examples using these tools, and offers some advice as to the limit of the tool's value. We will also give some examples of how to make your migrations play well with common web application development frameworks such as Catalyst and how to use them with testing tools such as Test::DBIx::Class

By the completion of the tutorial I would expect you to understand how to prepare and install migrations, create custom deployment steps (and modify the stubs created during the prepare phase) as well as perform standard development workflows for testing and roundtripping a database.

All code mentioned can be found the /examples/MusicBase directory contained in the distribution installation files. Additionally, we will use as a starting point a database as similar as possible to the one described in DBIx::Class::Manual::Example so that if you are still new to DBIx::Class you can review those docs and think of this tutorial as a natural progression in learning.

INTRODUCTION

Dealing with change in your database can be a vexing problem. You need the ability manage database versions (how your database changes over time). You need to be able to upgrade seamlessly from one version to another. You need to be able to manage database and system data, and how they change over time. Additionally you may need to be able to create subsets of data for testing, and the ability to reset the database to a given state at any time.

There's a lot of frameworks that claim to make this easy. Generally this is partially achieve by limiting the scope of changes allowed, and reducing your ability to take maximum advantage of your database features. I'm not going to make that claim, since DBIx::Class::Migration is part of the DBIx::Class software ecosystem, and since that is an ORM that maximized your ability to be flexible and model databases using best practices, we desire to follow that ethos. What I will try to claim is that we can make solving the problem of database change possible, standard, and managed. This should reduce your stress, enable you to be more productive and not fear the need to change your tables.

fixture configuration

fixtures

Subsets of information from your database, linked to a version, in the form of individual files.

migration

SQL and Perl files associated with a given version, or an upgrade or downgrade between versions.

deployment

fixture configurations, fixtures and deployment files for a given version, and how to upgrade or downgrade to that version.

NEXT STEPS: TABLE OF CONTENTS

Here's the next steps in the tutorial. It goes without saying that you should have a good working installation of Perl, and a dedicated local::lib. Please see App::perlbrew for help setting up such a perl installation.

I also assume you have SQLite installed and parts of the advanced tutorial will assume you have MySQL available. Please see MySQL::Sandbox for some help in getting a development instance of MySQL running.