Open rossjones opened 10 years ago
Also, migrations.
Big +1 esp re migrations
I think it would be useful to follow the methods provided by sqlalchemy-migrate, but allow you to specify the extension name.
I imagine it would need only a few of the commands seen in migrate.versioning.api https://sqlalchemy-migrate.readthedocs.org/en/latest/api.html#module-migrate.versioning :
We'd need a table to store the current version numbers for each extension.
Then, since the core ckan tables are created when you do 'paster db create' or 'paster db upgrade', we could just include the extension tables in these commands too. It would look to see which extensions had one of these new 'table' plugins enabled and do create/upgrade on the particular tables. There is already the requirement on the administrator to run 'paster db upgrade' every time core ckan is upgraded, so it makes sense to have the same command for extension upgrades too, or indeed when a new extension is enabled.
I guess this isn't a big priority. I am running into the same thing here. I guess I'll create a paster command for now.
When writing a CKAN extension, new database tables are often required, which involves bypassing the toolkit and creating the models yourself, and installing them either with a paster command or at startup time during config.
It would be nicer if CKAN had a plugin that could be implemented and have the tables created by a ckan paster command (paster db install-plugins?).