SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Visuel Ă  insĂŠrer ici
EZ CONFERENCE 2016
PARIS
Managing Changes to the Database Across the
Project Life Cycle
WHO AM I
The short version
• « the guy who has written a lot of answers
on the eZPublish forums Âť
• Working at Kaliop in London since 2014
• Principal consultant at eZ Systems for 7 years
• Love coffee and bicycles ?
• @gggeek
VOTRE SCHEMA
WHAT THIS TALK IS ABOUT
The short version, too
Database vs. cms vs. the project
lifecycle
01
Project life cycle
• Development
• Testing
• Maintenance
Development phase
• Only one source of data: the “dev” db
• Size of data set is generally small
• Changes to content structure are frequent
• Developers need to share the database (mostly the structure)
Testing phase
• Two sources of data: the “dev” and “test” db
• Size of data set can be small or not
• Changes to content structure are less frequent
• Developers need to share the dev database
• Controlled releases of changes from dev to test
• The bulk of test “content” is not overwritten
Maintenance phase
• 3 (or more) sources of data: the “dev”, “test” and “prod” db
• Size of data set can be large
• Changes to content structure are infrequent
• Few developers need to share the dev database
• Controlled releases of changes
• Content might flow the opposite way than
changes to structure: “copy prod to test”
What we learned
• Different needs during different phases of the project
• Changes to Content and to Content-structure have different flows
What the CMS brings in
• Content structure can be modified via the GUI! 
• Many tables, with many relations
• No foreign keys 
(import scripts can break referential integrity)
• Some data is tied to files stored on disk 
(take care when doing backups!)
• Impossible to replicate / sync single tables 
Is it all for the better?
• Easy to deploy changes to Content Structure after go live
Unless the changes takes hours to apply
Will never cover 100% of the cases
• Hard to automate
• Hard to verify
Managing database changes
A. I connect to the Admin Interface
B. A solved problem
02
Keeping Databases in sync
Many possibilities:
A. All developers connect to the same db
B. Managing changes manually
C. The database is committed to git
D. Managing changes via scripts
E. Live DB replication (really ???)
F. More ?
A single, shared database
A
Connecting to a shared database
• good for teams which are *not* geographically distributed
• works when developers do not blow up the database with junk
content: needs some developer discipline
• works only up to the 1st deployment to TEST env;
then 2 dbs have to be managed anyway
Manual change control
B
Managing database changes manually
• Changes to be applied are documented and applied via GUI
• Most Unsafe Option (TM)
• Some tools to help you to keep mental sanity:
ggsysinfo
ezdbintegrity
ggsysinfo
https://github.com/gggeek/ggsysinfo
• Legacy Extension (no eZPlatform version yet)
• Allows to export in a format easy to diff:
Content Types definitions
Roles and Policies definitions
Workflows and Triggers
ggsysinfo
https://github.com/gggeek/ggsysinfo
ggsysinfo
https://github.com/gggeek/ggsysinfo
ggsysinfo
https://github.com/gggeek/ggsysinfo
ezdbintegrity
https://github.com/gggeek/ezdbintegrity
• Legacy Extension (no eZPlatform version yet)
• Allows to verify consistency of data in the database:
Foreign keys
Content fields
Orphaned storage files
Custom rules added by the end user
• No GUI
ezdbintegrity
https://github.com/gggeek/ezdbintegrity
ezdbintegrity
https://github.com/gggeek/ezdbintegrity
Database as source code
C
Committing the database to git
• good for when the development database does not contain a
huge number of contents and assets
• good for when the development database does not change too
frequently
• developers might be working on different versions
of the db: needs some developer discipline
• works only up to the 1st deployment to UAT env;
then 2 dbs have to be managed anyway
Committing the database to git
TIPS
• Database export/import scripts have to developed
• Good idea: remove temporary data before export
• Bad idea: hardcode database passwords in the scripts
• Good idea: read the db passwords from the ezpublish configuration
“Kaliop eZPublish 5 installer”
• Good idea: have the script manage binary contents & clear caches
ex: github.com/kaliop-uk/websummercamp2016/tree/master/site/bin
Automated change control
D
Managing database changes via script
• Safest option
• Good for when the development database does not change too
frequently
• Perfect after deployment to TEST/PROD
• kaliop/ezmigrationbundle
eZ Migration Bundle
https://github.com/kalipo-uk/ezmigrationbundle
• An eZPublish 5 bundle (no support for pure Legacy mode)
• Allows to define “migrations”
• Each migration is a set of changes to the DB – content or structure
• Migrations are stored as part of the application source code
• A console command is used to execute them
• A custom table in the db stored information on already executed ones
An example migration
https://github.com/kalipo-uk/ezmigrationbundle
What types of migrations are supported
https://github.com/kalipo-uk/ezmigrationbundle
• creation, update and deletion of Contents
• creation, update and deletion of Locations
• creation, update and deletion of Users
• creation, update and deletion of UserGroups
• creation, update and deletion of Roles
• creation, update and deletion of ContentTypes
• creation and deletion of Languages
• creation of Tags (from the Netgen Tags Bundle)
Cool features I
https://github.com/kalipo-uk/ezmigrationbundle
• Well documented (*)
• Stable: functional tests are run on Travis
• Future proof: based on the eZPublish Public API
* = opinions may vary
Cool features II
https://github.com/kalipo-uk/ezmigrationbundle
• Supports ids, identifiers and remote-ids to match elements
• Supports the concept of ‘references’ to anything which has just been
created/updated
• Update and delete operations can affect a whole set of elements in a
single pass
Cool features III
https://github.com/kalipo-uk/ezmigrationbundle
For more complex needs, two types of custom migrations:
• SQL files
• PHP classes with a simple Interface
Fully extensible using standard Symfony mechanisms
• Event listeners
• Tagged services
• Service definition takeover
Demo time
03
Going forward
04
Version 3 released today!
https://github.com/kalipo-uk/ezmigrationbundle
If the demo effect does not strike now…
Is your favourite feature missing?
https://github.com/kalipo-uk/ezmigrationbundle
The first brick is laid, many scenarios are possible
ex: allow a full ETL process / migrate across eZ installations
Feature requests and Bugs are managed on Github
Pull Requests are welcome
(thanks Lolautruche!)
THANK YOU
@gggeek
https://github.com/kaliop-uk
https://github.com/kaliop
http://www.kaliop.co.uk/info/ez.html

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
Version Control, Writers, and Workflows
Version Control, Writers, and WorkflowsVersion Control, Writers, and Workflows
Version Control, Writers, and Workflows
 
