Updated 052 Automated database updates in Joomla during development of a component (markdown)

Amigo 2019-09-04 14:01:26 +02:00
parent ec45010e84
commit 872a9bdd1f
1 changed files with 8 additions and 2 deletions

@ -5,13 +5,19 @@
[00:00:00](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
(_Click on these time links to see Youtube video_)
I would like to give you a explanation as well as demonstration of how JCB deals with Joomla's implementation when it regards to creating of Database tables, as well as updating them or even adding more. Joomla is a way of doing this through specific file convention within your components file structure package. JCB is also been designed to detect changes in your components development [00:00:37](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m37s) and create those files for you. The best way to illustrate this is let's compile a component. We have Sermon Distributor. Let's going to compile that for us. Then we'll go to the zip file, unzip it. Have a look at it, and see those files extracted here. [00:01:04](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m04s) Inside of this(com_sermondistributor) we have an admin folder and inside admin folder a sql folder. Here(installmysql.uft8.sql) is the first file of interest that's what Joomla uses to build a database upon the first install of the component.
This is an explanation as well as a demonstration of how JCB deals with Joomla's implementation regarding the creation of Database tables, as well as updating them or even adding more. Joomla has a way of doing this through specific file conventions within your components file structure package. JCB is also been designed to detect changes in your component's development and create those files for you. [00:00:37](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m37s) The best way to illustrate this is to compile a component. We have Sermon Distributor. Let's compile that and go to the zip file, unzip it. Have a look at it, and see those files extracted in this(com_sermondistributor) we have an Admin folder and in the Admin folder a SQL folder. Here(installmysql.uft8.sql) is the first file of interest that is what Joomla uses to build a database upon the first install of the component.<<<
### Runs Only On Fresh Install - Thereafter It will Not Run Again
[00:01:17](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m17s)
Do take note that it runs this file only on a fresh install of the component, thereafter it will not run it again, even if that's file gets updated, even if more values get added and usually it does, JCB updates this file as you create new views which in then it means a new table, and if you add Fields which means a new column or field in the database. [00:0So1:46](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m46s) This file will update but it is for those clients of yours that is going to install the component for the first time. All those who already have the component installed, this file will mean nothing to them. All the files in this update folder is what would be relevant. If you have a client which has version 1.3.2 installed on his system, and he gets this package from you this 2.0.0 [00:02:14](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m14s) package, it will start with 1.3.2 file, then 1.3.3 and so forth. It will start with a file which is the same version as the version that is currently installed on the Joomla website. [00:02:34](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m34s) That means JCB builds these files in that expected way.
NB. It runs this file only on a fresh install of the component, thereafter it will not run it again, even if that file gets updated, even if more values get added and usually it does, JCB updates this file as you create new views which means a new table, and if you add Fields which means a new column or field in the database. [00:0So1:46](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m46s) This file will update but it is for those clients of yours that is going to install the component for the first time. Those who already have the component installed, this file will mean nothing. All the files in this update folder are what would be relevant. If you have a client which has version 1.3.2 installed on his system, and he gets this package from you this 2.0.0 package, it will start with 1.3.2 file, then 1.3.3 and so forth.[00:02:14](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m14s) It will start with a file which is the same version as the version that is currently installed on the Joomla website. [00:02:34](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m34s) That means JCB builds these files in that expected way. <<<<<<<<<<<
### Making Changes - JCB Updates