Patch #31498

Add redmine_plugin_migration generator

Added by Kouhei Sutou 3 months ago. Updated 2 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Plugin API
Target version:4.1.0

Description

Redmine provides redmine_plugin_model generator. It's similar to model generator by Rails but for Redmine plugin. It's useful to add a new model to Redmine plugin.

But Redmine doesn't provide redmine_plugin_migration generator. It's similar to migration generator by Rails but for Redmine plugin. It's useful to improve existing models in Redmine plugin.

We need to create a migration file for Redmine plugin by hand without redmine_plugin_migration.

The attached patch implements redmine_plugin_migration generator. It only has the minimal features:

  • Assign a new migration version.
  • Just create a migration file that only has empty change method.

The migration generator by Rails has more features:

I think that minimum implementation is a good starting point.

This implementation uses the framework for migration provided by Rails: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/migration.rb

add-redmine-plugin-migration-generator.diff Magnifier (1.84 KB) Kouhei Sutou, 2019-06-02 23:49

add-redmine-plugin-migration-generator-v2.diff Magnifier (1.8 KB) Kouhei Sutou, 2019-06-03 07:09

Associated revisions

Revision 18223
Added by Go MAEDA 2 months ago

Add redmine_plugin_migration generator (#31498).

Patch by Kouhei Sutou.

History

#1 Updated by Go MAEDA 3 months ago

  • Target version set to Candidate for next major release

#2 Updated by vzvu 3k6k 3 months ago

I think that minimum implementation is a good starting point.

+1, nice work!

This is a minute thing but `plugin_pretty_name` declared in line 16 of redmine_plugin_migration_generator.rb is not used so far and probably can be safely removed.

#3 Updated by Kouhei Sutou 3 months ago

Good catch.
I've updated the patch.

#4 Updated by Go MAEDA 3 months ago

  • Target version changed from Candidate for next major release to 4.1.0

Setting the target version to 4.1.0.

#5 Updated by Go MAEDA 2 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch. Thank you.

Also available in: Atom PDF