SlideShare a Scribd company logo
1 of 16
KeepingA Bunch of
DatabaseSchemas
Synchronized
What we’ve learned about Doctrine Migrations
Docker
Dev
Test
Live
The Problem:
Lots of Databases
Docker
Dev
Test
Live
Non-Solution
ManualChanges
An EasierWay
Doctrine Migrations
Docker Dev Test Live
Where we
are using it
SMART IRB Exchange
eSMART
How it works
Generate a new migration file
Write SQL scripts
Version20170512192814.php
Execute the migration
Doctrine records the update
20170512192814
Generating the
migration file
php bin/migrations.php generate
app/console doctrine:migrations:generateSymfony
Stand Alone
Writing the
SQL
Executing the
migration
php bin/migrations.php migrate
php bin/migrations.php execute 2017051080718 --down
Up
Down
app/console doctrine:migrations:migrate
app/console doctrine:migrations:execute 2017051080718 --down
KeepingTrack
The Database The Directory
That’s the
basics Generate Execute TrackCode
Questions?
Lessons
Learned
 Challenges in multi-developer situations
 Try to avoid using execute --up and execute --down
 DM tries to use symfony EM defined in config.yml for connection
 Use --db-configuration=/path/to/file to specify
separate credentials
 Even better, create a wrapper script and use Env.php to detect
environment and load correct credentials
Example
WrapperScript
Complex
Migrations
You can access the
PDO connection using
$this->connection
Is Doctrine
Migrations
worth it?
References
Doctrine Migrations Documentation
• http://www.doctrine-project.org/projects/migrations.html
Article on using stand-alone Doctrine Migrations
• https://akrabat.com/using-doctrine-migrations-outside-of-doctrine-
orm-or-symfony/
Notes for inclusion in SMART IRB Exchange
• https://github.com/vanderbilt/irbshare/wiki/Using-Doctrine-
Migrations

More Related Content

What's hot

Symfony2 Specification by examples
Symfony2   Specification by examplesSymfony2   Specification by examples
Symfony2 Specification by examplesCorley S.r.l.
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareChris Jean
 
Modern Gentlemen's WordPress
Modern Gentlemen's WordPressModern Gentlemen's WordPress
Modern Gentlemen's WordPressEnrico Deleo
 
Essentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with WebpackEssentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with WebpackKhaled Al-Ansari
 
WebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebWebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebVũ Nguyễn
 
Jakarta WordPress Meetup #9: Introducing VVV 2
Jakarta WordPress Meetup #9: Introducing VVV 2Jakarta WordPress Meetup #9: Introducing VVV 2
Jakarta WordPress Meetup #9: Introducing VVV 2WordPress
 
How I Learned to Stop Worrying and Backup WordPress
How I Learned to Stop Worrying and Backup WordPressHow I Learned to Stop Worrying and Backup WordPress
How I Learned to Stop Worrying and Backup WordPressChris Jean
 
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014Endava
 
wp cli- don’t fear the command line
wp cli- don’t fear the command linewp cli- don’t fear the command line
wp cli- don’t fear the command lineDwayne McDaniel
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii ShumadaFwdays
 
Deploy an Asp.Net Core App on Azure
Deploy an Asp.Net Core App on AzureDeploy an Asp.Net Core App on Azure
Deploy an Asp.Net Core App on AzureMichele Aponte
 
Building plugins like a pro
Building plugins like a proBuilding plugins like a pro
Building plugins like a proMarko Heijnen
 
What Visual Studio Code can do for Java Development
What Visual Studio Code can do for Java DevelopmentWhat Visual Studio Code can do for Java Development
What Visual Studio Code can do for Java DevelopmentEd Burns
 
Turnkey Continuous Delivery
Turnkey Continuous DeliveryTurnkey Continuous Delivery
Turnkey Continuous DeliveryGianni Bombelli
 

What's hot (20)

Flask
FlaskFlask
Flask
 
Symfony2 Specification by examples
Symfony2   Specification by examplesSymfony2   Specification by examples
Symfony2 Specification by examples
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
 
