From c0b82b80fbb74e1b16469ab84cd76657007acfa3 Mon Sep 17 00:00:00 2001 From: David Copeland Date: Sun, 9 Jul 2017 12:42:03 -0400 Subject: [PATCH] use Rails 5 migrations format --- .../generator_files/db/migrate/add_enabled_to_api_clients.rb | 4 ++++ lib/stitches/generator_files/db/migrate/create_api_clients.rb | 4 ++++ .../generator_files/db/migrate/enable_uuid_ossp_extension.rb | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb b/lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb index 5388ad5..b1a323b 100644 --- a/lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb +++ b/lib/stitches/generator_files/db/migrate/add_enabled_to_api_clients.rb @@ -1,4 +1,8 @@ +<% if Rails::VERSION::MAJOR >= 5 %> +class AddEnabledToApiClients < ActiveRecord::Migration[<%= Rails::VERSION::MAJOR %>.<%= Rails::VERSION::MINOR %>] +<% else %> class AddEnabledToApiClients < ActiveRecord::Migration +<% end %> def change add_column :api_clients, :enabled, :bool, null: false, default: true remove_index :api_clients, [:name ] # existing one would be unique diff --git a/lib/stitches/generator_files/db/migrate/create_api_clients.rb b/lib/stitches/generator_files/db/migrate/create_api_clients.rb index e94ab51..7756103 100644 --- a/lib/stitches/generator_files/db/migrate/create_api_clients.rb +++ b/lib/stitches/generator_files/db/migrate/create_api_clients.rb @@ -1,4 +1,8 @@ +<% if Rails::VERSION::MAJOR >= 5 %> +class CreateApiClients < ActiveRecord::Migration[<%= Rails::VERSION::MAJOR %>.<%= Rails::VERSION::MINOR %>] +<% else %> class CreateApiClients < ActiveRecord::Migration +<% end %> def change create_table :api_clients do |t| t.string :name, null: false diff --git a/lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb b/lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb index e5d5bd9..4f8d922 100644 --- a/lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb +++ b/lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb @@ -1,4 +1,8 @@ +<% if Rails::VERSION::MAJOR >= 5 %> +class EnableUuidOsspExtension < ActiveRecord::Migration[<%= Rails::VERSION::MAJOR %>.<%= Rails::VERSION::MINOR %>] +<% else %> class EnableUuidOsspExtension < ActiveRecord::Migration +<% end %> def change enable_extension 'uuid-ossp' end