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.

D93a09864bb627e616a6d31ab7151d1a?s=128

Rob Morgan

May 13, 2015
Tweet

Other Decks in Programming

Transcript

  1. None
  2. What is Phinx? “Phinx is a tool that allows you

    to migrate your database schema over time”
  3. None
  4. Why did I write it?

  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)
  6. Rob Morgan • Writing PHP for almost 15 years •

    Twitter: @_rjm_ • Email: robbym@gmail.com • http://robmorgan.id.au
  7. asd Australia

  8. None
  9. None
  10. None
  11. None
  12. Why Should I Use Phinx?

  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
  14. Used in production, but technically it’s still pre 1.0.0

  15. Today’s Agenda • Adding Phinx to your project • Writing

    Migrations • Executing Migrations • The State of Your Database • Rolling Back
  16. Demo

  17. What about Phinx 0.5.0?

  18. None
  19. Seed Command

  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