Modern Gentlemen's WordPress
Modern Gentlemen's WordPressModern Gentlemen's WordPress
Modern Gentlemen's WordPress
 
Essentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with WebpackEssentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with Webpack
 
WebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebWebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the Web
 
Jakarta WordPress Meetup #9: Introducing VVV 2
Jakarta WordPress Meetup #9: Introducing VVV 2Jakarta WordPress Meetup #9: Introducing VVV 2
Jakarta WordPress Meetup #9: Introducing VVV 2
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
How I Learned to Stop Worrying and Backup WordPress
How I Learned to Stop Worrying and Backup WordPressHow I Learned to Stop Worrying and Backup WordPress
How I Learned to Stop Worrying and Backup WordPress
 
Basics to framework programming
Basics to framework programmingBasics to framework programming
Basics to framework programming
 
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
Click’n’Deploy | SuperSpeakers @CodeCamp Iasi, 2014
 
wp cli- don’t fear the command line
wp cli- don’t fear the command linewp cli- don’t fear the command line
wp cli- don’t fear the command line
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
 
Deploy an Asp.Net Core App on Azure
Deploy an Asp.Net Core App on AzureDeploy an Asp.Net Core App on Azure
Deploy an Asp.Net Core App on Azure
 
Building plugins like a pro
Building plugins like a proBuilding plugins like a pro
Building plugins like a pro
 
Working in harmony
Working in harmonyWorking in harmony
Working in harmony
 
OpenNTF Essentials
OpenNTF EssentialsOpenNTF Essentials
OpenNTF Essentials
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
What Visual Studio Code can do for Java Development
What Visual Studio Code can do for Java DevelopmentWhat Visual Studio Code can do for Java Development
What Visual Studio Code can do for Java Development
 
Turnkey Continuous Delivery
Turnkey Continuous DeliveryTurnkey Continuous Delivery
Turnkey Continuous Delivery
 

Similar to Using Doctrine Migrations to Synchronize Databases

Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaAmazon Web Services
 
PHP North-East - Automated Deployment
PHP North-East - Automated DeploymentPHP North-East - Automated Deployment
PHP North-East - Automated DeploymentMichael Peacock
 
Automated Deployment
Automated DeploymentAutomated Deployment
Automated Deploymentphpne
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestJoshua Warren
 
Real World Experience: Integrating DB2 with XPages
Real World Experience: Integrating DB2 with XPagesReal World Experience: Integrating DB2 with XPages
Real World Experience: Integrating DB2 with XPagesSteve_Zavocki
 
Scale your Magento app with Elastic Beanstalk
Scale your Magento app with Elastic BeanstalkScale your Magento app with Elastic Beanstalk
Scale your Magento app with Elastic BeanstalkCorley S.r.l.
 
Scale your PHP application with Elastic Beanstalk - CloudParty Genova
Scale your PHP application with Elastic Beanstalk - CloudParty GenovaScale your PHP application with Elastic Beanstalk - CloudParty Genova
Scale your PHP application with Elastic Beanstalk - CloudParty GenovaCorley S.r.l.
 
DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15Edureka!
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version ControlNowell Strite
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Edureka!
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Productiondevopsdaysaustin
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Ivo Jansch
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administratorsSharon James
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzSteve Hoffman
 
Webinar: DevOps - Redefining your IT Strategy
Webinar: DevOps - Redefining your IT StrategyWebinar: DevOps - Redefining your IT Strategy
Webinar: DevOps - Redefining your IT StrategyEdureka!
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Agile Base Camp
 
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Edureka!
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 

Similar to Using Doctrine Migrations to Synchronize Databases (20)

Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 
PHP North-East - Automated Deployment
PHP North-East - Automated DeploymentPHP North-East - Automated Deployment
PHP North-East - Automated Deployment
 
Automated Deployment
Automated DeploymentAutomated Deployment
Automated Deployment
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
 
