SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
KEEPING YOUR DATABASE AND PHP IN SYNC

MAGGIE NELSON
MAY 22, 2008
dev   prod
dev   prod
dev   qa   prod
dev   qa   staging   prod
dev1
 (new stuff)




   dev2             qa1         staging   prod
  (new stuff)    (new stuff)




   dev3             qa2
(maintenance)   (maintenance)
new stuff




                                 trunk




maintenance   1.0         2.0   3.0
PHP and DB are separate
=         +

    PHP




=         +

    PHP
releaseNumber.sql
release 2.0


                                  +

                     PHP




cut 2.0 release at         run release.2.0.sql
                                                 install 2.0 code
svn revision 207               in database
reverting release 2.0


                              +

                    PHP




     revert to previous
                                      ???
  version of code (prior to
                                  in database
      svn revision 207)
new stuff




     r203             r207                   r415
                                                     trunk

   1-203      204-207              208-415




maintenance     1.0          2.0                    3.0
releaseNumber.undo.sql
reverting release 2.0


                              +

                    PHP




     revert to previous
                                  run release.2.0.undo.sql
                                       ???
  version of code (prior to
                                   in database
                                         in database
      svn revision 207)
Frequent database changes during
release cycle
Frequent changes from dev -> QA




        dev             qa             staging          prod

                                                 run statements from
  update QA with     figure out last update
                                                 release.2.0.0.sql since
freshest PHP code   ran from release.2.0.sql
                                                    last DB updates
releaseNumber.sql
releaseNumber.sql
Communication between developers
dev1
 (new stuff)




   dev2             qa1         staging   prod
  (new stuff)    (new stuff)




   dev3             qa2
(maintenance)   (maintenance)
devs making DB changes




                     dev1                dev2


                                                run statements from
 update devX with    figure out last update
                                                release.2.0.0.sql since
freshest PHP code   ran from release.2.0.sql
                                                   last DB updates
dev1 writes new code



                       database   YES   dev1 sends e-mail to dev2 with
dev1 commits code
                       changes?         instructions for the DB change


                           NO
                                                    dev2         NO
 dev2: svn up to get
                                                   checks                    dev2: svn up
     new code
                                                   email?

                                                         YES
                                                  dev2 reads
                                                 instructions



                                                      dev2
   dev2 has new          YES                         follows     NO      dev2 environment is
                                                  instructions
       code                                        correctly?                  broken


                                                                             EPIC FAIL
releaseNumber.sql
DB deltas
DB deltas as XML
dev1 writes new code




     database      YES    encapsulate DB
     changes?            change in a delta



           NO

 dev1 commits code




 dev2: svn up to get     run script to check for    new      YES run script to parse and
     new code                  new deltas          deltas?           apply new deltas



                                                       NO
   dev2 has new
       code
Stored procedures
Calling stored procedures from PHP
Oracle example - pkg header
Oracle example - pkg body
friend_pkg
                 db/Friend/pkg.sql
 (header)


friend_pkg
              db/Friend/pkg_body.sql
   (body)




  models      models/FriendModel.php



  views        views/addFriend.phtml



                    controllers/
controllers
               FriendController.php
Stored procedures in deltas
Reference, don’t copy
svn cat -r[some_revision] Friend/pkg.sql >> runThis.sql
svn cat -r[some_revision] Friend/pkg_body.sql >> runThis.sql




                                [some_revision] ??
encapsulate DB changes (DDL + DML) in a delta
               (e.g. delta7.xml)



             make stored procedure changes




          reference stored procedure changes in the delta




                              make PHP changes



                          commit PHP changes, stored procedure
                             changes and the new delta7.xml
svn log -r PREV:HEAD delta7.sql

------------------------------------------------------------------------
r107 | maggie_n | 2008-02-25 15:13:50 -0500 (Mon, 25 Feb 2008) | 15 lines
svn log -r PREV:HEAD delta7.sql --xml


