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. View Slide

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

    View Slide

  3. View Slide

  4. Why did I write it?

    View Slide

  5. 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 Slide

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

    View Slide

  7. asd
    Australia

    View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. Why Should I Use
    Phinx?

    View Slide

  13. 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 Slide

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

    View Slide

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

    View Slide

  16. Demo

    View Slide

  17. What about Phinx
    0.5.0?

    View Slide

  18. View Slide

  19. Seed Command

    View Slide

  20. 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 Slide