Skip to content

Commit

Permalink
Merge 3c50b4c into 2120025
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Sep 19, 2022
2 parents 2120025 + 3c50b4c commit 4003ba5
Show file tree
Hide file tree
Showing 25 changed files with 74 additions and 183 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Expand Up @@ -23,17 +23,15 @@ jobs:
fail-fast: false
matrix:
ruby:
- "2.7"
- "3.0"
- "3.1"
- "2.7.6"
- "3.0.4"
- "3.1.2"
env:
- MYSQL56=1
- MYSQL57=1
- MYSQL80=1
- POSTGRESQL=1
gemfile:
- gemfiles/activerecord_5.1.gemfile
- gemfiles/activerecord_5.2.gemfile
- gemfiles/activerecord_6.0.gemfile
- gemfiles/activerecord_6.1.gemfile
- gemfiles/activerecord_7.0.gemfile
Expand Down
15 changes: 3 additions & 12 deletions Appraisals
@@ -1,22 +1,13 @@
# frozen_string_literal: true

appraise 'activerecord-5.1' do
gem 'activerecord', '~> 5.1.0'
end

appraise 'activerecord-5.2' do
gem 'activerecord', '~> 5.2.0'
gem 'mysql2', '~> 0.4.4'
end

appraise 'activerecord-6.0' do
gem 'activerecord', '~> 6.0.0'
gem 'activerecord', '~> 6.0.6'
end

appraise 'activerecord-6.1' do
gem 'activerecord', '~> 6.1.0'
gem 'activerecord', '~> 6.1.7'
end

appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
gem 'activerecord', '~> 7.0.4'
end
6 changes: 3 additions & 3 deletions docker-compose.yml
@@ -1,19 +1,19 @@
version: "3.8"
services:
mysql:
image: "mysql:5.6"
image: "mysql:5.6.51"
ports:
- "13316:3306"
environment:
MYSQL_ROOT_PASSWORD: password
mysql57:
image: "mysql:5.7"
image: "mysql:5.7.39"
ports:
- "13317:3306"
environment:
MYSQL_ROOT_PASSWORD: password
mysql80:
image: "mysql:8.0"
image: "mysql:8.0.30"
ports:
- "13318:3306"
environment:
Expand Down
7 changes: 0 additions & 7 deletions gemfiles/activerecord_5.1.gemfile

This file was deleted.

8 changes: 0 additions & 8 deletions gemfiles/activerecord_5.2.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/activerecord_6.0.gemfile
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "activerecord", "~> 6.0.0"
gem "activerecord", "~> 6.0.6"

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/activerecord_6.1.gemfile
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "activerecord", "~> 6.1.0"
gem "activerecord", "~> 6.1.7"

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/activerecord_7.0.gemfile
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "activerecord", "~> 7.0.0"
gem "activerecord", "~> 7.0.4"

gemspec path: "../"
8 changes: 4 additions & 4 deletions spec/mysql/_migrate/migrate_change_table_option_spec.rb
Expand Up @@ -18,9 +18,9 @@
erbh(<<-ERB)
create_table "employees", primary_key: "emp_no", force: :cascade, <%= i cond(">= 6.1", { charset: "ascii" }, { options: "ENGINE=InnoDB DEFAULT CHARSET=ascii" }) %> do |t|
t.date "birth_date", null: false
t.string "first_name", limit: 14, null: false, <%= i cond('>= 5.2', collation: "utf8_general_ci") %>
t.string "last_name", limit: 16, null: false, <%= i cond('>= 5.2', collation: "utf8_general_ci") %>
t.string "gender", limit: 1, null: false, <%= i cond('>= 5.2', collation: "utf8_general_ci") %>
t.string "first_name", limit: 14, null: false, collation: "utf8_general_ci"
t.string "last_name", limit: 16, null: false, collation: "utf8_general_ci"
t.string "gender", limit: 1, null: false, collation: "utf8_general_ci"
t.date "hire_date", null: false
end
ERB
Expand All @@ -34,7 +34,7 @@
expect(delta.differ?).to be_truthy
expect(subject.dump).to match_ruby actual_dsl
delta.migrate
expect(subject.dump).to match_ruby expected_dsl
expect(subject.dump.gsub('utf8mb3_general_ci', 'utf8_general_ci')).to match_ruby expected_dsl
}
end
end
11 changes: 2 additions & 9 deletions spec/mysql/collation/collation_spec.rb
Expand Up @@ -54,7 +54,7 @@
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
t.text "text", null: false, collation: nil
end
ERB
end
Expand All @@ -67,7 +67,7 @@
expect(delta.differ?).to be_truthy
expect(subject.dump).to match_ruby actual_dsl
delta.migrate
expect(subject.dump).to match_ruby expected_dsl
expect(subject.dump).to match_ruby expected_dsl.gsub(', collation: nil', '') # for AR 7.0.4
end
end

Expand Down Expand Up @@ -137,13 +137,6 @@

opts = ['--dump-without-table-options']
out, status = run_ridgepole('--diff', "'#{JSON.dump(conn_spec)}'", f.path, *opts)

# v6.0.3 is the oldest version that doesn't produce any kwargs warnings with Ruby 2.7
if condition('< 6.0.3')
# https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18
out = out.lines.grep_v(/: warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z/).join # rubocop:disable Layout/LineLength
end