<?xml version=quot;1.0quot;?>
<log>
<logentry
  revision=quot;107quot;>
<author>maggie_n</author>
<date>2008-02-25T20:13:50.097229Z</date>
<msg>My awesome delta number 7.</msg></logentry>
</log>


$deltaSvnRevision = $myXml->logentry[0][‘revision’];
Automagically...
Communication between development
branches
dev1
 (new stuff)




   dev2             qa1         staging   prod
  (new stuff)    (new stuff)




   dev3             qa2
(maintenance)   (maintenance)
new stuff




                                                trunk




maintenance   1.0         2.0                  3.0

                                svn:external    deltas
svn:externals


http://svn.example.com/svn/myapp/
   trunk
   branch/
      new_stuff/
      1.0/
      2.0/
      3.0/
   deltas/
create new deltas directory parallel to trunk and
                    branches



            in trunk or branch you’re working in:
                 svn propedit svn:externals .



                       edit file that opens, add:
             deltas http://svn.example.com/myapp/deltas



                                   save and exit



                                            svn up
                                          svn commit
new stuff




                                                         trunk




maintenance   1.0              2.0                      3.0

                                         svn:external    deltas

                          deltas 1-...
central file to associate delta 2 branch/trunk

trunk:                  branches/1.0
  - delta1               - delta1
  - delta2
                        branches/2.0
branches/new_stuff       - delta1
 - delta3                - delta2
 - delta4
                        branches/3.0
                         - delta1
                         - delta2
                         - delta3
                         - delta4
new stuff




                                 trunk




maintenance   1.0         2.0   3.0
Summary




  PHP   +   DB   +   XML   +   svn   =   awesome!
Questions?
Thanks!




             more info:
          maggienelson.com

Weitere ähnliche Inhalte

Was ist angesagt?

Linux or unix interview questions
Linux or unix interview questionsLinux or unix interview questions
Linux or unix interview questionsTeja Bheemanapally
 
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Anne Nicolas
 
Cassandra Internals Overview
Cassandra Internals OverviewCassandra Internals Overview
Cassandra Internals Overviewbeobal
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchelldpc
 
Redhat 6 & 7
Redhat 6 & 7Redhat 6 & 7
Redhat 6 & 7r9social
 
Comandos linux bash, f2 linux pesquisa, http://f2linux.wordpress.com
Comandos linux bash,  f2 linux pesquisa, http://f2linux.wordpress.comComandos linux bash,  f2 linux pesquisa, http://f2linux.wordpress.com
Comandos linux bash, f2 linux pesquisa, http://f2linux.wordpress.comWlademir RS
 
Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )varasteh65
 
Fluentd meetup logging infrastructure in paa s
Fluentd meetup   logging infrastructure in paa sFluentd meetup   logging infrastructure in paa s
Fluentd meetup logging infrastructure in paa sRakuten Group, Inc.
 

Was ist angesagt? (13)

Linux or unix interview questions
Linux or unix interview questionsLinux or unix interview questions
Linux or unix interview questions
 
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
Kernel Recipes 2019 - Analyzing changes to the binary interface exposed by th...
 
Cassandra Internals Overview
Cassandra Internals OverviewCassandra Internals Overview
Cassandra Internals Overview
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchell
 
Redhat 6 & 7
Redhat 6 & 7Redhat 6 & 7
Redhat 6 & 7
 
Cloning 2
Cloning 2Cloning 2
Cloning 2
 
Comandos linux bash, f2 linux pesquisa, http://f2linux.wordpress.com
Comandos linux bash,  f2 linux pesquisa, http://f2linux.wordpress.comComandos linux bash,  f2 linux pesquisa, http://f2linux.wordpress.com
Comandos linux bash, f2 linux pesquisa, http://f2linux.wordpress.com
 
Presentation
PresentationPresentation
Presentation
 
Rac questions
Rac questionsRac questions
Rac questions
 
Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )
 
Genode Programming
Genode ProgrammingGenode Programming
Genode Programming
 
