ContentBox [1.1.0] - Install Module with Extra Tables and ORM

I’m working on a module for which I’d like to have a couple extra tables in the database. I’d also like to use ORM for the model of my module.

Because the Application.cfc for ContentBox has ormsettings.dbupdate=“none”, the app will bomb the next time ORM is reloaded since any persistent entities contained in my module will not yet have associated tables created. Obviously, the App.cfc could be updated by the developer before installation, or the tables could be manually created by the developer, but that pretty much defeats the purpose of a pluggable module.

So then, my question is really what the best approach to take here is. Is there a way to make this work with ORM (perhaps a post-installation hook to create the tables via sql), or do I need to take another approach with the model?

Thanks!

Joel,

This is a hard decision. I chose to disable the dbupdate as many organizations are not very keen on modifications of the production database. Thus, it would be either a manual installation or via SQL. The auto-update features requires the use of SQL for modification and not relying on the ORM and advised as so.

I would say use SQL to modify the DB or modify the Application.cfc but warn the users.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Just out of curiosity are you using these extra tables for storage of settings, or more?

You might be interested in this Blog post I did.

http://www.andyscott.id.au/2012/10/31/Storing-config-settings-for-modules-etc-for-use-in-ContentBox

Luis–

Thanks for the suggestion. I’ll give it a try and report back my results :slight_smile:

Thanks!

Hi Andrew–

First, thanks for pointing me to your blog post–nice write up on that!

I was originally planning on just using the settings as you outlined (including the serialization of my settings structure), but the way I was implementing it was starting to feel really dirty–I had multiple records in the settings table, each storing individual configuration data for each record, and none of them “settings”-ish…clearly beyond the scope of what that table is intended for :slight_smile:

So, I’m going to keep plugging away to try to find a good way of publishing this module in a somewhat easy way to install.