Updated 037 Auto create SQL updates for Componets in JCB (markdown)
parent
ab47829577
commit
a68deb06c5
@ -14,19 +14,30 @@ On the installation of the component, for example, as is done with JCB, it build
|
|||||||
|
|
||||||
### Manually Adding New SQL Statements
|
### Manually Adding New SQL Statements
|
||||||
|
|
||||||
We going to demonstrate this. [00:01:47](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) In JCB there used to be a way to do that, which still works. A way for you to manually add the new SQL statements that are needed to make the update, it was done under version updates tab. You would click on version updates tab and you would add your specific SQL query script, and upon installation if the existing version is below this update, it will grab this and install it into the database creating the new tables.
|
[00:01:47](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s)
|
||||||
|
|
||||||
|
In JCB there used to be a way to do that, which still works. A way to manually add the new SQL statements that are needed to make the update, it was done under the Version Updates tab. You would click on Version Updates tab and would add your specific SQL query script, and upon installation if the existing version is below this update, it will grab this and install it into the database creating the new tables.
|
||||||
|
|
||||||
### Adding A New View/New Table To Component
|
### Adding A New View/New Table To Component
|
||||||
|
|
||||||
What I'm going to do now is, you'll see that at the moment, this admin view has only 1, 2, 3, 4, 5, 6, [00:02:38](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m38s) views. I'm going to add another view to settings component. You can see it doesn't have these buttons ticked. I don't not know how to resolve this. It seems like it is a Joomla problem. Because there are multiple columns in this view. If you close it and click it again it fixes that anyway. I'm going to add a new view [00:03:09](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m09s) called help documents and make some minor changes to the defaults. Add it to the 7th position, click save and click save again. We add a new view which means a new table to the database. We haven't written any of the SQL, because with the new changes this is going to be done for you automatically on the moment you compile this component. We are going again and compile this component. You will see it's version, it is still 1.4.1. [00:03:49](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m49s) We compiling it.
|
[00:02:35](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m35s)
|
||||||
|
|
||||||
|
This Admin View has only 1, 2, 3, 4, 5, 6, views. I'm going to add another view to this component. These buttons is not ticked. It seems to be a Joomla problem because there are multiple columns in this view. If it is closed and clicked again it fixes that. I am going to add a new view called 'Help Documents' and make some minor changes to the defaults. [00:03:14](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m14s) Add it to the 7th position, click save and click save again. A new view has been added which means a new table to the database. We have not written any of the SQL, because with the new changes this is going to be done automatically the moment this component is compiled. We are and This component is going to be compiled again. Its version is still 1.4.1. Then it gets compiled.
|
||||||
|
|
||||||
### System Checking The History If There Is A New Table
|
### System Checking The History If There Is A New Table
|
||||||
|
|
||||||
Now what the system is doing, it is checking the history and it's making a lot of calculation to dynamically realize that there is been a new table increment the version number. If I now install this component, I go and open that component. I'll see that the new view is here, if I open the view there is no errors. [00:04:20](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m20s) If I create new, it'll automatically start behaving the way that is expected. Let say, text 'hi' we are targeting the external sources. [00:04:43](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m43s) You can see the database already stores the values, and the new table is therefore in the database and working as expected. You realize that this means that our JCB component has been updated. If I refresh this page, you'll see that the version number has been incremented. [00:05:14](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m14s) And if you open the version updates and scroll down you would see that 1.4.1 got this new creating of a help document table. And a new version(1.4.2) got allocated. We do not know what is this (https//github.com/SermonDisributor) link and so we add this (https//domain.com/.zip) demo link here which you need to manually update still. That is by far a tremendous improvement. [00:05:44](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m44s)
|
[00:03:51](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s)
|
||||||
|
|
||||||
|
The system is checking the history and it is making a lot of calculation to dynamically realize that there has been a new table increment version number. If this component is installed now ,and if that component is opened that the new view can be seen. I'll see is here. If the view is opened it does not show any errors. [00:04:20](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m20s) If new is created, it automatically start as expected. For instance, text: 'hi'. This targets the external sources. [00:04:43](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m43s) It may be seen that the database already stores the values, and the new table is therefore in the database and working as expected. This means that the JCB component has been updated. If this page is refreshed , it may be seen that the version number has been incremented. [00:05:14](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m14s) If the version updates is opened it can be seen when you scroll down, that 1.4.1 got this new creating of a help document table and a new version(1.4.2) got allocated. We do not know what is this (https//github.com/SermonDisributor) link and so we add this (https//domain.com/.zip) demo link here which you need to manually update still. That is by far a tremendous improvement.
|
||||||
|
|
||||||
### Adding New Field To Existing View
|
### Adding New Field To Existing View
|
||||||
|
|
||||||
This also works not only with the adding of a new view, but also if you were to add a field to an existing view. Let me demonstrate that quickly. I'm going to be adding a new field to the preacher view. I'm simply going to select any fields since I will removed it again. Let's call it image. I'm going to add in field - image, Allignment - left in tab, order in edit - 2. [00:06:27](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s) Save. Save and close. Now I've added a new field to preachers, and again I'll be going to the compiler, I'll select the component and compile. Again since it detected there's been a field changed, it incremented the version number. If I install the component and we go to the component, to the preachers view, we'll now see [00:07:02](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m02s) that new field is there, image. If I was to select an image, and save. Oops I see I actually missed it, the reason was that this component didn't have any history. I had to go and make a few changes.
|
[00:05:44](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m44s)
|
||||||
|
|
||||||
|
This also works not only with the adding of a new view, but also if a field is added to an existing view. To demonstrate: If a new field gets added to the Preacher view and any fields is selected, since it is going to be removed again. For example: Call it 'Image'.(See video) [00:06:27](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m27s) Save and close. Now a new field has been added to preachers, and then return to the compiler, select the component and compile.<<<<<<<<<<<<<
|
||||||
|
|
||||||
|
|
||||||
|
Again since it detected there's been a field changed, it incremented the version number. If I install the component and we go to the component, to the preachers view, we'll now see [00:07:02](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m02s) that new field is there, image. If I was to select an image, and save. Oops I see I actually missed it, the reason was that this component didn't have any history. I had to go and make a few changes.
|
||||||
|
|
||||||
### If Building A Component It Have History
|
### If Building A Component It Have History
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user