Fluentd meetup logging infrastructure in paa s
Fluentd meetup   logging infrastructure in paa sFluentd meetup   logging infrastructure in paa s
Fluentd meetup logging infrastructure in paa s
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
 

Ähnlich wie Keeping Your Database and PHP in Sync

Subversion: A Getting Started Presentation
Subversion: A Getting Started PresentationSubversion: A Getting Started Presentation
Subversion: A Getting Started PresentationNap Ramirez
 
Alm tce parallel development
Alm tce parallel developmentAlm tce parallel development
Alm tce parallel developmentshalom938
 
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for JavaFlyway: The agile database migration framework for Java
Flyway: The agile database migration framework for JavaAxel Fontaine
 
Flyway (33rd Degree)
Flyway (33rd Degree)Flyway (33rd Degree)
Flyway (33rd Degree)Axel Fontaine
 
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.tdc-globalcode
 
Version Control with SVN
Version Control with SVNVersion Control with SVN
Version Control with SVNPHPBelgium
 
Kubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfKubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfAuliaFebrian2
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationSQABD
 
DockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times NewsroomDockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times NewsroomDocker, Inc.
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best PracticesMaidul Islam
 
Getting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGetting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGirish Bapat
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Alan Pinstein
 
Architecting the Future: Abstractions and Metadata - KCDC
Architecting the Future: Abstractions and Metadata - KCDCArchitecting the Future: Abstractions and Metadata - KCDC
Architecting the Future: Abstractions and Metadata - KCDCDaniel Barker
 

Ähnlich wie Keeping Your Database and PHP in Sync (20)

Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
 
Subversion
SubversionSubversion
Subversion
 
Subversion: A Getting Started Presentation
Subversion: A Getting Started PresentationSubversion: A Getting Started Presentation
Subversion: A Getting Started Presentation
 
Alm tce parallel development
Alm tce parallel developmentAlm tce parallel development
Alm tce parallel development
 
Flyway: The agile database migration framework for Java
Flyway: The agile database migration framework for JavaFlyway: The agile database migration framework for Java
Flyway: The agile database migration framework for Java
 
Flyway (33rd Degree)
Flyway (33rd Degree)Flyway (33rd Degree)
Flyway (33rd Degree)
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
TDC2018FLN | Trilha Containers - Kubernetes para usuarios Docker.
 
Version Control with SVN
Version Control with SVNVersion Control with SVN
Version Control with SVN
 
Kubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfKubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdf
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change Automation
 
Nodejs Session01
Nodejs Session01Nodejs Session01
Nodejs Session01
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
 
DockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times NewsroomDockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times Newsroom
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
Getting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGetting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydb
 
SVN Information
SVN Information  SVN Information
SVN Information
 
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
Patterns and Tools for Database Versioning, Migration, Data Loading and Test ...
 
Architecting the Future: Abstractions and Metadata - KCDC
Architecting the Future: Abstractions and Metadata - KCDCArchitecting the Future: Abstractions and Metadata - KCDC
Architecting the Future: Abstractions and Metadata - KCDC
 

