-
-
Notifications
You must be signed in to change notification settings - Fork 178
037 Auto create SQL updates for Componets in JCB
Hi I would like to demonstrate to you one of the latest features that's been added to JCB If it's a request was made about 11 days ago Auto generate my update SQL After a lengthy discussion the decision was made to add the The future and I am basically done doing so first let me give you some Background so you can understand where we coming from When you create a component in Joomla Then usually you have a set of views and the views and the backend are linked to a set of tables 00:00:38 I'm so on the installation of the component For example if we do so here with JCB It actually Builds the tables for those views on installation So then if you go to the back end of the component And You create a new item it actually stores the value in the database So that it can be retrieved that's very basic The reality is 00:01:17 If you as a developer make a change To this component Which involves new tables Then Obviously you would need to add Extra script to your components package So did upon installation If it finds that there is already an existing component it will actually update the database accordingly to the New settings the new tables or any Fields added or so forth So we gonna demonstrate this 00:01:47 In JCB there used to be a way to do that which still works by the way it was manual way a way for you to manually add the new SQL statements That are needed to make the update, it was done under this version updates tab so you would click on a version Updates tab and here you would add your specific sequel 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 and so forth So What I'm gonna do now is you'll see that at the moment This admin view has only 1 2 3 4 5 6 00:02:38 Views I'm gonna add another View to this component You can see it doesn't have these buttons ticked I don't not know how to resolve this it seems like This is a Joomla problem Because there are multiple Columns in this view Because if you close it and click it again And actually fixes that anyway that's just by the way so now here I'm gonna add a new View 00:03:09 Called help documents and just make some minor changes to the defaults Add it to the 7th position And then click save and click save again So now we basically add a new view which means a new table to the database But we haven't written any of the SQL Because with the new changes this is gonna be done for you automatically on the moment to compile this Component So let's do that So now here we are, we are going again compile this component you see it's version is it still 1.4.1 00:03:49 So We are compiling it Now what the system is doing is, it is checking the history and it's making a lot of calculation To dynamically realise that there is been a new table increment The version number And If I now Install this component And 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 if I create new it'll automatically start behaving the way that is expected And That is really Let say, text And then, hi So we are targeting The External sources 00:04:43 So forgot Few other things here as you can see The database already stores the values And the new table is actually therefore in the database and working as expected now you realize that This means that our JCB component Has been updated so if I refresh this page You'll see that the version number has been incremented 00:05:14 And if you open the version updates and scroll down you would see that one point ....... 1.4 .1 Got this new creating of a help document Table And a new version got allocated here Obviously we do not know what is this link and so we add this demo link here which you need to manually update still But that is by far a tremendous improvement 00:05:44 Ok 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 so let me demonstrate that quickly So I'm gonna be adding a new field to the preacher View I'm simply gonna select any Fields since I will removed again Let's call it Image And I'm gonna add this to left One That must be then two 00:06:27 And save And save and close So now I've added a new field to preachers And again I'll be going to the compiler And I'll select the component and just compile And again since it detected there's been a field change it incremented the version number And if I install the component And we go to the component To the preachers View We'll now see 00:07:02 That new field actually there Image And if I was to select an image And save You'll see that it Really Oops I see I actually missed it The reason was that This component didn't have any history so I had to go and make a few changes take into account that your building a component from the ground up it will have history 00:07:33 So this is only gonna be happening when you have install a component via the import function in the components or maybe using the demo component So what I would advise it just open all the views and save them at least once so that there is history recorded for For that View That is one of the drawbacks there is really no way for me to my negate that issue Since the history Of each of these different items Being at the admin view and the fields actually needs to be created the moment that you saved the item And it's really can't be done before then Ok 00:08:14 So taking that an account I'll recompile it again and fix That so it should increment it to 1.4.3 I will just install that Again Going back to refreshing the preacher will see that Image field is back now select an image Click save and now you'll see That it actually does store the data for this image 00:08:49 Because if we refresh the The component will see that it is again Incremented the version If I open the Update area You see that it actually Added this new Altering of the preacher table adding the image Field And it is also added the new 00:09:16 Version to this list Ok so that is a quick demonstration of this new feature automated feature It is in its very beta Phase we obviously still gonna Be working at it to make sure that it's completely stable So please Take a go at it if you find any bugs open look for other open issues which may be Someone already reported And start commenting on that what you think should be done And if you don't find any then please open an issue and let us let us fix this issue 00:09:55 I think this will be a tremendous improvement to JCB Making it Again with the one of the best Joomla component Developing tools Out there today Where it is even writing your update sequel for you Just by you being busy working and improving your component Without being concerned about that Thank you for watching
- Home
- Beta Testing
- Custom Code
- PHP Settings
- Demo Component
-
Tutorials
- Hello World JCB
- Intro JCB Guide
- JCB Installation Steps
- Planning Components
- Field Type Overview
- Basic Fields Creation
- Admin View Management
- Advanced Field Usage
- Admin Component Integration
- Component Setting Customization
- Scripting Components
- Component FTP Options
- Dynamic Get Method
- Site View DynamicGet
- Site View Templates
- Template Setup Guide
- Layout Configuration Steps
- Custom Admin Management
- Adding Site Views
- Custom Admin Integration
- MySQL Demo Tweaking
- Global JCB Settings
- Custom Time Field
- User Helper Integration
- Email Helper Usage
- Message Store Email
- List View Unescape
- Export Import Customization
- Overwrite Custom Fields
- List Field Filtering
- Automatic Code Import
- Manual Code Implementation
- Component Export Import
- Custom Admin Buttons
- Translation Management
- Site View Permissions
- Component SQL Updates
- Site Edit Configuration
- JCB Backup System
- Helper Structure Integration
- JCB v2.5 Upgrade
- Tab Setup Guide
- JCB v2.6 Release
- Extended HelloWorld
- Field Rule Validation
- Community Snippets Intro
- Snippet Forking Tutorial
- Pull Request Snippets
- Library Manager Area
- Excel-based Translation
- Dynamic Router Details
- Database Auto Updates
- Subform Quick Demo
- VDM Package Import
- Dynamic File Inclusion
- File Field Upload
- Drag-n-Drop Upload
- Quick HelloWorld JCB
- Non-database Fields
- Dashboard Customization
- Menu Prefix Toggle
- Community JCB Packages
- Collaborative JCB Workflow
- JCB Package Install
- JCB JAB18 Event
- Convenient New Fields
- Component Language Strings
- Library Functionality Anticipation
- Join Field Relations
- License Template Change
- Code Reusability
- Local Dev Environment
- Extended Field Types
- Joomla Custom Fields
- Custom Field Expansion
- Site View Listing
- Run Expansion Method
- Form Site View
- Field URL Update
- Additional Helper Methods
- Field Validation Rules
- New Placeholder Feature
- Component Config Params
- Per-field Default Values