mirror of
https://github.com/plashchynski/crono.git
synced 2026-07-07 21:35:08 +02: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
|
def create_migrations
|
||||||
migration_template 'migrations/create_crono_jobs.rb',
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class CreateCronoJobs < ActiveRecord::Migration
|
class CreateCronoJobs < ActiveRecord::Migration<%= migration_version %>
|
||||||
def self.up
|
def change
|
||||||
create_table :crono_jobs do |t|
|
create_table :crono_jobs do |t|
|
||||||
t.string :job_id, null: false
|
t.string :job_id, null: false
|
||||||
t.text :log, limit: 1073741823 # LONGTEXT for MySQL
|
t.text :log, limit: 1073741823 # LONGTEXT for MySQL
|
||||||
@@ -9,8 +9,4 @@ class CreateCronoJobs < ActiveRecord::Migration
|
|||||||
end
|
end
|
||||||
add_index :crono_jobs, [:job_id], unique: true
|
add_index :crono_jobs, [:job_id], unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
|
||||||
drop_table :crono_jobs
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user