Kürzlich hochgeladen

Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Kürzlich hochgeladen (20)

Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Keeping Your Database and PHP in Sync

  • 1. KEEPING YOUR DATABASE AND PHP IN SYNC MAGGIE NELSON MAY 22, 2008
  • 2. dev prod
  • 3. dev prod
  • 4. dev qa prod
  • 5. dev qa staging prod
  • 6. dev1 (new stuff) dev2 qa1 staging prod (new stuff) (new stuff) dev3 qa2 (maintenance) (maintenance)
  • 7. new stuff trunk maintenance 1.0 2.0 3.0
  • 8. PHP and DB are separate
  • 9. = + PHP = + PHP
  • 11. release 2.0 + PHP cut 2.0 release at run release.2.0.sql install 2.0 code svn revision 207 in database
  • 12. reverting release 2.0 + PHP revert to previous ??? version of code (prior to in database svn revision 207)
  • 13. new stuff r203 r207 r415 trunk 1-203 204-207 208-415 maintenance 1.0 2.0 3.0
  • 15. reverting release 2.0 + PHP revert to previous run release.2.0.undo.sql ??? version of code (prior to in database in database svn revision 207)
  • 16. Frequent database changes during release cycle
  • 17. Frequent changes from dev -> QA dev qa staging prod run statements from update QA with figure out last update release.2.0.0.sql since freshest PHP code ran from release.2.0.sql last DB updates
  • 21. dev1 (new stuff) dev2 qa1 staging prod (new stuff) (new stuff) dev3 qa2 (maintenance) (maintenance)
  • 22. devs making DB changes dev1 dev2 run statements from update devX with figure out last update release.2.0.0.sql since freshest PHP code ran from release.2.0.sql last DB updates
  • 23. dev1 writes new code database YES dev1 sends e-mail to dev2 with dev1 commits code changes? instructions for the DB change NO dev2 NO dev2: svn up to get checks dev2: svn up new code email? YES dev2 reads instructions dev2 dev2 has new YES follows NO dev2 environment is instructions code correctly? broken EPIC FAIL
  • 27. dev1 writes new code database YES encapsulate DB changes? change in a delta NO dev1 commits code dev2: svn up to get run script to check for new YES run script to parse and new code new deltas deltas? apply new deltas NO dev2 has new code
  • 30. Oracle example - pkg header
  • 31. Oracle example - pkg body
  • 32. friend_pkg db/Friend/pkg.sql (header) friend_pkg db/Friend/pkg_body.sql (body) models models/FriendModel.php views views/addFriend.phtml controllers/ controllers FriendController.php
  • 35. svn cat -r[some_revision] Friend/pkg.sql >> runThis.sql svn cat -r[some_revision] Friend/pkg_body.sql >> runThis.sql [some_revision] ??
  • 36. encapsulate DB changes (DDL + DML) in a delta (e.g. delta7.xml) make stored procedure changes reference stored procedure changes in the delta make PHP changes commit PHP changes, stored procedure changes and the new delta7.xml
  • 37. svn log -r PREV:HEAD delta7.sql ------------------------------------------------------------------------ r107 | maggie_n | 2008-02-25 15:13:50 -0500 (Mon, 25 Feb 2008) | 15 lines
  • 38. svn log -r PREV:HEAD delta7.sql --xml <?xml version=quot;1.0quot;?> <log> <logentry revision=quot;107quot;> <author>maggie_n</author> <date>2008-02-25T20:13:50.097229Z</date> <msg>My awesome delta number 7.</msg></logentry> </log> $deltaSvnRevision = $myXml->logentry[0][‘revision’];
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 46. dev1 (new stuff) dev2 qa1 staging prod (new stuff) (new stuff) dev3 qa2 (maintenance) (maintenance)
  • 47. new stuff trunk maintenance 1.0 2.0 3.0 svn:external deltas
  • 48. svn:externals http://svn.example.com/svn/myapp/ trunk branch/ new_stuff/ 1.0/ 2.0/ 3.0/ deltas/
  • 49. create new deltas directory parallel to trunk and branches in trunk or branch you’re working in: svn propedit svn:externals . edit file that opens, add: deltas http://svn.example.com/myapp/deltas save and exit svn up svn commit
  • 50. new stuff trunk maintenance 1.0 2.0 3.0 svn:external deltas deltas 1-...
  • 51. central file to associate delta 2 branch/trunk trunk: branches/1.0 - delta1 - delta1 - delta2 branches/2.0 branches/new_stuff - delta1 - delta3 - delta2 - delta4 branches/3.0 - delta1 - delta2 - delta3 - delta4
  • 52. new stuff trunk maintenance 1.0 2.0 3.0
  • 53. Summary PHP + DB + XML + svn = awesome!
  • 55. Thanks! more info: maggienelson.com