0

While developing a component the database can go through many changes. Updating the component then either goes through many schema update files, or causes problems. Re-applying a database change file (by resetting the schemas table) that adds tables, columns, or indexes currently generates an error that prevents installation.

Is there a compelling reason why such errors as adding a duplicate table/field/index that already exists shouldn't be ignored? The equivalent applies to deletions, I suppose.

MySQL (& presumably others)(?) has a very easy mechanism that would work for this, creating specific error handlers.

This would make the database part of an upgrade idempotent, as the source code part (mostly) already is (did I see the hint of a "delete files" tag in J4 installation files?)

I can see it might be argued this isn't a good idea for public releases, but while developing it would solve a real nuisance when a component has extensive, and evolving, database use.

  • I can't really put my finger on if this is Needs More Focus or Opinion-based or something else. I don't think I follow where the "nuisance" is. Please provide a concrete example so that we can understand a specific challenge that you are overcoming. As far I am concerned, query errors are not noise -- they are signal. I wouldn't want to silence any errors. While executing subsequent schema changes, you can always check if a table|column exists before trying to insert/delete/alter it. Can you please make your question less vague/theoretical? – mickmackusa Sep 23 at 13:32
  • I'm developing "in place", but sometimes need to update a hosted test installation. – Markers Sep 23 at 15:02
  • The number of table changes can sometimes be large. Perhaps with a more formal development cycle they would happen less frequently. I would (sometimes) rather add to incremental table update files than create new ones. I'm not sure I know how to make this any clearer :( – Markers Sep 23 at 15:08
0

I am using the Joomla Component builder more and more which gives a really good systematic approach. https://www.joomlacomponentbuilder.com/ With this, you can add your data and then change the structure, compile a new version and redeploy it. It might help with your build cycle

| improve this answer | |
  • This looks good, I am investigating. Have you done much component/&tc development with it? How does it compare? "Interestingly" I managed to break it with exactly the problem I've addressed here. While I'm sure it's something I've done wrong, I had to laugh. – Markers Sep 24 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.