Using Grunt with Drupal
Using Grunt with DrupalUsing Grunt with Drupal
Using Grunt with Drupal
 
Collaborating on GitHub for Open Source Documentation
Collaborating on GitHub for Open Source DocumentationCollaborating on GitHub for Open Source Documentation
Collaborating on GitHub for Open Source Documentation
 
A Personal Journey
A Personal JourneyA Personal Journey
A Personal Journey
 
Azure Functions
Azure FunctionsAzure Functions
Azure Functions
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
 
Managing Descriptive Metadata with Open XML...For Now
Managing Descriptive Metadata with Open XML...For NowManaging Descriptive Metadata with Open XML...For Now
Managing Descriptive Metadata with Open XML...For Now
 
Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message Brokers
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
 
Engage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesEngage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPages
 
Releasing High Quality Packages - Longhorn PHP 2021
Releasing High Quality Packages - Longhorn PHP 2021Releasing High Quality Packages - Longhorn PHP 2021
Releasing High Quality Packages - Longhorn PHP 2021
 
CI is dead, long live CI
CI is dead, long live CICI is dead, long live CI
CI is dead, long live CI
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Provisioning environments. A simplistic approach
Provisioning  environments. A simplistic approachProvisioning  environments. A simplistic approach
Provisioning environments. A simplistic approach
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anyways
 
Build social apps for Facebook
Build social apps for FacebookBuild social apps for Facebook
Build social apps for Facebook
 