Real World Experience: Integrating DB2 with XPages
Real World Experience: Integrating DB2 with XPagesReal World Experience: Integrating DB2 with XPages
Real World Experience: Integrating DB2 with XPages
 
Scale your Magento app with Elastic Beanstalk
Scale your Magento app with Elastic BeanstalkScale your Magento app with Elastic Beanstalk
Scale your Magento app with Elastic Beanstalk
 
Devops course content
Devops course contentDevops course content
Devops course content
 
Scale your PHP application with Elastic Beanstalk - CloudParty Genova
Scale your PHP application with Elastic Beanstalk - CloudParty GenovaScale your PHP application with Elastic Beanstalk - CloudParty Genova
Scale your PHP application with Elastic Beanstalk - CloudParty Genova
 
DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
Eclipse summit-2010
Eclipse summit-2010Eclipse summit-2010
Eclipse summit-2010
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administrators
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
Webinar: DevOps - Redefining your IT Strategy
Webinar: DevOps - Redefining your IT StrategyWebinar: DevOps - Redefining your IT Strategy
Webinar: DevOps - Redefining your IT Strategy
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"
 
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
Introduction to DevOps Tools | DevOps Training | DevOps Tutorial for Beginner...
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 

Recently uploaded

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Recently uploaded (20)

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Using Doctrine Migrations to Synchronize Databases

Editor's Notes

  1. Present tool for synchronizing dbase Bryce – General overview / simple use case Patrick – Lessons learned in more complex scenario Goal – Drink the DM KoolAid
  2. My situation – 8 databases to keep in sync. IRBChoice and SIE are same core app running with different features in different environments.
  3. Tried making changes in SQL Developer while coding, then remembering 1) what changes I made and 2) to make those changes to other dbases Result: Inevitably something would crash because I forgot a change. Never sure if dbases in sync
  4. Now, I write SQL in a script file to modify dbase. I manually run script on Docker to upgrade dbase. When I push code to servers, deploy script runs migration code. I don’t have to remember my dbase changes, or worry that code is out of sync with dbase.
  5. With a name like “Doctrine Migrations” you may think you have to use Doctrine ORM. I’m using it on Zend Framework with Oracle DB. Patrick is using with Symfony & Doctrine also on Oracle. Can add to any project via Composer dependency
  6. Once DM is installed, these are steps for making changes to your dbase No more on-the-fly db changes in GUI. Keeping 8 dbases in sync requires discipline, and first step is scripting ALL changes.
  7. DM is configured with a directory where all migrations are stored. First step in migration is creating a new file. File is specially named with timestamp. Have to use this naming scheme. If desired, you can organize scripts in subfolders and DM will still find them all.
  8. ALL dbase modifications in script / SQL. No more GUI tweaks. “Generate” gave us this framework. All we do is fill out the ‘up’ and ‘down’ methods. Example: Add two columns to table. Each command is separate entry, but you can use PL/SQL code. Write “down” function to back out. This is important. If the “Up” crashes, it doesn’t crash gracefully. I test these – running ‘up’ and then ‘down’ and then ‘up’ in Docker until it works without failures.
  9. Can execute manually or make it part of deployment script. - Migrate before or after code changes? After. If code change fails, don’t have to run migration To roll back, select version to execute “down”.
  10. When a migration completes successfully, DM records the version ID in single-field table. On next migration, the versions listed in directory are compared with those in the table. If any missing, they are executed in order. Story: Running ‘migrate’ on loaded db that did not have initial setup migration marked. Tried to build from beginning.
  11. That’s the basics. Any questions on the fundamentals before Patrick talks about some of the challenges?
  12. If lots of ppl are running execute --down/--up in random orders, it can cause headaches The db connection used by symfony shouldn’t have access to alter schemas, so DM needs a separate connection
  13. This wrapper script detects the environment and loads the correct configuration file, so the user doesn’t have to worry about it (and can’t make a mistake!!!)
  14. Updating a table to use a sequence for the primary key column. Since the table has existing data, we need to query it and get the current number of rows so we know where to start the sequence.