SlideShare a Scribd company logo
1 of 43
© 2019 Magento, Inc. Page | 1
Magento 2.3
Schema and Data
Patches
© 2019 Magento, Inc.
.
Page | 2
Technical Architect at BORN Group
Atish Goswami
© 2019 Magento, Inc. Page | 3
Agenda
© 2019 Magento, Inc. Page | 4
Agenda
• Schema Patches
• Data Patches
• Version Patches
• Revertible Patches
• New CLI Commands
© 2019 Magento, Inc. Page | 5
What is Schema Patch?
© 2019 Magento, Inc. Page | 6
Schema Patches
• A class that contains custom schema modification instructions
• Schema patches are used along with declarative schema
• Schema patches allow complex operations
– Adding triggers, stored procedures, functions
– Performing data migration with inside DDL operations
– Renaming tables, columns, and other entities
– Adding partitions and options to a table
© 2019 Magento, Inc. Page | 7
Where do we define this
file ?
© 2019 Magento, Inc. Page | 8
<module_root>/Setup/Patch/Schema/<Patch_Name>.php
© 2019 Magento, Inc. Page | 9
MagentoFrameworkSetupPatchSchemaPatchInterface
© 2019 Magento, Inc. Page | 10
Methods we will implement
© 2019 Magento, Inc. Page | 11
MagentoFrameworkSetupPatchPatchInterface::getAliases()
• Patch class names can change over time
• But changing name should not affect installation process
• If we will change name of the patch we will add alias here
• This method returns an array
© 2019 Magento, Inc. Page | 12
MagentoFrameworkSetupPatchPatchInterface::getAliases()
© 2019 Magento, Inc. Page | 13
MagentoFrameworkSetupPatchPatchInterface::apply()
• The code to apply the patch is written inside here
• One patch is responsible only for one setup version
© 2019 Magento, Inc. Page | 14
MagentoFrameworkSetupPatchPatchInterface::apply()
© 2019 Magento, Inc. Page | 15
MagentoFrameworkSetupPatchDependentPatchInterface::getDependencies()
• Patches can be dependent on other patches
• Other patches needs to be applied before your patch is applied
• One patch can have can have many dependences
• If the patch is dependent on some other modules patch use
sequencing in your module.xml
• It is recommended to declare dependencies of patches present in
the same module
© 2019 Magento, Inc. Page | 16
MagentoFrameworkSetupPatchDependentPatchInterface::getDependencies()
© 2019 Magento, Inc. Page | 17
Applying the Schema
Patch
© 2019 Magento, Inc. Page | 18
Applying the Schema Patch
© 2019 Magento, Inc. Page | 19
What happened behind
the scenes
© 2019 Magento, Inc. Page | 20
What happens behind the scenes
• Magento runs the schema patch
• If it is successfully executed the class name is stored in the patch_list
table
• Next time when the setup upgrade runs it refers the patch_list table
and if the patch class if already applied it is not executed again
© 2019 Magento, Inc. Page | 21
Patch List Storage
© 2019 Magento, Inc. Page | 22
What is Data Patch?
© 2019 Magento, Inc. Page | 23
Data Patches
• A class that contains data modification instructions
• Majorly will be used to create tables records, EAV attributes
© 2019 Magento, Inc. Page | 24
Where do we define this
file ?
© 2019 Magento, Inc. Page | 25
<module_root>/Setup/Patch/Data/<Patch_Name>.php
© 2019 Magento, Inc. Page | 26
MagentoFrameworkSetupPatchDataPatchInterface
© 2019 Magento, Inc. Page | 27
Methods we will implement
© 2019 Magento, Inc. Page | 28
MagentoFrameworkSetupPatchPatchInterface::apply()
© 2019 Magento, Inc. Page | 29
What is Version Patch?
© 2019 Magento, Inc. Page | 30
Versions Patches
• It is used for backwards compatibility with older setup scripts
• A version number can be defined
• Magento checks if setup module version
• If the version of the module is higher than the version specified in
your patch, then the patch is skipped
• If the version in the database is equal or lower, then the patch
installs.
• It is marked as deprecated
© 2019 Magento, Inc. Page | 31
How to convert a
schema/patch into a
version patch ?
© 2019 Magento, Inc. Page | 32
MagentoFrameworkSetupPatchPatchVersionInterface
© 2019 Magento, Inc. Page | 33
What is Revertable
Patch?
© 2019 Magento, Inc. Page | 34
Revertable Patches
• Patches can be reverted at the time of removing the module
• Single patches cannot be reverted
• Module uninstall needed to be triggered
• This feature is still buggy and changes are happening
© 2019 Magento, Inc. Page | 35
How to convert a
schema/patch into a
revertable patch ?
© 2019 Magento, Inc. Page | 36
MagentoFrameworkSetupPatchPatchRevertableInterface
© 2019 Magento, Inc. Page | 37
How to uninstall a
module ?
© 2019 Magento, Inc. Page | 38
Uninstall a composer module
Uninstall a non-composer module
© 2019 Magento, Inc. Page | 39
New CLI Command
© 2019 Magento, Inc. Page | 40
Generating Patches
© 2019 Magento, Inc. Page | 41
Generating Patches
© 2019 Magento, Inc. Page | 42
Questions ?
© 2019 Magento, Inc. Page | 43
Thank You