Ähnlich wie Managing Changes to the Database Across the Project Life Cycle (presented by Gaetano Giunta, CTO, Kaliop at eZ Conference 2016)

Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
Strannik_2013
 

Ähnlich wie Managing Changes to the Database Across the Project Life Cycle (presented by Gaetano Giunta, CTO, Kaliop at eZ Conference 2016) (20)

Que nos espera a los ALM Dudes para el 2013?
Que nos espera a los ALM Dudes para el 2013?Que nos espera a los ALM Dudes para el 2013?
Que nos espera a los ALM Dudes para el 2013?
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 
WebDev Crash Course
WebDev Crash CourseWebDev Crash Course
WebDev Crash Course
 
Git SVN Migrate Reasons
Git SVN Migrate ReasonsGit SVN Migrate Reasons
Git SVN Migrate Reasons
 
Git Going w/ Git
Git Going w/ GitGit Going w/ Git
Git Going w/ Git
 
Starting from scratch in 2017
Starting from scratch in 2017Starting from scratch in 2017
Starting from scratch in 2017
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit EuropeAutomation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
 
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
DevOpsGuys - DevOps Automation - The Good, The Bad and The UglyDevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
 
Docs as Part of the Product - Open Source Summit North America 2018
Docs as Part of the Product - Open Source Summit North America 2018Docs as Part of the Product - Open Source Summit North America 2018
Docs as Part of the Product - Open Source Summit North America 2018
 
SQL Server DevOps Jumpstart
SQL Server DevOps JumpstartSQL Server DevOps Jumpstart
SQL Server DevOps Jumpstart
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development Management
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
Achieving Full Stack DevOps at Colonial Life
Achieving Full Stack DevOps at Colonial Life Achieving Full Stack DevOps at Colonial Life
Achieving Full Stack DevOps at Colonial Life
 
OUG Ireland Meet-up 12th January
OUG Ireland Meet-up 12th JanuaryOUG Ireland Meet-up 12th January
OUG Ireland Meet-up 12th January
 
Building gRPC services
Building gRPC servicesBuilding gRPC services
Building gRPC services
 
Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
 

Mehr von eZ Systems

Mehr von eZ Systems (20)

A unified platform to build Digital Experience from Content to Commerce to Pe...
A unified platform to build Digital Experience from Content to Commerce to Pe...A unified platform to build Digital Experience from Content to Commerce to Pe...
A unified platform to build Digital Experience from Content to Commerce to Pe...
 
"Reconociendo al cliente personalizando su experiencia" - Andorra Turisme - e...
"Reconociendo al cliente personalizando su experiencia" - Andorra Turisme - e..."Reconociendo al cliente personalizando su experiencia" - Andorra Turisme - e...
"Reconociendo al cliente personalizando su experiencia" - Andorra Turisme - e...
 
"How CrĂŠdit Agricole and IT-CE managed their digital transformation thanks to...
"How CrĂŠdit Agricole and IT-CE managed their digital transformation thanks to..."How CrĂŠdit Agricole and IT-CE managed their digital transformation thanks to...
"How CrĂŠdit Agricole and IT-CE managed their digital transformation thanks to...
 
The rise of Digital Experience Platforms
The rise of Digital Experience PlatformsThe rise of Digital Experience Platforms
The rise of Digital Experience Platforms
 
"How to deliver remarkable digital experiences to customers?"
"How to deliver remarkable digital experiences to customers?""How to deliver remarkable digital experiences to customers?"
"How to deliver remarkable digital experiences to customers?"
 
Keynote eZ Roadshow & Diginight 2019 - oslo
Keynote eZ Roadshow & Diginight 2019 - osloKeynote eZ Roadshow & Diginight 2019 - oslo
Keynote eZ Roadshow & Diginight 2019 - oslo
 
Symfony 4.0 + - Track Technique eZ Roadshow 2019 - PARIS
Symfony 4.0 + - Track Technique eZ Roadshow 2019 - PARISSymfony 4.0 + - Track Technique eZ Roadshow 2019 - PARIS
Symfony 4.0 + - Track Technique eZ Roadshow 2019 - PARIS
 
