Skip to content

Commit

Permalink
Merge pull request #48 from stitchfix/rails-5-migrations
Browse files Browse the repository at this point in the history
use Rails 5 migrations format
  • Loading branch information
davetron5000 authored Aug 24, 2017
2 parents 968f45a + c0b82b8 commit f71604d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/stitches/generator_files/db/migrate/create_api_clients.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f71604d

Please sign in to comment.