ckan / ideas

[DEPRECATED] Use the main CKAN repo Discussions instead:
https://github.com/ckan/ckan/discussions
40 stars 2 forks source link

Implement a CKAN plugin for database table creation #19

Open rossjones opened 10 years ago

rossjones commented 10 years ago

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?).

rossjones commented 10 years ago

Also, migrations.

rufuspollock commented 10 years ago

Big +1 esp re migrations

davidread commented 10 years ago

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.

shasan-marsdd commented 5 years ago

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.