Brochure eZ Platform DXP
Brochure eZ Platform DXPBrochure eZ Platform DXP
Brochure eZ Platform DXP
 
[Webinar] Discover eZ platform v2.4
[Webinar]  Discover eZ platform v2.4[Webinar]  Discover eZ platform v2.4
[Webinar] Discover eZ platform v2.4
 
Community webinar discover e z platform v2.3 (9.10.2018)
Community webinar   discover e z platform v2.3 (9.10.2018)Community webinar   discover e z platform v2.3 (9.10.2018)
Community webinar discover e z platform v2.3 (9.10.2018)
 
Symfony Under the Hood
Symfony Under the HoodSymfony Under the Hood
Symfony Under the Hood
 
eZ in the Year Ahead
eZ in the Year AheadeZ in the Year Ahead
eZ in the Year Ahead
 
Personalization on eZ Platform v2
Personalization on eZ Platform v2Personalization on eZ Platform v2
Personalization on eZ Platform v2
 
Choose the eZ Universe for Your Web Galaxy
Choose the eZ Universe for Your Web GalaxyChoose the eZ Universe for Your Web Galaxy
Choose the eZ Universe for Your Web Galaxy
 
Using eZ Platform in an API Era
Using eZ Platform in an API EraUsing eZ Platform in an API Era
Using eZ Platform in an API Era
 
Extending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and ReactExtending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and React
 
A Roadmap to Becoming Your Customer’s Information Hub
A Roadmap to Becoming Your Customer’s Information HubA Roadmap to Becoming Your Customer’s Information Hub
A Roadmap to Becoming Your Customer’s Information Hub
 
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
eZ Platform Cloud and eZ Launchpad: Don’t Host, Don’t Deploy, Don’t Install—J...
 
GDPR in the Digital World
GDPR in the Digital WorldGDPR in the Digital World
GDPR in the Digital World
 
When content transforms your customer experience
When content transforms your customer experienceWhen content transforms your customer experience
When content transforms your customer experience
 

KĂźrzlich hochgeladen

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

KĂźrzlich hochgeladen (20)

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
 
