Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
en:entwickler:aenderungen_in_der_datenbank_einbauen [2016/11/02 09:44] – [Where do I document changes?] ximexen:entwickler:aenderungen_in_der_datenbank_einbauen [2016/12/03 15:11] – typos and urls ximex
Line 1: Line 1:
 ====== Installing changes to the database ====== ====== Installing changes to the database ======
 ==== Where do I document changes? ==== ==== Where do I document changes? ====
-We have created a graphical representation of database model using the free software [[http://www.mysql.de/products/workbench/|MySQL-Workbench]] ([[http://dev.mysql.com/downloads/workbench/|Download]]). The current project file with our data model for MySQL Workbench can be downloaded via the following link Subversion: <code> https://admidio.svn.sourceforge.net/svnroot/admidio/trunk/documentation/admidio.mwb </code>+We have created a graphical representation of database model using the free software [[https://www.mysql.de/products/workbench/|MySQL-Workbench]] ([[https://dev.mysql.com/downloads/workbench/|Download]]). The current project file with our data model for MySQL Workbench can be downloaded via the following link Subversion: <code> https://admidio.svn.sourceforge.net/svnroot/admidio/trunk/documentation/admidio.mwb </code>
 For subsequent versions, you can download the data model here: For subsequent versions, you can download the data model here:
   * {{:de:entwickler:datenbank:admidio_datenmodell_2-0.pdf|Data model for Admidio Version 2.0}}   * {{:de:entwickler:datenbank:admidio_datenmodell_2-0.pdf|Data model for Admidio Version 2.0}}
Line 25: Line 25:
     <step id="30">usw...</step>     <step id="30">usw...</step>
     <step>stop</step>     <step>stop</step>
-</update></code>You can already see how the update works. Showing with ascending ID just one command written in a **step**. <code xml><step id="40">UPDATE %PREFIX%_organizations SET org_homepage = 'http://www.example.com' WHERE org_homepage IS NULL</step></code> For tables always here the placeholder **%PREFIX%** must be used to ensure that the specific table prefixes for installation is considered. Important also the last **step** with the content **stop**. The system detects the desired end and the script is not aborted somewhere.+</update></code>You can already see how the update works. Showing with ascending ID just one command written in a **step**. <code xml><step id="40">UPDATE %PREFIX%_organizations SET org_homepage = 'https://www.example.com' WHERE org_homepage IS NULL</step></code> For tables always here the placeholder **%PREFIX%** must be used to ensure that the specific table prefixes for installation is considered. Important also the last **step** with the content **stop**. The system detects the desired end and the script is not aborted somewhere.
  
 === How can database dependent SQL be executed? === === How can database dependent SQL be executed? ===
Line 32: Line 32:
  
 === How can SQL error output be suppressed? === === How can SQL error output be suppressed? ===
-Sometimes you want to execute an SQL statement but don't want the update to be cancelled if this SQL throws an error. For example if you want to delete an specific index but you are not sure if this index exists in every database of all Admidio installations. If you want to suppress the error you can add the attribute **error** to your **step** and give it the value **ignore**. <code xml><step id="130" error="ignore">ALTER TABLE %PREFIX%_announcements DROP INDEX %PREFIX%_FK_ANN_ORG</step></code>+Sometimes you want to execute an SQL statement but don't want the update to be canceled if this SQL throws an error. For example if you want to delete an specific index but you are not sure if this index exists in every database of all Admidio installations. If you want to suppress the error you can add the attribute **error** to your **step** and give it the value **ignore**. <code xml><step id="130" error="ignore">ALTER TABLE %PREFIX%_announcements DROP INDEX %PREFIX%_FK_ANN_ORG</step></code>
  
 === How can PHP code to run? === === How can PHP code to run? ===
 In addition to the SQL commands, it is also possible to run  PHP code. This is done by calling a method of the class **Component Update**. In this class you can add a new method that contains a snippet of code, for eg. loop over all organizations and execute an SQL statement for any organization. You can call this method then by calling this method as a static method in the XML file in a **step**. <code xml><step id="550">ComponentUpdate::updateStepDeleteDateRoles</step></code> In addition to the SQL commands, it is also possible to run  PHP code. This is done by calling a method of the class **Component Update**. In this class you can add a new method that contains a snippet of code, for eg. loop over all organizations and execute an SQL statement for any organization. You can call this method then by calling this method as a static method in the XML file in a **step**. <code xml><step id="550">ComponentUpdate::updateStepDeleteDateRoles</step></code>
  • en/entwickler/aenderungen_in_der_datenbank_einbauen.txt
  • Last modified: 2021/11/15 14:24
  • by fasse