departure 6.8.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +5 -6
- data/.rubocop.yml +1 -1
- data/Appraisals +8 -10
- data/CHANGELOG.md +15 -1
- data/Dockerfile +4 -11
- data/Gemfile +1 -0
- data/Gemfile.lock +91 -75
- data/README.md +102 -0
- data/Rakefile +1 -0
- data/config.yml.erb +8 -4
- data/departure.gemspec +4 -4
- data/docker-compose.yml +4 -0
- data/gemfiles/rails_7_2.gemfile +12 -6
- data/gemfiles/rails_7_2.gemfile.lock +96 -59
- data/gemfiles/rails_8_0.gemfile +16 -0
- data/gemfiles/rails_8_0.gemfile.lock +314 -0
- data/gemfiles/rails_8_1.gemfile +15 -0
- data/gemfiles/rails_8_1.gemfile.lock +316 -0
- data/lib/active_record/connection_adapters/for_alter.rb +4 -17
- data/lib/active_record/connection_adapters/rails_8_0_departure_adapter.rb +297 -0
- data/lib/active_record/connection_adapters/rails_8_1_departure_adapter.rb +83 -0
- data/lib/departure/db_client.rb +52 -0
- data/lib/departure/migration.rb +1 -5
- data/lib/departure/rails_adapter.rb +99 -39
- data/lib/departure/rails_patches/active_record_migrator_with_advisory_lock_patch.rb +2 -2
- data/lib/departure/runner.rb +14 -1
- data/lib/departure/version.rb +1 -1
- data/lib/departure.rb +1 -0
- data/lib/lhm/column_with_sql.rb +6 -5
- metadata +17 -44
- data/gemfiles/rails_6_1.gemfile +0 -10
- data/gemfiles/rails_6_1.gemfile.lock +0 -243
- data/gemfiles/rails_7_0.gemfile +0 -10
- data/gemfiles/rails_7_0.gemfile.lock +0 -242
- data/gemfiles/rails_7_1.gemfile +0 -10
- data/gemfiles/rails_7_1.gemfile.lock +0 -274
- data/lib/active_record/connection_adapters/percona_adapter.rb +0 -186
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
|
2
|
+
require 'active_record/connection_adapters/mysql2_adapter'
|
|
3
|
+
require 'active_record/connection_adapters/patch_connection_handling'
|
|
4
|
+
require 'departure'
|
|
5
|
+
require 'forwardable'
|
|
6
|
+
|
|
7
|
+
module ActiveRecord
|
|
8
|
+
module ConnectionAdapters
|
|
9
|
+
class Rails81DepartureAdapter < ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
|
10
|
+
TYPE_MAP = Type::TypeMap.new.tap { |m| initialize_type_map(m) } if defined?(initialize_type_map)
|
|
11
|
+
|
|
12
|
+
class Column < ActiveRecord::ConnectionAdapters::MySQL::Column
|
|
13
|
+
def adapter
|
|
14
|
+
Rails81DepartureAdapter
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# https://github.com/departurerb/departure/commit/f178ca26cd3befa1c68301d3b57810f8cdcff9eb
|
|
19
|
+
# For `DROP FOREIGN KEY constraint_name` with pt-online-schema-change requires specifying `_constraint_name`
|
|
20
|
+
# rather than the real constraint_name due to to a limitation in MySQL
|
|
21
|
+
# pt-online-schema-change adds a leading underscore to foreign key constraint names when creating the new table.
|
|
22
|
+
# https://www.percona.com/blog/2017/03/21/dropping-foreign-key-constraint-using-pt-online-schema-change-2/
|
|
23
|
+
class SchemaCreation < ActiveRecord::ConnectionAdapters::MySQL::SchemaCreation
|
|
24
|
+
def visit_DropForeignKey(name) # rubocop:disable Naming/MethodName
|
|
25
|
+
fk_name =
|
|
26
|
+
if name =~ /^__(.+)/
|
|
27
|
+
Regexp.last_match(1)
|
|
28
|
+
else
|
|
29
|
+
"_#{name}"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
"DROP FOREIGN KEY #{fk_name}"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
extend Forwardable
|
|
37
|
+
|
|
38
|
+
include ForAlterStatements unless method_defined?(:change_column_for_alter)
|
|
39
|
+
|
|
40
|
+
ADAPTER_NAME = 'Percona'.freeze
|
|
41
|
+
|
|
42
|
+
def self.new_client(config)
|
|
43
|
+
original_client = super
|
|
44
|
+
|
|
45
|
+
Departure::DbClient.new(config, original_client)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# add_index is modified from the underlying mysql adapter implementation to ensure we add ALTER TABLE to it
|
|
49
|
+
def add_index(table_name, column_name, options = {})
|
|
50
|
+
index_definition, = add_index_options(table_name, column_name, **options)
|
|
51
|
+
execute <<-SQL.squish
|
|
52
|
+
ALTER TABLE #{quote_table_name(index_definition.table)}
|
|
53
|
+
ADD #{schema_creation.accept(index_definition)}
|
|
54
|
+
SQL
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# remove_index is modified from the underlying mysql adapter implementation to ensure we add ALTER TABLE to it
|
|
58
|
+
def remove_index(table_name, column_name = nil, **options)
|
|
59
|
+
return if options[:if_exists] && !index_exists?(table_name, column_name, **options)
|
|
60
|
+
|
|
61
|
+
index_name = index_name_for_remove(table_name, column_name, options)
|
|
62
|
+
|
|
63
|
+
execute "ALTER TABLE #{quote_table_name(table_name)} DROP INDEX #{quote_column_name(index_name)}"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def schema_creation
|
|
67
|
+
SchemaCreation.new(self)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
attr_reader :mysql_adapter
|
|
73
|
+
|
|
74
|
+
# rubocop:disable Metrics/ParameterLists
|
|
75
|
+
def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch: false)
|
|
76
|
+
return raw_connection.send_to_pt_online_schema_change(sql) if raw_connection.alter_statement?(sql)
|
|
77
|
+
|
|
78
|
+
super
|
|
79
|
+
end
|
|
80
|
+
# rubocop:enable Metrics/ParameterLists
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'open3'
|
|
2
|
+
|
|
3
|
+
require 'forwardable'
|
|
4
|
+
|
|
5
|
+
module Departure
|
|
6
|
+
# It executes pt-online-schema-change commands in a new process and gets its
|
|
7
|
+
# output and status
|
|
8
|
+
class DbClient
|
|
9
|
+
delegate_missing_to :database_client
|
|
10
|
+
|
|
11
|
+
attr_reader :database_client
|
|
12
|
+
|
|
13
|
+
def initialize(config, database_client)
|
|
14
|
+
@config = config
|
|
15
|
+
@database_client = database_client
|
|
16
|
+
|
|
17
|
+
connection_details = Departure::ConnectionDetails.new(config)
|
|
18
|
+
verbose = ActiveRecord::Migration.verbose
|
|
19
|
+
sanitizers = [Departure::LogSanitizers::PasswordSanitizer.new(connection_details)]
|
|
20
|
+
@logger = Departure::LoggerFactory.build(sanitizers: sanitizers, verbose: verbose)
|
|
21
|
+
@cli_generator = Departure::CliGenerator.new(connection_details)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Intercepts raw query calls to pass ALTER TABLE statements to pt-online-schema-change
|
|
25
|
+
# otherwise sends to the database adapter
|
|
26
|
+
# eg: goes to pt-online-schema-change
|
|
27
|
+
# query("ALTER TABLE `comments` ADD INDEX `index_comments_on_some_id_field` (`some_id_field`))
|
|
28
|
+
# eg: sends to database adapter
|
|
29
|
+
# query("COMMIT") - query("SELECT * from 'comments'")
|
|
30
|
+
def query(raw_sql_string)
|
|
31
|
+
if alter_statement?(raw_sql_string)
|
|
32
|
+
send_to_pt_online_schema_change(raw_sql_string)
|
|
33
|
+
else
|
|
34
|
+
database_client.query(raw_sql_string)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Runs raw_sql_string through pt-online-schema-change command line tool
|
|
39
|
+
def send_to_pt_online_schema_change(raw_sql_string)
|
|
40
|
+
command_line = @cli_generator.parse_statement(raw_sql_string)
|
|
41
|
+
|
|
42
|
+
Command.new(command_line,
|
|
43
|
+
Departure.configuration.error_log_path,
|
|
44
|
+
@logger,
|
|
45
|
+
Departure.configuration.redirect_stderr).run
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def alter_statement?(raw_sql_string)
|
|
49
|
+
raw_sql_string =~ /\Aalter table/i
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
data/lib/departure/migration.rb
CHANGED
|
@@ -94,11 +94,7 @@ module Departure
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
private def configuration_hash
|
|
97
|
-
|
|
98
|
-
ActiveRecord::Base.connection_db_config.configuration_hash
|
|
99
|
-
else
|
|
100
|
-
ActiveRecord::Base.connection_config
|
|
101
|
-
end
|
|
97
|
+
ActiveRecord::Base.connection_db_config.configuration_hash
|
|
102
98
|
end
|
|
103
99
|
end
|
|
104
100
|
end
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'forwardable'
|
|
4
|
+
|
|
3
5
|
module Departure
|
|
4
6
|
class RailsAdapter
|
|
5
|
-
extend Forwardable
|
|
7
|
+
extend ::Forwardable
|
|
8
|
+
|
|
9
|
+
class UnsupportedRailsVersionError < StandardError; end
|
|
10
|
+
class MustImplementError < StandardError; end
|
|
6
11
|
|
|
7
12
|
class << self
|
|
13
|
+
def version_matches?(version_string, compatibility_string = current_version::STRING)
|
|
14
|
+
requirement = Gem::Requirement.new(compatibility_string)
|
|
15
|
+
requirement.satisfied_by?(Gem::Version.new(version_string))
|
|
16
|
+
end
|
|
17
|
+
|
|
8
18
|
def current_version
|
|
9
19
|
ActiveRecord::VERSION
|
|
10
20
|
end
|
|
@@ -14,10 +24,14 @@ module Departure
|
|
|
14
24
|
end
|
|
15
25
|
|
|
16
26
|
def for(ar_version)
|
|
17
|
-
if ar_version::MAJOR
|
|
27
|
+
if ar_version::MAJOR == 8 && ar_version::MINOR.positive?
|
|
28
|
+
V8_1_Adapter
|
|
29
|
+
elsif ar_version::MAJOR == 8
|
|
30
|
+
V8_0_Adapter
|
|
31
|
+
elsif ar_version::MAJOR >= 7 && ar_version::MINOR >= 2
|
|
18
32
|
V7_2_Adapter
|
|
19
33
|
else
|
|
20
|
-
|
|
34
|
+
raise UnsupportedRailsVersionError, "Unsupported Rails version: #{ar_version}"
|
|
21
35
|
end
|
|
22
36
|
end
|
|
23
37
|
end
|
|
@@ -25,59 +39,92 @@ module Departure
|
|
|
25
39
|
class BaseAdapter
|
|
26
40
|
class << self
|
|
27
41
|
def register_integrations
|
|
28
|
-
|
|
42
|
+
raise MustImplementError, 'adapter must implement register_integrations'
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
|
46
|
+
def create_connection_adapter(**_config)
|
|
47
|
+
raise MustImplementError, 'adapter must implement create_connection_adapter'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# https://github.com/rails/rails/commit/9ad36e067222478090b36a985090475bb03e398c#diff-de807ece2205a84c0e3de66b0e5ab831325d567893b8b88ce0d6e9d498f923d1
|
|
51
|
+
# Rails Column arity changed to require cast_type in position 2 which required us introducing this indirection
|
|
52
|
+
def new_sql_column(name:,
|
|
53
|
+
default_value:,
|
|
54
|
+
mysql_metadata:,
|
|
55
|
+
null_value:,
|
|
56
|
+
**_kwargs)
|
|
57
|
+
sql_column.new(name, default_value, mysql_metadata, null_value)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def sql_column
|
|
61
|
+
::ActiveRecord::ConnectionAdapters::DepartureAdapter::Column
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class V7_2_Adapter < BaseAdapter # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
67
|
+
class << self
|
|
68
|
+
def register_integrations
|
|
69
|
+
require 'active_record/connection_adapters/rails_7_2_departure_adapter'
|
|
70
|
+
require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
|
|
29
71
|
|
|
30
72
|
ActiveSupport.on_load(:active_record) do
|
|
31
73
|
ActiveRecord::Migration.class_eval do
|
|
32
74
|
include Departure::Migration
|
|
33
75
|
end
|
|
34
76
|
|
|
35
|
-
|
|
36
|
-
|
|
77
|
+
ActiveRecord::Migrator.prepend Departure::RailsPatches::ActiveRecordMigratorWithAdvisoryLockPatch
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
ActiveRecord::ConnectionAdapters.register 'percona',
|
|
81
|
+
'ActiveRecord::ConnectionAdapters::Rails72DepartureAdapter',
|
|
82
|
+
'active_record/connection_adapters/rails_7_2_departure_adapter'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def create_connection_adapter(**config)
|
|
86
|
+
ActiveRecord::ConnectionAdapters::Rails72DepartureAdapter.new(config)
|
|
87
|
+
end
|
|
37
88
|
|
|
38
|
-
|
|
89
|
+
def sql_column
|
|
90
|
+
::ActiveRecord::ConnectionAdapters::Rails72DepartureAdapter::Column
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class V8_0_Adapter < BaseAdapter # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
96
|
+
class << self
|
|
97
|
+
def register_integrations
|
|
98
|
+
require 'active_record/connection_adapters/rails_8_0_departure_adapter'
|
|
99
|
+
require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
|
|
100
|
+
|
|
101
|
+
ActiveSupport.on_load(:active_record) do
|
|
102
|
+
ActiveRecord::Migration.class_eval do
|
|
103
|
+
include Departure::Migration
|
|
39
104
|
end
|
|
105
|
+
|
|
106
|
+
ActiveRecord::Migrator.prepend Departure::RailsPatches::ActiveRecordMigratorWithAdvisoryLockPatch
|
|
40
107
|
end
|
|
108
|
+
|
|
109
|
+
ActiveRecord::ConnectionAdapters.register 'percona',
|
|
110
|
+
'ActiveRecord::ConnectionAdapters::Rails80DepartureAdapter',
|
|
111
|
+
'active_record/connection_adapters/rails_8_0_departure_adapter'
|
|
41
112
|
end
|
|
42
113
|
|
|
43
|
-
# ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
|
44
114
|
def create_connection_adapter(**config)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
connection_details = Departure::ConnectionDetails.new(config)
|
|
48
|
-
verbose = ActiveRecord::Migration.verbose
|
|
49
|
-
sanitizers = [
|
|
50
|
-
Departure::LogSanitizers::PasswordSanitizer.new(connection_details)
|
|
51
|
-
]
|
|
52
|
-
percona_logger = Departure::LoggerFactory.build(sanitizers: sanitizers, verbose: verbose)
|
|
53
|
-
cli_generator = Departure::CliGenerator.new(connection_details)
|
|
54
|
-
|
|
55
|
-
runner = Departure::Runner.new(
|
|
56
|
-
percona_logger,
|
|
57
|
-
cli_generator,
|
|
58
|
-
mysql2_adapter
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
connection_options = { mysql_adapter: mysql2_adapter }
|
|
62
|
-
|
|
63
|
-
ActiveRecord::ConnectionAdapters::DepartureAdapter.new(
|
|
64
|
-
runner,
|
|
65
|
-
percona_logger,
|
|
66
|
-
connection_options,
|
|
67
|
-
config
|
|
68
|
-
)
|
|
115
|
+
ActiveRecord::ConnectionAdapters::Rails80DepartureAdapter.new(config)
|
|
69
116
|
end
|
|
70
117
|
|
|
71
118
|
def sql_column
|
|
72
|
-
::ActiveRecord::ConnectionAdapters::
|
|
119
|
+
::ActiveRecord::ConnectionAdapters::Rails80DepartureAdapter::Column
|
|
73
120
|
end
|
|
74
121
|
end
|
|
75
122
|
end
|
|
76
123
|
|
|
77
|
-
class
|
|
124
|
+
class V8_1_Adapter < BaseAdapter # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
78
125
|
class << self
|
|
79
126
|
def register_integrations
|
|
80
|
-
require 'active_record/connection_adapters/
|
|
127
|
+
require 'active_record/connection_adapters/rails_8_1_departure_adapter'
|
|
81
128
|
require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
|
|
82
129
|
|
|
83
130
|
ActiveSupport.on_load(:active_record) do
|
|
@@ -89,16 +136,29 @@ module Departure
|
|
|
89
136
|
end
|
|
90
137
|
|
|
91
138
|
ActiveRecord::ConnectionAdapters.register 'percona',
|
|
92
|
-
'ActiveRecord::ConnectionAdapters::
|
|
93
|
-
'active_record/connection_adapters/
|
|
139
|
+
'ActiveRecord::ConnectionAdapters::Rails81DepartureAdapter',
|
|
140
|
+
'active_record/connection_adapters/rails_8_1_departure_adapter'
|
|
94
141
|
end
|
|
95
142
|
|
|
96
143
|
def create_connection_adapter(**config)
|
|
97
|
-
ActiveRecord::ConnectionAdapters::
|
|
144
|
+
ActiveRecord::ConnectionAdapters::Rails81DepartureAdapter.new(config)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# rubocop:disable Metrics/ParameterLists
|
|
148
|
+
# https://github.com/rails/rails/commit/9ad36e067222478090b36a985090475bb03e398c#diff-de807ece2205a84c0e3de66b0e5ab831325d567893b8b88ce0d6e9d498f923d1
|
|
149
|
+
# Rails Column arity changed to require cast_type in position 2 which required us introducing this indirection
|
|
150
|
+
def new_sql_column(name:,
|
|
151
|
+
cast_type:,
|
|
152
|
+
default_value:,
|
|
153
|
+
mysql_metadata:,
|
|
154
|
+
null_value:,
|
|
155
|
+
**_kwargs)
|
|
156
|
+
# rubocop:enable Metrics/ParameterLists
|
|
157
|
+
sql_column.new(name, cast_type, default_value, mysql_metadata, null_value)
|
|
98
158
|
end
|
|
99
159
|
|
|
100
160
|
def sql_column
|
|
101
|
-
::ActiveRecord::ConnectionAdapters::
|
|
161
|
+
::ActiveRecord::ConnectionAdapters::MySQL::Column
|
|
102
162
|
end
|
|
103
163
|
end
|
|
104
164
|
end
|
|
@@ -11,13 +11,13 @@ module Departure
|
|
|
11
11
|
@__original_connection = connection
|
|
12
12
|
|
|
13
13
|
got_lock = @__original_connection.get_advisory_lock(lock_id)
|
|
14
|
-
raise ConcurrentMigrationError unless got_lock
|
|
14
|
+
raise ActiveRecord::ConcurrentMigrationError unless got_lock
|
|
15
15
|
|
|
16
16
|
load_migrated # reload schema_migrations to be sure it wasn't changed by another process before we got the lock
|
|
17
17
|
yield
|
|
18
18
|
ensure
|
|
19
19
|
if got_lock && !@__original_connection.release_advisory_lock(lock_id)
|
|
20
|
-
raise ConcurrentMigrationError, RELEASE_LOCK_FAILED_MESSAGE
|
|
20
|
+
raise ActiveRecord::ConcurrentMigrationError, RELEASE_LOCK_FAILED_MESSAGE
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
data/lib/departure/runner.rb
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
require 'open3'
|
|
2
|
+
require 'forwardable'
|
|
3
|
+
|
|
4
|
+
# Runner is deprecated and used in rails 8.0 and below
|
|
5
|
+
# We will slowly reduce the responsibility of departure to be delegating
|
|
6
|
+
# all calls to underlying adapters/connections
|
|
2
7
|
|
|
3
8
|
module Departure
|
|
4
9
|
# It executes pt-online-schema-change commands in a new process and gets its
|
|
5
10
|
# output and status
|
|
6
11
|
class Runner
|
|
7
|
-
extend Forwardable
|
|
12
|
+
extend ::Forwardable
|
|
8
13
|
|
|
9
14
|
def_delegators :raw_connection, :execute, :escape, :close, :affected_rows
|
|
10
15
|
|
|
@@ -22,6 +27,14 @@ module Departure
|
|
|
22
27
|
@redirect_stderr = config&.redirect_stderr
|
|
23
28
|
end
|
|
24
29
|
|
|
30
|
+
def query_options
|
|
31
|
+
raw_connection.query_options
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def abandon_results!
|
|
35
|
+
raw_connection.abandon_results!
|
|
36
|
+
end
|
|
37
|
+
|
|
25
38
|
def database_adapter
|
|
26
39
|
@mysql_adapter
|
|
27
40
|
end
|
data/lib/departure/version.rb
CHANGED
data/lib/departure.rb
CHANGED
|
@@ -5,6 +5,7 @@ require 'active_record/connection_adapters/for_alter'
|
|
|
5
5
|
|
|
6
6
|
require 'departure/version'
|
|
7
7
|
require 'departure/log_sanitizers/password_sanitizer'
|
|
8
|
+
require 'departure/db_client'
|
|
8
9
|
require 'departure/runner'
|
|
9
10
|
require 'departure/cli_generator'
|
|
10
11
|
require 'departure/logger'
|
data/lib/lhm/column_with_sql.rb
CHANGED
|
@@ -52,11 +52,12 @@ module Lhm
|
|
|
52
52
|
limit: cast_type.limit
|
|
53
53
|
)
|
|
54
54
|
mysql_metadata = ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata.new(metadata)
|
|
55
|
-
@column ||= Departure::RailsAdapter.for_current.
|
|
56
|
-
name
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
@column ||= Departure::RailsAdapter.for_current.new_sql_column(
|
|
56
|
+
name:,
|
|
57
|
+
cast_type:,
|
|
58
|
+
default_value:,
|
|
59
|
+
mysql_metadata:,
|
|
60
|
+
null_value:
|
|
60
61
|
)
|
|
61
62
|
end
|
|
62
63
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: departure
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ilya Zayats
|
|
@@ -12,10 +12,9 @@ authors:
|
|
|
12
12
|
- Adrian Serafin
|
|
13
13
|
- Kirk Haines
|
|
14
14
|
- Guillermo Iguaran
|
|
15
|
-
autorequire:
|
|
16
15
|
bindir: bin
|
|
17
16
|
cert_chain: []
|
|
18
|
-
date:
|
|
17
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
19
18
|
dependencies:
|
|
20
19
|
- !ruby/object:Gem::Dependency
|
|
21
20
|
name: railties
|
|
@@ -23,52 +22,28 @@ dependencies:
|
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
27
|
-
- - "!="
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: 7.0.0
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 7.3.0
|
|
25
|
+
version: 7.2.0
|
|
33
26
|
type: :runtime
|
|
34
27
|
prerelease: false
|
|
35
28
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
29
|
requirements:
|
|
37
30
|
- - ">="
|
|
38
31
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
40
|
-
- - "!="
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: 7.0.0
|
|
43
|
-
- - "<"
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
version: 7.3.0
|
|
32
|
+
version: 7.2.0
|
|
46
33
|
- !ruby/object:Gem::Dependency
|
|
47
34
|
name: activerecord
|
|
48
35
|
requirement: !ruby/object:Gem::Requirement
|
|
49
36
|
requirements:
|
|
50
37
|
- - ">="
|
|
51
38
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
53
|
-
- - "!="
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: 7.0.0
|
|
56
|
-
- - "<"
|
|
57
|
-
- !ruby/object:Gem::Version
|
|
58
|
-
version: 7.3.0
|
|
39
|
+
version: 7.2.0
|
|
59
40
|
type: :runtime
|
|
60
41
|
prerelease: false
|
|
61
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
62
43
|
requirements:
|
|
63
44
|
- - ">="
|
|
64
45
|
- !ruby/object:Gem::Version
|
|
65
|
-
version:
|
|
66
|
-
- - "!="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: 7.0.0
|
|
69
|
-
- - "<"
|
|
70
|
-
- !ruby/object:Gem::Version
|
|
71
|
-
version: 7.3.0
|
|
46
|
+
version: 7.2.0
|
|
72
47
|
- !ruby/object:Gem::Dependency
|
|
73
48
|
name: mysql2
|
|
74
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,14 +70,14 @@ dependencies:
|
|
|
95
70
|
requirements:
|
|
96
71
|
- - "~>"
|
|
97
72
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: 2.
|
|
73
|
+
version: 2.5.0
|
|
99
74
|
type: :development
|
|
100
75
|
prerelease: false
|
|
101
76
|
version_requirements: !ruby/object:Gem::Requirement
|
|
102
77
|
requirements:
|
|
103
78
|
- - "~>"
|
|
104
79
|
- !ruby/object:Gem::Version
|
|
105
|
-
version: 2.
|
|
80
|
+
version: 2.5.0
|
|
106
81
|
- !ruby/object:Gem::Dependency
|
|
107
82
|
name: rake
|
|
108
83
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -218,18 +193,17 @@ files:
|
|
|
218
193
|
- configuration.rb
|
|
219
194
|
- departure.gemspec
|
|
220
195
|
- docker-compose.yml
|
|
221
|
-
- gemfiles/rails_6_1.gemfile
|
|
222
|
-
- gemfiles/rails_6_1.gemfile.lock
|
|
223
|
-
- gemfiles/rails_7_0.gemfile
|
|
224
|
-
- gemfiles/rails_7_0.gemfile.lock
|
|
225
|
-
- gemfiles/rails_7_1.gemfile
|
|
226
|
-
- gemfiles/rails_7_1.gemfile.lock
|
|
227
196
|
- gemfiles/rails_7_2.gemfile
|
|
228
197
|
- gemfiles/rails_7_2.gemfile.lock
|
|
198
|
+
- gemfiles/rails_8_0.gemfile
|
|
199
|
+
- gemfiles/rails_8_0.gemfile.lock
|
|
200
|
+
- gemfiles/rails_8_1.gemfile
|
|
201
|
+
- gemfiles/rails_8_1.gemfile.lock
|
|
229
202
|
- lib/active_record/connection_adapters/for_alter.rb
|
|
230
203
|
- lib/active_record/connection_adapters/patch_connection_handling.rb
|
|
231
|
-
- lib/active_record/connection_adapters/percona_adapter.rb
|
|
232
204
|
- lib/active_record/connection_adapters/rails_7_2_departure_adapter.rb
|
|
205
|
+
- lib/active_record/connection_adapters/rails_8_0_departure_adapter.rb
|
|
206
|
+
- lib/active_record/connection_adapters/rails_8_1_departure_adapter.rb
|
|
233
207
|
- lib/departure.rb
|
|
234
208
|
- lib/departure/alter_argument.rb
|
|
235
209
|
- lib/departure/cli_generator.rb
|
|
@@ -237,6 +211,7 @@ files:
|
|
|
237
211
|
- lib/departure/configuration.rb
|
|
238
212
|
- lib/departure/connection_base.rb
|
|
239
213
|
- lib/departure/connection_details.rb
|
|
214
|
+
- lib/departure/db_client.rb
|
|
240
215
|
- lib/departure/dsn.rb
|
|
241
216
|
- lib/departure/errors.rb
|
|
242
217
|
- lib/departure/log_sanitizers/password_sanitizer.rb
|
|
@@ -260,7 +235,6 @@ homepage: https://github.com/departurerb/departure
|
|
|
260
235
|
licenses:
|
|
261
236
|
- MIT
|
|
262
237
|
metadata: {}
|
|
263
|
-
post_install_message:
|
|
264
238
|
rdoc_options: []
|
|
265
239
|
require_paths:
|
|
266
240
|
- lib
|
|
@@ -268,15 +242,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
268
242
|
requirements:
|
|
269
243
|
- - ">="
|
|
270
244
|
- !ruby/object:Gem::Version
|
|
271
|
-
version: 2.
|
|
245
|
+
version: 3.2.0
|
|
272
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
247
|
requirements:
|
|
274
248
|
- - ">="
|
|
275
249
|
- !ruby/object:Gem::Version
|
|
276
250
|
version: '0'
|
|
277
251
|
requirements: []
|
|
278
|
-
rubygems_version: 3.
|
|
279
|
-
signing_key:
|
|
252
|
+
rubygems_version: 3.7.2
|
|
280
253
|
specification_version: 4
|
|
281
254
|
summary: pt-online-schema-change runner for ActiveRecord migrations
|
|
282
255
|
test_files: []
|
data/gemfiles/rails_6_1.gemfile
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# This file was generated by Appraisal
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
|
-
gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil
|
|
6
|
-
gem 'rails', '6.1.7.6'
|
|
7
|
-
gem 'rubocop', '~> 1.60.2', require: false
|
|
8
|
-
gem 'rubocop-performance', '~> 1.20.2', require: false
|
|
9
|
-
|
|
10
|
-
gemspec path: '../'
|