Skip to content
Snippets Groups Projects
Commit 175368c2 authored by ydakuka's avatar ydakuka
Browse files

specify rails version

parent 977e4a4e
No related branches found
No related tags found
No related merge requests found
require 'rails/generators/migration'
require 'generators/geocoder/migration_version'
module Geocoder
module Generators
module Maxmind
class GeoliteCityGenerator < Rails::Generators::Base
include Rails::Generators::Migration
include Generators::MigrationVersion
source_root File.expand_path('../templates', __FILE__)
......
require 'rails/generators/migration'
require 'generators/geocoder/migration_version'
module Geocoder
module Generators
module Maxmind
class GeoliteCountryGenerator < Rails::Generators::Base
include Rails::Generators::Migration
include Generators::MigrationVersion
source_root File.expand_path('../templates', __FILE__)
......
class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration
class GeocoderMaxmindGeoliteCity < ActiveRecord::Migration<%= migration_version %>
def self.up
create_table :maxmind_geolite_city_blocks, id: false do |t|
t.column :start_ip_num, :bigint, null: false
......
class GeocoderMaxmindGeoliteCountry < ActiveRecord::Migration
class GeocoderMaxmindGeoliteCountry < ActiveRecord::Migration<%= migration_version %>
def self.up
create_table :maxmind_geolite_country, id: false do |t|
t.column :start_ip, :string
......
module Geocoder
module Generators
module MigrationVersion
def rails_5?
Rails::VERSION::MAJOR == 5
end
def migration_version
if rails_5?
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end
end
end
end
end
# CreateTestSchema creates the tables used in test_helper.rb
class CreateTestSchema < ActiveRecord::Migration
superclass = ActiveRecord::Migration
# TODO: Inherit from the 5.0 Migration class directly when we drop support for Rails 4.
superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[])
class CreateTestSchema < superclass
def self.up
[
:places,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment