Admin view with no fields breaks table creation
Closedopened 3 months ago by Chris Paschen · 5 comments
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Steps to reproduce the issue
RESULT: Try to open table and error given that the table doesn't exist; the table was not created in the db; no 'CREATE TABLE' in the JCB Components Update view
EXPECTED RESULT: Table created with fields
ACTUAL RESULT: Table NOT created; no entries at all for the table appear in the Component's Update area in JCB
RESULT: in JCB Components Update view a 'RENAME TABLE' update is listed (but still no 'CREATE TABLE') so table doesn't exist
RESULT: Table is created as it should
The question is why, after step 7 above did the table not get created once fields were added?
Is there a way to add fields to an admin view and have it create the table properly after it has previously been compiled with an empty admin view?
If not, is there a way to 'flag' an empty (no fields) admin view to avoid compiling a component with an empty admin view?
System information (as much as possible)
I've tested this on a couple different sites (all with same WAMP servers specs)
This isn't a 'critical' issue (actually a pretty low priority item) as I would hope that I don't accidentally forget to add the fields again, but it is a pretty frustrating bind to get in to have to completely remove the admin view (and have to come up with a completely different view name) when you forget to add the fields at first.
I have always tried to stop Llewellyn from creating this particular automation. Nonetheless, he insisted on doing so and now it has become a pain. Let me tell you, it's all thanks to that blasted Joomla history component. Have you reviewed his in-depth explanation on why things tend to go awry on this? If you watch it again, I'm almost certain that you will recognize where you're going wrong, and get the timing just wrong.
Here you go https://youtu.be/55U8FDlLI7Q
@cpsachen I have done a quick test in this area, and I see we may have a real issue. Will update you once I know more.
@Llewellyn I don't personally think this is all that critical to deal with right now (unless it makes sense to do so from a coding perspective). I would think just a 'check' process that maybe even just aborts the compile if there is an admin view with not fields would do the trick.
But until you get a good break in the more involved code, maybe just a text on the compile page to say "Slow down and check your work" would do :-)
Considering how many admin views I have created over the past few years in JCB, I'm surprised that I didn't do this before. But that just goes to show that IF you watch the JCB youtube videos and just take time and be careful we can avoid this (until you have time to come up with a way to prevent the issue.
Thanks for all your work on JCB!
If we don't fix bugs as we go, it will pile up and fall on us 👍
So its a big deal... and I need to fixed, as I am using this everyday. I think I found the issue.
Try this in Updatesql.php on line 223-233 make the following change:
So we make the name part of the path, this should resolve it.
Can you do me another favor? Please check that all changes (that should trigger a DB update) do trigger a DB update.
This fix will be in the next release, but is already be in the beta build.