+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...
 
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...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Managing Changes to the Database Across the Project Life Cycle (presented by Gaetano Giunta, CTO, Kaliop at eZ Conference 2016)

  • 1. Visuel Ă  insĂŠrer ici EZ CONFERENCE 2016 PARIS Managing Changes to the Database Across the Project Life Cycle
  • 2. WHO AM I The short version • ÂŤ the guy who has written a lot of answers on the eZPublish forums Âť • Working at Kaliop in London since 2014 • Principal consultant at eZ Systems for 7 years • Love coffee and bicycles ? • @gggeek VOTRE SCHEMA
  • 3. WHAT THIS TALK IS ABOUT The short version, too
  • 4. Database vs. cms vs. the project lifecycle 01
  • 5. Project life cycle • Development • Testing • Maintenance
  • 6. Development phase • Only one source of data: the “dev” db • Size of data set is generally small • Changes to content structure are frequent • Developers need to share the database (mostly the structure)
  • 7. Testing phase • Two sources of data: the “dev” and “test” db • Size of data set can be small or not • Changes to content structure are less frequent • Developers need to share the dev database • Controlled releases of changes from dev to test • The bulk of test “content” is not overwritten
  • 8. Maintenance phase • 3 (or more) sources of data: the “dev”, “test” and “prod” db • Size of data set can be large • Changes to content structure are infrequent • Few developers need to share the dev database • Controlled releases of changes • Content might flow the opposite way than changes to structure: “copy prod to test”
  • 9. What we learned • Different needs during different phases of the project • Changes to Content and to Content-structure have different flows
  • 10. What the CMS brings in • Content structure can be modified via the GUI!  • Many tables, with many relations • No foreign keys  (import scripts can break referential integrity) • Some data is tied to files stored on disk  (take care when doing backups!) • Impossible to replicate / sync single tables 
  • 11. Is it all for the better? • Easy to deploy changes to Content Structure after go live Unless the changes takes hours to apply Will never cover 100% of the cases • Hard to automate • Hard to verify
  • 12. Managing database changes A. I connect to the Admin Interface B. A solved problem 02
  • 13. Keeping Databases in sync Many possibilities: A. All developers connect to the same db B. Managing changes manually C. The database is committed to git D. Managing changes via scripts E. Live DB replication (really ???) F. More ?
  • 14. A single, shared database A
  • 15. Connecting to a shared database • good for teams which are *not* geographically distributed • works when developers do not blow up the database with junk content: needs some developer discipline • works only up to the 1st deployment to TEST env; then 2 dbs have to be managed anyway
  • 17. Managing database changes manually • Changes to be applied are documented and applied via GUI • Most Unsafe Option (TM) • Some tools to help you to keep mental sanity: ggsysinfo ezdbintegrity
  • 18. ggsysinfo https://github.com/gggeek/ggsysinfo • Legacy Extension (no eZPlatform version yet) • Allows to export in a format easy to diff: Content Types definitions Roles and Policies definitions Workflows and Triggers
  • 22. ezdbintegrity https://github.com/gggeek/ezdbintegrity • Legacy Extension (no eZPlatform version yet) • Allows to verify consistency of data in the database: Foreign keys Content fields Orphaned storage files Custom rules added by the end user • No GUI
  • 26. Committing the database to git • good for when the development database does not contain a huge number of contents and assets • good for when the development database does not change too frequently • developers might be working on different versions of the db: needs some developer discipline • works only up to the 1st deployment to UAT env; then 2 dbs have to be managed anyway
  • 27. Committing the database to git TIPS • Database export/import scripts have to developed • Good idea: remove temporary data before export • Bad idea: hardcode database passwords in the scripts • Good idea: read the db passwords from the ezpublish configuration “Kaliop eZPublish 5 installer” • Good idea: have the script manage binary contents & clear caches ex: github.com/kaliop-uk/websummercamp2016/tree/master/site/bin
  • 29. Managing database changes via script • Safest option • Good for when the development database does not change too frequently • Perfect after deployment to TEST/PROD • kaliop/ezmigrationbundle
  • 30. eZ Migration Bundle https://github.com/kalipo-uk/ezmigrationbundle • An eZPublish 5 bundle (no support for pure Legacy mode) • Allows to define “migrations” • Each migration is a set of changes to the DB – content or structure • Migrations are stored as part of the application source code • A console command is used to execute them • A custom table in the db stored information on already executed ones
  • 32. What types of migrations are supported https://github.com/kalipo-uk/ezmigrationbundle • creation, update and deletion of Contents • creation, update and deletion of Locations • creation, update and deletion of Users • creation, update and deletion of UserGroups • creation, update and deletion of Roles • creation, update and deletion of ContentTypes • creation and deletion of Languages • creation of Tags (from the Netgen Tags Bundle)
  • 33. Cool features I https://github.com/kalipo-uk/ezmigrationbundle • Well documented (*) • Stable: functional tests are run on Travis • Future proof: based on the eZPublish Public API * = opinions may vary
  • 34. Cool features II https://github.com/kalipo-uk/ezmigrationbundle • Supports ids, identifiers and remote-ids to match elements • Supports the concept of ‘references’ to anything which has just been created/updated • Update and delete operations can affect a whole set of elements in a single pass
  • 35. Cool features III https://github.com/kalipo-uk/ezmigrationbundle For more complex needs, two types of custom migrations: • SQL files • PHP classes with a simple Interface Fully extensible using standard Symfony mechanisms • Event listeners • Tagged services • Service definition takeover
  • 38. Version 3 released today! https://github.com/kalipo-uk/ezmigrationbundle If the demo effect does not strike now…
  • 39. Is your favourite feature missing? https://github.com/kalipo-uk/ezmigrationbundle The first brick is laid, many scenarios are possible ex: allow a full ETL process / migrate across eZ installations Feature requests and Bugs are managed on Github Pull Requests are welcome (thanks Lolautruche!)