expect(out).to be_empty
expect(status.success?).to be_truthy
end
Expand Down
3 changes: 0 additions & 3 deletions spec/mysql/diff/diff2_spec.rb
Expand Up @@ -168,9 +168,6 @@

subject { Ridgepole::Client }

# XXX: for AR 5.1
before { client }

it {
delta = subject.diff(actual_dsl, expected_dsl)
expect(delta.differ?).to be_truthy
Expand Down
3 changes: 0 additions & 3 deletions spec/mysql/diff/diff_spec.rb
Expand Up @@ -142,9 +142,6 @@

subject { Ridgepole::Client }

# XXX: for AR 5.1
before { client }

it {
delta = subject.diff(actual_dsl, expected_dsl)
expect(delta.differ?).to be_truthy
Expand Down
4 changes: 0 additions & 4 deletions spec/mysql/dump/dump_class_method_spec.rb
Expand Up @@ -45,11 +45,7 @@
t.date "birth_date", null: false
t.string "first_name", limit: 14, null: false
t.string "last_name", limit: 16, null: false
<%- if condition('< 6.0.0.beta2') -%>
t.string "gender", limit: 1, null: false
<%- else -%>
t.column "gender", "enum('M','F')", null: false
<%- end -%>
t.date "hire_date", null: false
end
Expand Down
8 changes: 0 additions & 8 deletions spec/mysql/dump/dump_some_tables_spec.rb
Expand Up @@ -11,11 +11,7 @@
t.date "birth_date", null: false
t.string "first_name", limit: 14, null: false
t.string "last_name", limit: 16, null: false
<%- if condition('< 6.0.0.beta2') -%>
t.string "gender", limit: 1, null: false
<%- else -%>
t.column "gender", "enum('M','F')", null: false
<%- end -%>
t.date "hire_date", null: false
end
Expand Down Expand Up @@ -49,11 +45,7 @@
t.date "birth_date", null: false
t.string "first_name", limit: 14, null: false
t.string "last_name", limit: 16, null: false
<%- if condition('< 6.0.0.beta2') -%>
t.string "gender", limit: 1, null: false
<%- else -%>
t.column "gender", "enum('M','F')", null: false
<%- end -%>
t.date "hire_date", null: false
end
Expand Down
4 changes: 0 additions & 4 deletions spec/mysql/dump/dump_spec.rb
Expand Up @@ -45,11 +45,7 @@
t.date "birth_date", null: false
t.string "first_name", limit: 14, null: false
t.string "last_name", limit: 16, null: false
<%- if condition('< 6.0.0.beta2') -%>
t.string "gender", limit: 1, null: false
<%- else -%>
t.column "gender", "enum('M','F')", null: false
<%- end -%>
t.date "hire_date", null: false
end
Expand Down
4 changes: 2 additions & 2 deletions spec/mysql/json/change_json_column_spec.rb
Expand Up @@ -82,7 +82,7 @@
erbh(<<-ERB)
create_table "books", force: :cascade do |t|
t.string "title", null: false
t.json "attrs", null: false
t.json "attrs", null: false, collation: nil
t.index ["title"], name: "index_books_on_title"
end
ERB
Expand All @@ -96,7 +96,7 @@
expect(delta.differ?).to be_truthy
expect(subject.dump).to match_ruby actual_dsl
delta.migrate
expect(subject.dump).to match_ruby expected_dsl
expect(subject.dump).to match_ruby expected_dsl.gsub(', collation: nil', '') # for AR 7.0.4
}
end
end
2 changes: 1 addition & 1 deletion spec/mysql/migrate/migrate_change_column7_spec.rb
Expand Up @@ -10,7 +10,7 @@
t.integer "emp_no_bigint6", limit: 6, null: false
t.integer "emp_no_bigint7", limit: 7, null: false
t.integer "emp_no_bigint8", limit: 8, null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand Down
24 changes: 12 additions & 12 deletions spec/mysql/migrate/migrate_change_column_default_spec.rb
Expand Up @@ -6,7 +6,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", default: 0, null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -17,7 +17,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", limit: 4, null: true
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -28,7 +28,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no"
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -52,7 +52,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", default: 0, null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -63,7 +63,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -87,7 +87,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", default: 0, null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -108,7 +108,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", default: 0, null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -119,7 +119,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", limit: 4, default: 0, null: true
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -130,7 +130,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", default: 0
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -154,7 +154,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", default: 0
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -165,7 +165,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand All @@ -176,7 +176,7 @@
erbh(<<-ERB)
create_table "salaries", id: false, force: :cascade do |t|
t.integer "emp_no", null: false
t.float "salary", <%= i cond('< 5.2.0.beta2', limit: 24) %>, null: false
t.float "salary", null: false
t.date "from_date", null: false
t.date "to_date", null: false
end
Expand Down
10 changes: 1 addition & 9 deletions spec/mysql/migrate/migrate_change_column_float_spec.rb
Expand Up @@ -29,15 +29,7 @@

it {
delta = subject.diff(expected_dsl)

if condition('< 5.2.0.beta2')
expect(delta.differ?).to be_truthy
expect(subject.dump).to match_ruby actual_dsl
delta.migrate
expect(subject.dump).to match_ruby actual_dsl
else
expect(delta.differ?).to be_falsy
end
expect(delta.differ?).to be_falsy
}
end

Expand Down

0 comments on commit 4003ba5

Please sign in to comment.