cookpad / kuroko2

Kuroko2 is a web-based job scheduler / workflow engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rails new faild: Directly inheriting from ActiveRecord::Migration is not supported.

shigemk2 opened this issue · comments

Environment

  • Ubuntu 17.04
  • Ruby 2.4.0p0
  • rails 5.1.0

Overview

When I create new kuroko2 application using this command,

$ rails new your_kuroko2_application --database=mysql --skip-turbolinks --skip-javascript -m https://raw.githubusercontent.com/cookpad/kuroko2/master/app_template.rb

I occurred this error log.

Created database 'your_kuroko2_application_development'
Created database 'your_kuroko2_application_test'
        rake    db:migrate
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateJobDefinitions < ActiveRecord::Migration[4.2]
/path/to/your_kuroko2_application/db/migrate/20170508170549_create_job_definitions.kuroko2.rb:2:in `<top (required)>'
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateJobDefinitions < ActiveRecord::Migration[4.2]
/path/to/your_kuroko2_application/db/migrate/20170508170549_create_job_definitions.kuroko2.rb:2:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
  ============================================================================
  Kuroko2 application is now installed and mounts at '/'
============================================================================

I can fix this error fixing ActiveRecord::Migration to ActiveRecord::Migration[5.1], but this correction depends on rails command version in local.

Should I send a pull-request? Or could you tell me how to avoid this error?

Unfortunately, kuroko 2 does not currently support Rails 5.1. Please use 5.0.2.

Related WIP PR is #56

@shigemk2
Thank you for the report.
Please use kuroko2 v0.4.0 that supports Rails 5.1.

Thank you for your comments and pull-requests.

I was able to create kuroko2 application with v0.4.0.

But I have a question. All ActiveRecord::Migration were changed to ActiveRecord::Migration[5.0] and 5.0 means rails version.

I am wondering why I was able to create kuroko2 application not with rails 5.0 but with 5.1.

@shigemk2

See ActiveRecord CHANGELOG for details.

Version the API presented to migration classes, so we can change parameter defaults without breaking existing migrations, or forcing them to be rewritten through a deprecation cycle.

And Kuroko2 v0.4.0 still supports Rails 5.0.

Thank you so much!