Error when migrating crono migration #62

Closed
opened 2025-12-29 00:22:06 +01:00 by adam · 3 comments
Owner

Originally created by @ferdi2005 on GitHub (Aug 11, 2019).

rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

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

class CreateCronoJobs < ActiveRecord::Migration[4.2]

Originally created by @ferdi2005 on GitHub (Aug 11, 2019). rails aborted! StandardError: An error has occurred, this and all later migrations canceled: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for: class CreateCronoJobs < ActiveRecord::Migration[4.2]
adam closed this issue 2025-12-29 00:22:06 +01:00
Author
Owner

@alliedarmour commented on GitHub (Oct 20, 2019):

Just replace the [4.2] with the version you are using, in my case it's [6.0]

@alliedarmour commented on GitHub (Oct 20, 2019): Just replace the [4.2] with the version you are using, in my case it's [6.0]
Author
Owner

@ClikeX commented on GitHub (Aug 13, 2020):

The issue here wasn't the [4.2]. It's the fact that Crono's generated migration doesn't have the version tag in it at all.

My migration came like this

class CreateCronoJobs < ActiveRecord::Migration
  def self.up
    create_table :crono_jobs do |t|
      t.string :job_id, null: false
      t.text :log, limit: 1073741823 # LONGTEXT for MySQL
      t.datetime :last_performed_at
      t.boolean :healthy
      t.timestamps null: false
    end
    add_index :crono_jobs, [:job_id], unique: true
  end

  def self.down
    drop_table :crono_jobs
  end
end

Naturally, this is easily fixed by hand. But I think the generator should already be doing this. Since this structure has been standard for a while now.

@ClikeX commented on GitHub (Aug 13, 2020): The issue here wasn't the [4.2]. It's the fact that Crono's generated migration doesn't have the version tag in it at all. My migration came like this ```ruby class CreateCronoJobs < ActiveRecord::Migration def self.up create_table :crono_jobs do |t| t.string :job_id, null: false t.text :log, limit: 1073741823 # LONGTEXT for MySQL t.datetime :last_performed_at t.boolean :healthy t.timestamps null: false end add_index :crono_jobs, [:job_id], unique: true end def self.down drop_table :crono_jobs end end ``` Naturally, this is easily fixed by hand. But I think the generator should already be doing this. Since this structure has been standard for a while now.
Author
Owner

@plashchynski commented on GitHub (May 30, 2022):

Fixed in the new version of the gem (2.0.0)

@plashchynski commented on GitHub (May 30, 2022): Fixed in the new version of the gem (2.0.0)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/crono#62