Component Mysql Script - Table Naming #12
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#12
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello again Llewelyn,
So I'm adding the creation and dump of a countries mysql table in the component. What table naming conventions do I add so that it will pick up the Joomla! table prefix and component name when being installed?
Also, what the the protocol for dropping or updating the table content and structure in future updates? I'm assuming that this is added to the mysql script area to? IE, drop if exists, or update if exists?
Thank you,
Paola
Hi Paola in this tutorial around 1:14:59 I do give a quick explanation about these options.
When you have reviewed that and still have questions let me know.
Hi again,
I have placed the code here but the tutorial - or perhaps i missed it - does not speak about naming conventions for the table - so i have in
CREATE IF NOT EXISTS TABLE '#__mycomponent_countries'
The compile is working but the insert failing -
Thank you,
Paola
What I have found is that often the fields change, and then you need to go update the dump or the table selection.
Further it is hard for me to debug an issue if I can not see the code, sorry! But if you want met to take a closer look you will need to show me more of the code, not just the error.
About the conventions, if you open the install.mysql.utf8 file in administrator/components/com_mycomponent/sql you will see how component builder builds the tables. That is normally the convention. Next you could instead of the dump, first let component builder export the data for you, by making use of the table select option. Then once compiled open the above mentioned file to see the data that was exported by CB-tool dynamically.
Hmm. Ok. So what I am understanding from what you are saying is that prefixing '#__' is possibly the correct way to get the component to auto-magically inset the joomla prefix -
so if i use '#__mycompment_countries', the table will be inserted with 'j35xy_mycompment_countries' (where 'j35xy' is the joomla table prefix.
So there's an error in my SQL.
Ok. This is helpful.
Yes,
#__
is the correct blank prefix.Coolio thanks again, the bug was in the table name being in quotes. Wish, mysql versions!