alterity 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf1aafe98960046d356a7f82baa19dca7a2160ec58fa48a93da12ebd12794d16
4
- data.tar.gz: 4793526689c37e33673aab4e0a8b570445fd78b369c0edbe382cf9e9aa078a97
3
+ metadata.gz: 20a0079693908430f136c8f85839cdfa2a39872a4ec021a9014b5fd8bf27c493
4
+ data.tar.gz: 388fcc530f490f858e344eaf2a24e1287b275cae3b33739ced28b7a1a8a42d9f
5
5
  SHA512:
6
- metadata.gz: 0dfad0d6f235e3fb8da9cc0074015298261532d9f1da903cc47d73fb776d13c6efe77c7847f59f4be2286292240a2473165b8e7b756c41a1935691b13e8db10a
7
- data.tar.gz: b931b6805769dcc0ae2c9fbeddb25036e3aca3cb8bb1ad194a3b5265fb7ae9fc895f43223b3b5409e7367db69ff40f07dff5bc881bc294733e220f66abe9ddad
6
+ metadata.gz: '095a935c8a09050ddfe41c0b149c167a9264d9f343260c06501717fe54fabd31cdb134634db009db13468efbe7f88ccff120889095e854edf2295f9523d15bc1'
7
+ data.tar.gz: 701b4b23a3478f4b8c3302371b41f5b70acbea0410e2dc5b5430ad88dd97f80926d211ea11f821cb43f4f33d6e66a14163e14fe7e94d85a3f9825d294b9b1fc1
data/lib/alterity.rb CHANGED
@@ -8,6 +8,8 @@ require "alterity/railtie"
8
8
  class Alterity
9
9
  class << self
10
10
  def process_sql_query(sql, &block)
11
+ return block.call if state.disabled
12
+
11
13
  case sql.tr("\n", " ").strip
12
14
  when /^alter\s+table\s+(?<table>.+?)\s+(?<updates>.+)/i
13
15
  table = $~[:table]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Alterity
4
- VERSION = "1.4.0"
4
+ VERSION = "1.4.1"
5
5
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddYetAnotherColorToShirts < ActiveRecord::Migration[6.1]
4
+ def up
5
+ Alterity.disable do
6
+ add_column :shirts, :color3, :string
7
+ end
8
+ end
9
+ end
@@ -69,3 +69,9 @@ ruby ../spec/bin/test_custom_config_result.rb
69
69
 
70
70
  # Also testing what's in replicas_dsns, also checking that master was detected and removed.
71
71
  bundle e rails runner 'res=ActiveRecord::Base.connection.execute("select dsn from percona.replicas_dsns").to_a.flatten;p(res); res == ["h=host1,P=3306", "h=host2,P=3306"] || exit(1)'
72
+
73
+ rm /tmp/custom_command_result.txt
74
+ cp ../spec/bin/disabled_migration.rb db/migrate/20210728182628_add_yet_another_color_to_shirts.rb
75
+ bundle e rails db:migrate --trace
76
+ bundle e rails runner 'Shirt.columns.map(&:name).include?("color3") || exit(1)'
77
+ ruby ../spec/bin/test_disabled_state.rb
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ if File.exist?("/tmp/custom_command_result.txt")
4
+ puts "=> disabled state does not work"
5
+ exit(1)
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alterity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Maximin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-14 00:00:00.000000000 Z
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -53,8 +53,10 @@ files:
53
53
  - lib/alterity/version.rb
54
54
  - spec/alterity_spec.rb
55
55
  - spec/bin/custom_config.rb
56
+ - spec/bin/disabled_migration.rb
56
57
  - spec/bin/rails_app_migration_test.sh
57
58
  - spec/bin/test_custom_config_result.rb
59
+ - spec/bin/test_disabled_state.rb
58
60
  - spec/spec_helper.rb
59
61
  homepage: https://github.com/gumroad/alterity
60
62
  licenses:
@@ -85,6 +87,8 @@ summary: Execute your ActiveRecord migrations with Percona's pt-online-schema-ch
85
87
  test_files:
86
88
  - spec/alterity_spec.rb
87
89
  - spec/bin/custom_config.rb
90
+ - spec/bin/disabled_migration.rb
88
91
  - spec/bin/rails_app_migration_test.sh
89
92
  - spec/bin/test_custom_config_result.rb
93
+ - spec/bin/test_disabled_state.rb
90
94
  - spec/spec_helper.rb