Slide 1

Slide 1 text

Doctrine Migrations It’s like source control for your database! Austin Morris Varsity News Network (We’re hiring!)

Slide 2

Slide 2 text

WTF?

Slide 3

Slide 3 text

Doctrine Migrations ● Programmatic database version control. ● Easy schema deployment. ● Let the ORM do the work! http://docs.doctrine-project.org/projects/doctrine-migrations/en/latest/

Slide 4

Slide 4 text

Installation

Slide 5

Slide 5 text

composer.json

Slide 6

Slide 6 text

Update Doctrine CLT

Slide 7

Slide 7 text

cli-config.php (Doctrine 2.4)

Slide 8

Slide 8 text

Configure Migrations

Slide 9

Slide 9 text

migrations.yml

Slide 10

Slide 10 text

New Commands!

Slide 11

Slide 11 text

$ vendor/bin/doctrine list migrations

Slide 12

Slide 12 text

Demo!

Slide 13

Slide 13 text

MyMDB

Slide 14

Slide 14 text

MyMDB.Entity.Movie.dcm.yml

Slide 15

Slide 15 text

Add $views

Slide 16

Slide 16 text

MyMDB.Entity.Movie.dcm.yml

Slide 17

Slide 17 text

Create Version $ vendor/bin/doctrine migrations:diff

Slide 18

Slide 18 text

MyMDB\DoctrineMigrations\VersionYYYYMMDDHHMMSS

Slide 19

Slide 19 text

$ vendor/bin/doctrine migrations:migrate

Slide 20

Slide 20 text

MyMDB

Slide 21

Slide 21 text

MyMDB

Slide 22

Slide 22 text

What else? ● Migrate up and down (revert). ● Migrate across multiple versions. ● Migrate to specific versions. ● Dry-run migrations. ● Manipulate data during migrations. ● Symfony has DoctrineMigrationsBundle

Slide 23

Slide 23 text

Problems? ● Kris?

Slide 24

Slide 24 text

Questions? @austinsmorris [email protected]