Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Migrating your Database with Phinx

Migrating your Database with Phinx

Learn how to use the Phinx database migration tool with it's creator Rob Morgan. This presentation will cover the basic concepts of Phinx including adding it to a project, creating new migrations and then executing them. You will also be exposed to more advanced features of Phinx and everyday use cases.

Rob Morgan

May 13, 2015
Tweet

Other Decks in Programming

Transcript

  1. What is Phinx?
    “Phinx is a tool that allows you to migrate
    your database schema over time”

    View full-size slide

  2. Why did I write it?

    View full-size slide

  3. Brief History
    • Released in 2012 under the MIT License
    • 32 Releases to Date
    • 350,000 Downloads and 70+ Contributors
    • Used in CakePHP 3.0.0
    • Built on top of Symfony Components (and only 3)

    View full-size slide

  4. Rob Morgan
    • Writing PHP for almost 15 years
    • Twitter: @_rjm_
    • Email: [email protected]
    • http://robmorgan.id.au

    View full-size slide

  5. asd
    Australia

    View full-size slide

  6. Why Should I Use
    Phinx?

    View full-size slide

  7. Here’s why:
    • Database Migration is not a new thing
    • Convenient way to change your schema over time
    • Write migrations using PHP code
    • Migrate up and down
    • Support (and tests!) for MySQL, PostgreSQL, SQLite
    and Microsoft SQL Server
    • Read: http://en.wikipedia.org/wiki/Schema_migration

    View full-size slide

  8. Used in production, but
    technically it’s still pre
    1.0.0

    View full-size slide

  9. Today’s Agenda
    • Adding Phinx to your project
    • Writing Migrations
    • Executing Migrations
    • The State of Your Database
    • Rolling Back

    View full-size slide

  10. What about Phinx
    0.5.0?

    View full-size slide

  11. Seed Command

    View full-size slide

  12. Cheers!
    • Rob Morgan (@_rjm_)
    • https://phinx.org
    • http://robmorgan.id.au
    • Slides will be on: https://joind.in/14273
    • https://github.com/robmorgan/phinx-screencast

    View full-size slide