-
-
Notifications
You must be signed in to change notification settings - Fork 178
052 Automated database updates in Joomla during development of a component
I would like to give you a explanation As well as demonstration Of how JCB deals with jamalife Implementation Morning regards to creating off Database tables As well as updating them or even adding more You was a way of doing this through specific file convention Within your components file structure Package JCB is also been Designed to actually detect changes in your component development And create with files for you The best way to illustrate this is well this is compile a component So we have Similar to Beauty here Who's gonna compile that for us And then we'll go to the zip file Unzip it Have a look at it And see those files Videos of Thailand business extracted here An inside of this we have an admin folder and inside admin a sepal folder And here is the first fire with interest It's what you mean I use this to actually build a database upon the first install of the component 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 table New views which in Then it means and you table And if you add Fields which means a new column or field in the database And so This file update but it is for those Clients of yours that it couldn't install the component for the first time all those who already have the component installed This far will mean nothing to them All the files in this update folder Is what would actually be relevant If you have a client Which has version 1.3.2 installed Honour system Any gets this package from you this 2.0.0 Package Actually Start with This file Then that one and so forth It will start with a Fire which is the same Version as the version that is currently installed on The Joomla website So That means JCB builds these files In that expected way Ok Now let's go make a change to the component and see how JCB updates these files Just gonna install the component So we have it in the database We can look at the database in the moment To see how things change Now I'm gonna open the admin views and I'm gonna add A field To be at the at The View called sermon Is it gonna be any generic field So that we can at least see it in action I'm gonna call it mobile telephone And Just put in the fourth position The left tab that's not really important but Ok so there we go Reality fuel No you could at this point also add a new view and JCB world take both of them And will add both of them to the update file But You could even do that You know Make this change run the compiler Have this new update Then make it out of Change run the compiler and it'll follow along Incrementally Incrementing the diversion Value of the component As you go Just for our sake Maybe let me add a view Already in another View And then you'll see how they should be combined to these values N21 update So I'm going to grab a If you that isn't already part of this component And just where does stration Save and close Today we go we gotta view and it a new field If we compile the component now It will Do all those things that I've explained The receive its increment ID into 2.0.1 And if we go to the zip file Regain extracted open it up at 9 Sequel Updates When I'll see you there is actually a new file let's open this file Justin Investigate a little So we see here's the Command to actually add that new field And here is another one To create That new table And all of that is been placed into this 2 Dot co.za File Which like I said is the current version Of this installed Component If we look at the database at this point You see there there is no Look table And if we look at the Sermon table and structure Then we see that there is you know No Mobile field here Ok so that's install it now and see the change Ok it's been successful go back to the table Fastest refresh this I know you have it Got field added Africa back to the new table that it had to create Scroll down And there is the new table So it's done both of those as expected Secondly let me show you where it made some changes in JCB To relation to this component Will see that the component has automatically incremented it's version number If we open this component updates area You see that it has dynamically Store the same values that we saw on the file here next to the correct version And it is actually created a new Version entry You have to manually update this URL As there are too many variations here we couldn't actually implement This Dynamic Lee Is this your L is what is being used in your updates server file If your component is said to have an update server file And so At this point You can now continue even adding another view or even another field L just the same it Winkler meant it and it will update your database upon installation And really that is as simple as it is There are some places where that behaviour may not function as expected The only one I'm very much aware of is the one that happens when you Actually import Or Export a component from one JCB to another There's a few that have used this you can export a component and then Import It Again That effectively creates all the data in the relation to JCP but it does Recreate the history and the acid it is and everything else which is related to its end Integration Within the Joomla Interface or Database So that means for example your There is no history Regarding the admin views And the only way to start any history for that View Would be to open it And to save and close it That's the only way Now that specific area will have a history track Same goes with the admin Fields reviews You have to open them and save them This one not not there Open view itself but the actual Fields of the app review Open them save them again This will create its first entry and serve as a reference point The last time to the which those values were changed If you compile the component that point it will actually Add two component ID to that specific entries And use it as a reference point like I've said Then having after having compiled it so you first saved them then compile the component And then only start making your changes So that you'll basically Bring the component into the motion of What would be the natural com Flow of development This natural flow that you would Create a component add views then add Fields to it all along saving closing saving And that generates the history values that we actually need To detect changes If you import a component none of those values exist and so It won't behave is expected Well that's just a heads up I supposed many of you might not even have this issue but If you do You will know at least where to look and what to do to fix it Anyway that is a Quick overview of JCB Implementation To correspond to Gmail as conventions In creating tables And updating them Dynamically Through The Secret Files In the updates folder And yes I hope that This is gonna be helpful to to those who view that may not have understood this before Thanks 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