SlideShare a Scribd company logo
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

More Related Content

What's hot

Linux or unix interview questions
Linux or unix interview questionsLinux or unix interview questions
Linux or unix interview questions
Teja 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 Overview
beobal
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchell
dpc
 
Redhat 6 & 7
Redhat 6 & 7Redhat 6 & 7
Redhat 6 & 7
r9social
 
Cloning 2
Cloning 2Cloning 2
Cloning 2
Deepti Singh
 
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
Wlademir RS
 
Presentation
PresentationPresentation
Presentation
kiarash1361
 
Rac questions
Rac questionsRac questions
Rac questions
parvezsigan
 
Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )Oracle Real Application Cluster ( RAC )
Oracle Real Application Cluster ( RAC )
varasteh65
 
Genode Programming
Genode ProgrammingGenode Programming
Genode Programming
Vasily Sartakov
 
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
Rakuten Group, Inc.
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
Kumaraswamy M
 

What's hot (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
 

Similar to Keeping Your Database and PHP in Sync

Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
Marco Pivetta
 
Subversion
SubversionSubversion
Subversion: A Getting Started Presentation
Subversion: A Getting Started PresentationSubversion: A Getting Started Presentation
Subversion: A Getting Started Presentation
Nap Ramirez
 
Alm tce parallel development
Alm tce parallel developmentAlm tce parallel development
Alm tce parallel development
shalom938
 
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
Axel Fontaine
 
Flyway (33rd Degree)
Flyway (33rd Degree)Flyway (33rd Degree)
Flyway (33rd Degree)
Axel Fontaine
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
Red Hat Developers
 
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 SVN
PHPBelgium
 
Kubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdfKubernetes_Webinar_Slide_Deck.pdf
Kubernetes_Webinar_Slide_Deck.pdf
AuliaFebrian2
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
Mike Willbanks
 
Tauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change AutomationTauhid: SQL Server Database Change Automation
Tauhid: SQL Server Database Change Automation
SQABD
 
Nodejs Session01
Nodejs Session01Nodejs Session01
Nodejs Session01
Jainul Musani
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
oscon2007
 
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
Docker, Inc.
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
Maidul 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 flywaydb
Girish Bapat
 
SVN Information
SVN Information  SVN Information
SVN Information
RAHUL TRIPATHI
 
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 - KCDC
Daniel Barker
 

Similar to 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
 

Recently uploaded

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 

Recently uploaded (20)

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 

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