-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Genki Sugawara
committed
Jan 9, 2015
1 parent
3876d4c
commit b4606d2
Showing
15 changed files
with
383 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,7 @@ rvm: | |
script: | ||
- bundle install | ||
- bundle exec rake | ||
env: | ||
matrix: | ||
- ENABLE_MYSQL_AWESOME=0 | ||
- ENABLE_MYSQL_AWESOME=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'active_record/connection_adapters/abstract/schema_definitions' | ||
|
||
# XXX: https://github.com/waka/activerecord-mysql-unsigned/blob/v0.3.1/lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract/schema_definitions.rb#L14 | ||
class ActiveRecord::ConnectionAdapters::TableDefinition | ||
def primary_key(name, type = :primary_key, options = {}) | ||
column(name, type, options.merge(primary_key: true).reverse_merge(unsigned: true)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Ridgepole | ||
VERSION = '0.5.1' | ||
VERSION = '0.5.2.beta' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
if mysql_awesome_enabled? | ||
describe 'Ridgepole::Client#diff -> migrate' do | ||
context 'when change column (add collation)' do | ||
let(:actual_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false | ||
t.text "text", null: false | ||
end | ||
RUBY | ||
} | ||
|
||
let(:expected_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false, collation: "ascii_bin" | ||
t.text "text", null: false, collation: "utf8mb4_bin" | ||
end | ||
RUBY | ||
} | ||
|
||
before { subject.diff(actual_dsl).migrate } | ||
subject { client } | ||
|
||
it { | ||
delta = subject.diff(expected_dsl) | ||
expect(delta.differ?).to be_truthy | ||
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip | ||
delta.migrate | ||
expect(subject.dump).to eq expected_dsl.strip_heredoc.strip | ||
} | ||
end | ||
|
||
context 'when change column (delete collation)' do | ||
let(:actual_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false, collation: "ascii_bin" | ||
t.text "text", null: false, collation: "utf8mb4_bin" | ||
end | ||
RUBY | ||
} | ||
|
||
let(:expected_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false | ||
t.text "text", null: false | ||
end | ||
RUBY | ||
} | ||
|
||
before { subject.diff(actual_dsl).migrate } | ||
subject { client } | ||
|
||
it { | ||
delta = subject.diff(expected_dsl) | ||
expect(delta.differ?).to be_truthy | ||
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip | ||
delta.migrate | ||
expect(subject.dump).to eq expected_dsl.strip_heredoc.strip | ||
} | ||
end | ||
|
||
context 'when change column (change collation)' do | ||
let(:actual_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false, collation: "ascii_bin" | ||
t.text "text", null: false, collation: "utf8mb4_bin" | ||
end | ||
RUBY | ||
} | ||
|
||
let(:expected_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false, collation: "utf8mb4_bin" | ||
t.text "text", null: false, collation: "ascii_bin" | ||
end | ||
RUBY | ||
} | ||
|
||
before { subject.diff(actual_dsl).migrate } | ||
subject { client } | ||
|
||
it { | ||
delta = subject.diff(expected_dsl) | ||
expect(delta.differ?).to be_truthy | ||
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip | ||
delta.migrate | ||
expect(subject.dump).to eq expected_dsl.strip_heredoc.strip | ||
} | ||
end | ||
|
||
context 'when change column (no change collation)' do | ||
let(:actual_dsl) { | ||
<<-RUBY | ||
create_table "employee_clubs", force: true do |t| | ||
t.integer "emp_no", null: false | ||
t.integer "club_id", null: false, unsigned: true | ||
t.string "string", null: false, collation: "ascii_bin" | ||
t.text "text", null: false, collation: "utf8mb4_bin" | ||
end | ||
RUBY | ||
} | ||
|
||
before { subject.diff(actual_dsl).migrate } | ||
subject { client } | ||
|
||
it { | ||
delta = subject.diff(actual_dsl) | ||
expect(delta.differ?).to be_falsey | ||
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip | ||
delta.migrate | ||
expect(subject.dump).to eq actual_dsl.strip_heredoc.strip | ||
} | ||
end | ||
end | ||
end |
Oops, something went wrong.