mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-19 16:21:36 +01:00
Merge pull request #66 from redrick/master
Add migration version for Rails 5 and above
This commit is contained in:
@@ -21,7 +21,18 @@ module Crono
|
||||
|
||||
def create_migrations
|
||||
migration_template 'migrations/create_crono_jobs.rb',
|
||||
'db/migrate/create_crono_jobs.rb'
|
||||
'db/migrate/create_crono_jobs.rb',
|
||||
migration_version: migration_version
|
||||
end
|
||||
|
||||
def rails5?
|
||||
Rails.version.start_with? '5'
|
||||
end
|
||||
|
||||
def migration_version
|
||||
if rails5?
|
||||
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CreateCronoJobs < ActiveRecord::Migration
|
||||
def self.up
|
||||
class CreateCronoJobs < ActiveRecord::Migration<%= migration_version %>
|
||||
def change
|
||||
create_table :crono_jobs do |t|
|
||||
t.string :job_id, null: false
|
||||
t.text :log, limit: 1073741823 # LONGTEXT for MySQL
|
||||
@@ -9,8 +9,4 @@ class CreateCronoJobs < ActiveRecord::Migration
|
||||
end
|
||||
add_index :crono_jobs, [:job_id], unique: true
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :crono_jobs
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user