More Related Content

What's hot

IBM Cloud Object Storage 오브젝트 스토리지
IBM Cloud Object Storage 오브젝트 스토리지IBM Cloud Object Storage 오브젝트 스토리지
IBM Cloud Object Storage 오브젝트 스토리지오윤 권
 
Tiki.vn - How we scale as a tech startup
Tiki.vn - How we scale as a tech startupTiki.vn - How we scale as a tech startup
Tiki.vn - How we scale as a tech startupTung Ns
 
엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈
엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈
엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈Amazon Web Services Korea
 
Intro To Alfresco Part 1
Intro To Alfresco Part 1Intro To Alfresco Part 1
Intro To Alfresco Part 1Jeff Potts
 
Single Sign-On for APEX applications based on Kerberos (Important: latest ver...
Single Sign-On for APEX applications based on Kerberos (Important: latest ver...Single Sign-On for APEX applications based on Kerberos (Important: latest ver...
Single Sign-On for APEX applications based on Kerberos (Important: latest ver...Niels de Bruijn
 
Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...
Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...
Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...HostedbyConfluent
 
Cloud Composer workshop at Airflow Summit 2023.pdf
Cloud Composer workshop at Airflow Summit 2023.pdfCloud Composer workshop at Airflow Summit 2023.pdf
Cloud Composer workshop at Airflow Summit 2023.pdfLeah Cole
 
SSO With APEX and ADFS the weblogic way
SSO With APEX and ADFS the weblogic waySSO With APEX and ADFS the weblogic way
SSO With APEX and ADFS the weblogic waymakker_nl
 
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기Amazon Web Services Korea
 
Azure Data Studio Extension Development
Azure Data Studio Extension DevelopmentAzure Data Studio Extension Development
Azure Data Studio Extension DevelopmentDrew Skwiers-Koballa
 
Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪
Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪
Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪崇之 清水
 
Audit Vault Database Firewall 12.2.0.1.0 installation
Audit Vault Database Firewall 12.2.0.1.0 installationAudit Vault Database Firewall 12.2.0.1.0 installation
Audit Vault Database Firewall 12.2.0.1.0 installationPinto Das
 
Reserved Instance 及び Savings Plan を感覚的に理解する
Reserved Instance 及び Savings Plan を感覚的に理解するReserved Instance 及び Savings Plan を感覚的に理解する
Reserved Instance 及び Savings Plan を感覚的に理解する陽一 佐竹
 
천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)
천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)
천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)Amazon Web Services Korea
 
야, 너두 짤수있어 - IaC Basic(210131 김성익)
야, 너두 짤수있어 - IaC Basic(210131 김성익)야, 너두 짤수있어 - IaC Basic(210131 김성익)
야, 너두 짤수있어 - IaC Basic(210131 김성익)SeongIkKim2
 
[D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint
[D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint [D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint
[D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint NAVER D2
 
Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018
Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018
Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018Amazon Web Services
 
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjpOpen Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjpToshiaki Maki
 

What's hot (20)

IBM Cloud Object Storage 오브젝트 스토리지
IBM Cloud Object Storage 오브젝트 스토리지IBM Cloud Object Storage 오브젝트 스토리지
IBM Cloud Object Storage 오브젝트 스토리지
 
DATADOG TIPS #1
DATADOG TIPS #1DATADOG TIPS #1
DATADOG TIPS #1
 
Veeam presentation v7
Veeam   presentation v7Veeam   presentation v7
Veeam presentation v7
 
Tiki.vn - How we scale as a tech startup
Tiki.vn - How we scale as a tech startupTiki.vn - How we scale as a tech startup
Tiki.vn - How we scale as a tech startup
 
엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈
엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈
엔터프라이즈를 위한 AWS 지원 및 사례 (서수영) - AWS 웨비나 시리즈
 
Intro To Alfresco Part 1
Intro To Alfresco Part 1Intro To Alfresco Part 1
Intro To Alfresco Part 1
 
Single Sign-On for APEX applications based on Kerberos (Important: latest ver...
Single Sign-On for APEX applications based on Kerberos (Important: latest ver...Single Sign-On for APEX applications based on Kerberos (Important: latest ver...
Single Sign-On for APEX applications based on Kerberos (Important: latest ver...
 
Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...
Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...
Kafka error handling patterns and best practices | Hemant Desale and Aruna Ka...
 
Cloud Composer workshop at Airflow Summit 2023.pdf
Cloud Composer workshop at Airflow Summit 2023.pdfCloud Composer workshop at Airflow Summit 2023.pdf
Cloud Composer workshop at Airflow Summit 2023.pdf
 
SSO With APEX and ADFS the weblogic way
SSO With APEX and ADFS the weblogic waySSO With APEX and ADFS the weblogic way
SSO With APEX and ADFS the weblogic way
 
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
Amazon EMR과 SageMaker를 이용하여 데이터를 준비하고 머신러닝 모델 개발 하기
 
Azure Data Studio Extension Development
Azure Data Studio Extension DevelopmentAzure Data Studio Extension Development
Azure Data Studio Extension Development
 
Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪
Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪
Amazon DynamoDB(初心者向け 超速マスター編)JAWSUG大阪
 
Audit Vault Database Firewall 12.2.0.1.0 installation
Audit Vault Database Firewall 12.2.0.1.0 installationAudit Vault Database Firewall 12.2.0.1.0 installation
Audit Vault Database Firewall 12.2.0.1.0 installation
 
Reserved Instance 及び Savings Plan を感覚的に理解する
Reserved Instance 及び Savings Plan を感覚的に理解するReserved Instance 及び Savings Plan を感覚的に理解する
Reserved Instance 及び Savings Plan を感覚的に理解する
 
천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)
천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)
천만 사용자를 위한 AWS 아키텍처 보안 모범 사례 (윤석찬, 테크에반젤리스트)
 
야, 너두 짤수있어 - IaC Basic(210131 김성익)
야, 너두 짤수있어 - IaC Basic(210131 김성익)야, 너두 짤수있어 - IaC Basic(210131 김성익)
야, 너두 짤수있어 - IaC Basic(210131 김성익)
 
[D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint
[D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint [D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint
[D2] java 애플리케이션 트러블 슈팅 사례 & pinpoint
 
Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018
Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018
Amazon VPC: Security at the Speed Of Light (NET313) - AWS re:Invent 2018
 
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjpOpen Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjp
 

Similar to Magento 2.3 Schema and Data Patches

Igor Miniailo - Magento 2 API Design Best Practices
Igor Miniailo - Magento 2 API Design Best PracticesIgor Miniailo - Magento 2 API Design Best Practices
Igor Miniailo - Magento 2 API Design Best PracticesAtwix
 
Magento2.3 API Functional Testing
Magento2.3 API Functional TestingMagento2.3 API Functional Testing
Magento2.3 API Functional TestingVishwas Bhatnagar
 
Backwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NLBackwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NLIgor Miniailo
 
Eugene Shaksuvarov - Tuning Magento 2 for Maximum Performance
Eugene Shaksuvarov - Tuning Magento 2 for Maximum PerformanceEugene Shaksuvarov - Tuning Magento 2 for Maximum Performance
Eugene Shaksuvarov - Tuning Magento 2 for Maximum PerformanceMeet Magento Italy
 
Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Igor Miniailo
 
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZBackward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZIgor Miniailo
 
Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2Hanoi MagentoMeetup
 
API design best practices
API design best practicesAPI design best practices
API design best practicesIgor Miniailo
 
Magento 2 Declarative Schema
Magento 2 Declarative SchemaMagento 2 Declarative Schema
Magento 2 Declarative Schemaatishgoswami
 
Backward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide WebinarBackward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide WebinarIgor Miniailo
 
Using Magento 2.3 MySQL Queues
Using Magento 2.3 MySQL QueuesUsing Magento 2.3 MySQL Queues
Using Magento 2.3 MySQL QueuesRenu Mishra
 
A long way from Monolith to Service Isolated Architecture #MM19NL
A long way from Monolith to Service Isolated Architecture #MM19NLA long way from Monolith to Service Isolated Architecture #MM19NL
A long way from Monolith to Service Isolated Architecture #MM19NLIgor Miniailo
 
Mage Titans USA 2016 M2 deployment
Mage Titans USA 2016  M2 deploymentMage Titans USA 2016  M2 deployment
Mage Titans USA 2016 M2 deploymentOlga Kopylova
 
Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Brent W Peterson
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2 Igor Miniailo
 
093049ov10.pptx
093049ov10.pptx093049ov10.pptx
093049ov10.pptxNguyenNM
 
Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.Elogic Magento Development
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhubMagento Dev
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoIRJET Journal
 
Zendcon magento101
Zendcon magento101Zendcon magento101
Zendcon magento101Mathew Beane
 

Similar to Magento 2.3 Schema and Data Patches (20)

Igor Miniailo - Magento 2 API Design Best Practices
Igor Miniailo - Magento 2 API Design Best PracticesIgor Miniailo - Magento 2 API Design Best Practices
Igor Miniailo - Magento 2 API Design Best Practices
 
Magento2.3 API Functional Testing
Magento2.3 API Functional TestingMagento2.3 API Functional Testing
Magento2.3 API Functional Testing
 
Backwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NLBackwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NL
 
Eugene Shaksuvarov - Tuning Magento 2 for Maximum Performance
Eugene Shaksuvarov - Tuning Magento 2 for Maximum PerformanceEugene Shaksuvarov - Tuning Magento 2 for Maximum Performance
Eugene Shaksuvarov - Tuning Magento 2 for Maximum Performance
 
Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2
 
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZBackward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
 
Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2Mli 2017 technical intro to magento 2
Mli 2017 technical intro to magento 2
 
API design best practices
API design best practicesAPI design best practices
API design best practices
 
Magento 2 Declarative Schema
Magento 2 Declarative SchemaMagento 2 Declarative Schema
Magento 2 Declarative Schema
 
Backward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide WebinarBackward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide Webinar
 
Using Magento 2.3 MySQL Queues
Using Magento 2.3 MySQL QueuesUsing Magento 2.3 MySQL Queues
Using Magento 2.3 MySQL Queues
 
A long way from Monolith to Service Isolated Architecture #MM19NL
A long way from Monolith to Service Isolated Architecture #MM19NLA long way from Monolith to Service Isolated Architecture #MM19NL
A long way from Monolith to Service Isolated Architecture #MM19NL
 
Mage Titans USA 2016 M2 deployment
Mage Titans USA 2016  M2 deploymentMage Titans USA 2016  M2 deployment
Mage Titans USA 2016 M2 deployment
 
Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2
 
093049ov10.pptx
093049ov10.pptx093049ov10.pptx
093049ov10.pptx
 
Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of Magento
 
Zendcon magento101
Zendcon magento101Zendcon magento101
Zendcon magento101
 

Recently uploaded

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
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
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
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
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
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
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
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
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
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.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 

Recently uploaded (20)

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
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
 
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...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.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
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
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
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
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)
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
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...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Magento 2.3 Schema and Data Patches

  • 1. © 2019 Magento, Inc. Page | 1 Magento 2.3 Schema and Data Patches
  • 2. © 2019 Magento, Inc. . Page | 2 Technical Architect at BORN Group Atish Goswami
  • 3. © 2019 Magento, Inc. Page | 3 Agenda
  • 4. © 2019 Magento, Inc. Page | 4 Agenda • Schema Patches • Data Patches • Version Patches • Revertible Patches • New CLI Commands
  • 5. © 2019 Magento, Inc. Page | 5 What is Schema Patch?
  • 6. © 2019 Magento, Inc. Page | 6 Schema Patches • A class that contains custom schema modification instructions • Schema patches are used along with declarative schema • Schema patches allow complex operations – Adding triggers, stored procedures, functions – Performing data migration with inside DDL operations – Renaming tables, columns, and other entities – Adding partitions and options to a table
  • 7. © 2019 Magento, Inc. Page | 7 Where do we define this file ?
  • 8. © 2019 Magento, Inc. Page | 8 <module_root>/Setup/Patch/Schema/<Patch_Name>.php
  • 9. © 2019 Magento, Inc. Page | 9 MagentoFrameworkSetupPatchSchemaPatchInterface
  • 10. © 2019 Magento, Inc. Page | 10 Methods we will implement
  • 11. © 2019 Magento, Inc. Page | 11 MagentoFrameworkSetupPatchPatchInterface::getAliases() • Patch class names can change over time • But changing name should not affect installation process • If we will change name of the patch we will add alias here • This method returns an array
  • 12. © 2019 Magento, Inc. Page | 12 MagentoFrameworkSetupPatchPatchInterface::getAliases()
  • 13. © 2019 Magento, Inc. Page | 13 MagentoFrameworkSetupPatchPatchInterface::apply() • The code to apply the patch is written inside here • One patch is responsible only for one setup version
  • 14. © 2019 Magento, Inc. Page | 14 MagentoFrameworkSetupPatchPatchInterface::apply()
  • 15. © 2019 Magento, Inc. Page | 15 MagentoFrameworkSetupPatchDependentPatchInterface::getDependencies() • Patches can be dependent on other patches • Other patches needs to be applied before your patch is applied • One patch can have can have many dependences • If the patch is dependent on some other modules patch use sequencing in your module.xml • It is recommended to declare dependencies of patches present in the same module
  • 16. © 2019 Magento, Inc. Page | 16 MagentoFrameworkSetupPatchDependentPatchInterface::getDependencies()
  • 17. © 2019 Magento, Inc. Page | 17 Applying the Schema Patch
  • 18. © 2019 Magento, Inc. Page | 18 Applying the Schema Patch
  • 19. © 2019 Magento, Inc. Page | 19 What happened behind the scenes
  • 20. © 2019 Magento, Inc. Page | 20 What happens behind the scenes • Magento runs the schema patch • If it is successfully executed the class name is stored in the patch_list table • Next time when the setup upgrade runs it refers the patch_list table and if the patch class if already applied it is not executed again
  • 21. © 2019 Magento, Inc. Page | 21 Patch List Storage
  • 22. © 2019 Magento, Inc. Page | 22 What is Data Patch?
  • 23. © 2019 Magento, Inc. Page | 23 Data Patches • A class that contains data modification instructions • Majorly will be used to create tables records, EAV attributes
  • 24. © 2019 Magento, Inc. Page | 24 Where do we define this file ?
  • 25. © 2019 Magento, Inc. Page | 25 <module_root>/Setup/Patch/Data/<Patch_Name>.php
  • 26. © 2019 Magento, Inc. Page | 26 MagentoFrameworkSetupPatchDataPatchInterface
  • 27. © 2019 Magento, Inc. Page | 27 Methods we will implement
  • 28. © 2019 Magento, Inc. Page | 28 MagentoFrameworkSetupPatchPatchInterface::apply()
  • 29. © 2019 Magento, Inc. Page | 29 What is Version Patch?
  • 30. © 2019 Magento, Inc. Page | 30 Versions Patches • It is used for backwards compatibility with older setup scripts • A version number can be defined • Magento checks if setup module version • If the version of the module is higher than the version specified in your patch, then the patch is skipped • If the version in the database is equal or lower, then the patch installs. • It is marked as deprecated
  • 31. © 2019 Magento, Inc. Page | 31 How to convert a schema/patch into a version patch ?
  • 32. © 2019 Magento, Inc. Page | 32 MagentoFrameworkSetupPatchPatchVersionInterface
  • 33. © 2019 Magento, Inc. Page | 33 What is Revertable Patch?
  • 34. © 2019 Magento, Inc. Page | 34 Revertable Patches • Patches can be reverted at the time of removing the module • Single patches cannot be reverted • Module uninstall needed to be triggered • This feature is still buggy and changes are happening
  • 35. © 2019 Magento, Inc. Page | 35 How to convert a schema/patch into a revertable patch ?
  • 36. © 2019 Magento, Inc. Page | 36 MagentoFrameworkSetupPatchPatchRevertableInterface
  • 37. © 2019 Magento, Inc. Page | 37 How to uninstall a module ?
  • 38. © 2019 Magento, Inc. Page | 38 Uninstall a composer module Uninstall a non-composer module
  • 39. © 2019 Magento, Inc. Page | 39 New CLI Command
  • 40. © 2019 Magento, Inc. Page | 40 Generating Patches
  • 41. © 2019 Magento, Inc. Page | 41 Generating Patches
  • 42. © 2019 Magento, Inc. Page | 42 Questions ?
  • 43. © 2019 Magento, Inc. Page | 43 Thank You