departure 6.7.0 → 6.8.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 +3 -12
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/Appraisals +2 -22
- data/CHANGELOG.md +10 -0
- data/Gemfile +5 -1
- data/Gemfile.lock +31 -22
- data/README.md +8 -0
- data/Rakefile +8 -0
- data/bin/rails +24 -0
- data/departure.gemspec +2 -2
- data/gemfiles/rails_6_1.gemfile.lock +31 -29
- data/gemfiles/rails_7_0.gemfile.lock +31 -29
- data/gemfiles/rails_7_1.gemfile +1 -1
- data/gemfiles/rails_7_1.gemfile.lock +47 -47
- data/gemfiles/{rails_6_0.gemfile → rails_7_2.gemfile} +2 -2
- data/gemfiles/rails_7_2.gemfile.lock +276 -0
- data/lib/active_record/connection_adapters/patch_connection_handling.rb +18 -0
- data/lib/active_record/connection_adapters/percona_adapter.rb +1 -35
- data/lib/active_record/connection_adapters/rails_7_2_departure_adapter.rb +215 -0
- data/lib/departure/command.rb +6 -2
- data/lib/departure/configuration.rb +2 -1
- data/lib/departure/rails_adapter.rb +106 -0
- data/lib/departure/rails_patches/active_record_migrator_with_advisory_lock_patch.rb +25 -0
- data/lib/departure/runner.rb +16 -4
- data/lib/departure/version.rb +1 -1
- data/lib/departure.rb +2 -5
- data/lib/lhm/column_with_sql.rb +1 -8
- data/test_database.rb +2 -6
- metadata +14 -17
- data/gemfiles/rails_6_0.gemfile.lock +0 -238
- data/gemfiles/ruby_2.7_rails_6_0.gemfile +0 -11
- data/gemfiles/ruby_2.7_rails_6_0.gemfile.lock +0 -239
- data/gemfiles/ruby_2.7_rails_6_1.gemfile +0 -11
- data/gemfiles/ruby_2.7_rails_6_1.gemfile.lock +0 -242
- data/gemfiles/ruby_2.7_rails_7_0.gemfile +0 -11
- data/gemfiles/ruby_2.7_rails_7_0.gemfile.lock +0 -241
- data/gemfiles/ruby_2.7_rails_7_1.gemfile +0 -11
- data/gemfiles/ruby_2.7_rails_7_1.gemfile.lock +0 -275
@@ -0,0 +1,215 @@
|
|
1
|
+
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
2
|
+
require 'active_record/connection_adapters/statement_pool'
|
3
|
+
require 'active_record/connection_adapters/mysql2_adapter'
|
4
|
+
require 'active_record/connection_adapters/patch_connection_handling'
|
5
|
+
require 'active_support/core_ext/string/filters'
|
6
|
+
require 'departure'
|
7
|
+
require 'forwardable'
|
8
|
+
|
9
|
+
module ActiveRecord
|
10
|
+
module ConnectionAdapters
|
11
|
+
class Rails72DepartureAdapter < AbstractMysqlAdapter
|
12
|
+
TYPE_MAP = Type::TypeMap.new.tap { |m| initialize_type_map(m) } if defined?(initialize_type_map)
|
13
|
+
|
14
|
+
class Column < ActiveRecord::ConnectionAdapters::MySQL::Column
|
15
|
+
def adapter
|
16
|
+
Rails72DepartureAdapter
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class SchemaCreation < ActiveRecord::ConnectionAdapters::MySQL::SchemaCreation
|
21
|
+
def visit_DropForeignKey(name) # rubocop:disable Style/MethodName
|
22
|
+
fk_name =
|
23
|
+
if name =~ /^__(.+)/
|
24
|
+
Regexp.last_match(1)
|
25
|
+
else
|
26
|
+
"_#{name}"
|
27
|
+
end
|
28
|
+
|
29
|
+
"DROP FOREIGN KEY #{fk_name}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
extend Forwardable
|
34
|
+
|
35
|
+
include ForAlterStatements unless method_defined?(:change_column_for_alter)
|
36
|
+
|
37
|
+
ADAPTER_NAME = 'Percona'.freeze
|
38
|
+
|
39
|
+
def self.new_client(config)
|
40
|
+
connection_details = Departure::ConnectionDetails.new(config)
|
41
|
+
verbose = ActiveRecord::Migration.verbose
|
42
|
+
sanitizers = [
|
43
|
+
Departure::LogSanitizers::PasswordSanitizer.new(connection_details)
|
44
|
+
]
|
45
|
+
percona_logger = Departure::LoggerFactory.build(sanitizers: sanitizers, verbose: verbose)
|
46
|
+
cli_generator = Departure::CliGenerator.new(connection_details)
|
47
|
+
|
48
|
+
mysql_adapter = ActiveRecord::ConnectionAdapters::Mysql2Adapter.new(config.merge(adapter: 'mysql2'))
|
49
|
+
|
50
|
+
Departure::Runner.new(
|
51
|
+
percona_logger,
|
52
|
+
cli_generator,
|
53
|
+
mysql_adapter
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialize(config)
|
58
|
+
super
|
59
|
+
|
60
|
+
@config[:flags] ||= 0
|
61
|
+
|
62
|
+
if @config[:flags].is_a? Array
|
63
|
+
@config[:flags].push 'FOUND_ROWS'
|
64
|
+
else
|
65
|
+
@config[:flags] |= ::Mysql2::Client::FOUND_ROWS
|
66
|
+
end
|
67
|
+
|
68
|
+
@prepared_statements = false
|
69
|
+
end
|
70
|
+
|
71
|
+
def write_query?(sql) # :nodoc:
|
72
|
+
!ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(
|
73
|
+
:desc, :describe, :set, :show, :use
|
74
|
+
).match?(sql)
|
75
|
+
end
|
76
|
+
|
77
|
+
def exec_delete(sql, name, binds)
|
78
|
+
execute(to_sql(sql, binds), name)
|
79
|
+
|
80
|
+
@raw_connection.affected_rows
|
81
|
+
end
|
82
|
+
alias exec_update exec_delete
|
83
|
+
|
84
|
+
def exec_insert(sql, name, binds, pky = nil, sequence_name = nil, returning: nil) # rubocop:disable Lint/UnusedMethodArgument, Metrics/Metrics/ParameterLists
|
85
|
+
execute(to_sql(sql, binds), name)
|
86
|
+
end
|
87
|
+
|
88
|
+
def internal_exec_query(sql, name = 'SQL', _binds = [], **_kwargs) # :nodoc:
|
89
|
+
result = execute(sql, name)
|
90
|
+
fields = result.fields if defined?(result.fields)
|
91
|
+
ActiveRecord::Result.new(fields || [], result.to_a)
|
92
|
+
end
|
93
|
+
alias exec_query internal_exec_query
|
94
|
+
|
95
|
+
# Executes a SELECT query and returns an array of rows. Each row is an
|
96
|
+
# array of field values.
|
97
|
+
|
98
|
+
def select_rows(arel, name = nil, binds = [])
|
99
|
+
select_all(arel, name, binds).rows
|
100
|
+
end
|
101
|
+
|
102
|
+
# Executes a SELECT query and returns an array of record hashes with the
|
103
|
+
# column names as keys and column values as values.
|
104
|
+
def select(sql, name = nil, binds = [], **kwargs)
|
105
|
+
exec_query(sql, name, binds, **kwargs)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Returns true, as this adapter supports migrations
|
109
|
+
def supports_migrations?
|
110
|
+
true
|
111
|
+
end
|
112
|
+
|
113
|
+
def new_column(...)
|
114
|
+
Column.new(...)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Adds a new index to the table
|
118
|
+
#
|
119
|
+
# @param table_name [String, Symbol]
|
120
|
+
# @param column_name [String, Symbol]
|
121
|
+
# @param options [Hash] optional
|
122
|
+
def add_index(table_name, column_name, options = {})
|
123
|
+
index_definition, = add_index_options(table_name, column_name, **options)
|
124
|
+
execute <<-SQL.squish
|
125
|
+
ALTER TABLE #{quote_table_name(index_definition.table)}
|
126
|
+
ADD #{schema_creation.accept(index_definition)}
|
127
|
+
SQL
|
128
|
+
end
|
129
|
+
|
130
|
+
# Remove the given index from the table.
|
131
|
+
#
|
132
|
+
# @param table_name [String, Symbol]
|
133
|
+
# @param options [Hash] optional
|
134
|
+
def remove_index(table_name, column_name = nil, **options)
|
135
|
+
return if options[:if_exists] && !index_exists?(table_name, column_name, **options)
|
136
|
+
|
137
|
+
index_name = index_name_for_remove(table_name, column_name, options)
|
138
|
+
|
139
|
+
execute "ALTER TABLE #{quote_table_name(table_name)} DROP INDEX #{quote_column_name(index_name)}"
|
140
|
+
end
|
141
|
+
|
142
|
+
def schema_creation
|
143
|
+
SchemaCreation.new(self)
|
144
|
+
end
|
145
|
+
|
146
|
+
def change_table(table_name, _options = {})
|
147
|
+
recorder = ActiveRecord::Migration::CommandRecorder.new(self)
|
148
|
+
yield update_table_definition(table_name, recorder)
|
149
|
+
bulk_change_table(table_name, recorder.commands)
|
150
|
+
end
|
151
|
+
|
152
|
+
def full_version
|
153
|
+
get_full_version
|
154
|
+
end
|
155
|
+
|
156
|
+
def get_full_version # rubocop:disable Style/AccessorMethodName
|
157
|
+
return @get_full_version if defined? @get_full_version
|
158
|
+
|
159
|
+
with_raw_connection do |conn|
|
160
|
+
@get_full_version = conn.database_adapter.get_database_version.full_version_string
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def last_inserted_id(result)
|
165
|
+
@raw_connection.database_adapter.send(:last_inserted_id, result)
|
166
|
+
end
|
167
|
+
|
168
|
+
private
|
169
|
+
|
170
|
+
attr_reader :mysql_adapter
|
171
|
+
|
172
|
+
def each_hash(result, &block) # :nodoc:
|
173
|
+
@raw_connection.database_adapter.each_hash(result, &block)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Must return the MySQL error number from the exception, if the exception has an
|
177
|
+
# error number.
|
178
|
+
def error_number(exception)
|
179
|
+
@raw_connection.database_adapter.error_number(exception)
|
180
|
+
end
|
181
|
+
|
182
|
+
def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: true)
|
183
|
+
log(sql, name, async: async) do |notification_payload|
|
184
|
+
with_raw_connection(allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |conn|
|
185
|
+
sync_timezone_changes(conn)
|
186
|
+
result = conn.query(sql)
|
187
|
+
verified! if allow_retry
|
188
|
+
handle_warnings(sql)
|
189
|
+
if result.is_a? Process::Status
|
190
|
+
notification_payload[:exit_code] = result.exitstatus
|
191
|
+
notification_payload[:exit_pid] = result.pid
|
192
|
+
elsif result.respond_to?(:size)
|
193
|
+
notification_payload[:row_count] = result.size
|
194
|
+
end
|
195
|
+
result
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def connect
|
201
|
+
@raw_connection = self.class.new_client(@config)
|
202
|
+
rescue ConnectionNotEstablished => e
|
203
|
+
raise e.set_pool(@pool)
|
204
|
+
end
|
205
|
+
|
206
|
+
def reconnect
|
207
|
+
@lock.synchronize do
|
208
|
+
@raw_connection&.close
|
209
|
+
@raw_connection = nil
|
210
|
+
connect
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
data/lib/departure/command.rb
CHANGED
@@ -42,7 +42,7 @@ module Departure
|
|
42
42
|
# execution status
|
43
43
|
def run_in_process
|
44
44
|
Open3.popen3(full_command) do |_stdin, stdout, _stderr, waith_thr|
|
45
|
-
begin
|
45
|
+
begin # rubocop:disable Style/RedundantBegin
|
46
46
|
loop do
|
47
47
|
IO.select([stdout])
|
48
48
|
data = stdout.read_nonblock(8192)
|
@@ -83,7 +83,11 @@ module Departure
|
|
83
83
|
#
|
84
84
|
# @return [String]
|
85
85
|
def error_message
|
86
|
-
|
86
|
+
if redirect_stderr
|
87
|
+
File.read(error_log_path)
|
88
|
+
else
|
89
|
+
''
|
90
|
+
end
|
87
91
|
end
|
88
92
|
|
89
93
|
# Logs when the execution started
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Departure
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :tmp_path, :global_percona_args, :enabled_by_default, :redirect_stderr
|
3
|
+
attr_accessor :tmp_path, :global_percona_args, :enabled_by_default, :redirect_stderr,
|
4
|
+
:disable_rails_advisory_lock_patch
|
4
5
|
|
5
6
|
def initialize
|
6
7
|
@tmp_path = '.'.freeze
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Departure
|
4
|
+
class RailsAdapter
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def current_version
|
9
|
+
ActiveRecord::VERSION
|
10
|
+
end
|
11
|
+
|
12
|
+
def for_current
|
13
|
+
self.for(current_version)
|
14
|
+
end
|
15
|
+
|
16
|
+
def for(ar_version)
|
17
|
+
if ar_version::MAJOR >= 7 && ar_version::MINOR >= 2
|
18
|
+
V7_2_Adapter
|
19
|
+
else
|
20
|
+
BaseAdapter
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class BaseAdapter
|
26
|
+
class << self
|
27
|
+
def register_integrations
|
28
|
+
require 'active_record/connection_adapters/percona_adapter'
|
29
|
+
|
30
|
+
ActiveSupport.on_load(:active_record) do
|
31
|
+
ActiveRecord::Migration.class_eval do
|
32
|
+
include Departure::Migration
|
33
|
+
end
|
34
|
+
|
35
|
+
if ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR == 1
|
36
|
+
require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
|
37
|
+
|
38
|
+
ActiveRecord::Migrator.prepend Departure::RailsPatches::ActiveRecordMigratorWithAdvisoryLockPatch
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
44
|
+
def create_connection_adapter(**config)
|
45
|
+
mysql2_adapter = ActiveRecord::Base.mysql2_connection(config)
|
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
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def sql_column
|
72
|
+
::ActiveRecord::ConnectionAdapters::DepartureAdapter::Column
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class V7_2_Adapter < BaseAdapter # rubocop:disable Naming/ClassAndModuleCamelCase
|
78
|
+
class << self
|
79
|
+
def register_integrations
|
80
|
+
require 'active_record/connection_adapters/rails_7_2_departure_adapter'
|
81
|
+
require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
|
82
|
+
|
83
|
+
ActiveSupport.on_load(:active_record) do
|
84
|
+
ActiveRecord::Migration.class_eval do
|
85
|
+
include Departure::Migration
|
86
|
+
end
|
87
|
+
|
88
|
+
ActiveRecord::Migrator.prepend Departure::RailsPatches::ActiveRecordMigratorWithAdvisoryLockPatch
|
89
|
+
end
|
90
|
+
|
91
|
+
ActiveRecord::ConnectionAdapters.register 'percona',
|
92
|
+
'ActiveRecord::ConnectionAdapters::Rails72DepartureAdapter',
|
93
|
+
'active_record/connection_adapters/rails_7_2_departure_adapter'
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_connection_adapter(**config)
|
97
|
+
ActiveRecord::ConnectionAdapters::Rails72DepartureAdapter.new(config)
|
98
|
+
end
|
99
|
+
|
100
|
+
def sql_column
|
101
|
+
::ActiveRecord::ConnectionAdapters::Rails72DepartureAdapter::Column
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Departure
|
2
|
+
module RailsPatches
|
3
|
+
module ActiveRecordMigratorWithAdvisoryLockPatch
|
4
|
+
RELEASE_LOCK_FAILED_MESSAGE = 'Failed to release advisory lock from ActiveRecordMigratorWithAdvisoryLockPatch'
|
5
|
+
.freeze
|
6
|
+
|
7
|
+
def with_advisory_lock
|
8
|
+
return super if Departure.configuration.disable_rails_advisory_lock_patch
|
9
|
+
|
10
|
+
lock_id = generate_migrator_advisory_lock_id
|
11
|
+
@__original_connection = connection
|
12
|
+
|
13
|
+
got_lock = @__original_connection.get_advisory_lock(lock_id)
|
14
|
+
raise ConcurrentMigrationError unless got_lock
|
15
|
+
|
16
|
+
load_migrated # reload schema_migrations to be sure it wasn't changed by another process before we got the lock
|
17
|
+
yield
|
18
|
+
ensure
|
19
|
+
if got_lock && !@__original_connection.release_advisory_lock(lock_id)
|
20
|
+
raise ConcurrentMigrationError, RELEASE_LOCK_FAILED_MESSAGE
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/departure/runner.rb
CHANGED
@@ -4,6 +4,10 @@ module Departure
|
|
4
4
|
# It executes pt-online-schema-change commands in a new process and gets its
|
5
5
|
# output and status
|
6
6
|
class Runner
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
def_delegators :raw_connection, :execute, :escape, :close, :affected_rows
|
10
|
+
|
7
11
|
# Constructor
|
8
12
|
#
|
9
13
|
# @param logger [#say, #write]
|
@@ -14,8 +18,16 @@ module Departure
|
|
14
18
|
@logger = logger
|
15
19
|
@cli_generator = cli_generator
|
16
20
|
@mysql_adapter = mysql_adapter
|
17
|
-
@error_log_path = config
|
18
|
-
@redirect_stderr = config
|
21
|
+
@error_log_path = config&.error_log_path
|
22
|
+
@redirect_stderr = config&.redirect_stderr
|
23
|
+
end
|
24
|
+
|
25
|
+
def database_adapter
|
26
|
+
@mysql_adapter
|
27
|
+
end
|
28
|
+
|
29
|
+
def raw_connection
|
30
|
+
database_adapter.raw_connection
|
19
31
|
end
|
20
32
|
|
21
33
|
# Executes the passed sql statement using pt-online-schema-change for ALTER
|
@@ -27,7 +39,7 @@ module Departure
|
|
27
39
|
command_line = cli_generator.parse_statement(sql)
|
28
40
|
execute(command_line)
|
29
41
|
else
|
30
|
-
|
42
|
+
database_adapter.execute(sql)
|
31
43
|
end
|
32
44
|
end
|
33
45
|
|
@@ -36,7 +48,7 @@ module Departure
|
|
36
48
|
#
|
37
49
|
# @return [Integer]
|
38
50
|
def affected_rows
|
39
|
-
|
51
|
+
raw_connection.affected_rows
|
40
52
|
end
|
41
53
|
|
42
54
|
# TODO: rename it so we don't confuse it with AR's #execute
|
data/lib/departure/version.rb
CHANGED
data/lib/departure.rb
CHANGED
@@ -15,17 +15,14 @@ require 'departure/errors'
|
|
15
15
|
require 'departure/command'
|
16
16
|
require 'departure/connection_base'
|
17
17
|
require 'departure/migration'
|
18
|
+
require 'departure/rails_adapter'
|
18
19
|
|
19
20
|
require 'departure/railtie' if defined?(Rails)
|
20
21
|
|
21
22
|
# We need the OS not to buffer the IO to see pt-osc's output while migrating
|
22
23
|
$stdout.sync = true
|
23
24
|
|
24
|
-
|
25
|
-
ActiveRecord::Migration.class_eval do
|
26
|
-
include Departure::Migration
|
27
|
-
end
|
28
|
-
end
|
25
|
+
Departure::RailsAdapter.for_current.register_integrations
|
29
26
|
|
30
27
|
module Departure
|
31
28
|
class << self
|
data/lib/lhm/column_with_sql.rb
CHANGED
@@ -6,13 +6,6 @@ module Lhm
|
|
6
6
|
class ColumnWithSql
|
7
7
|
extend Forwardable
|
8
8
|
|
9
|
-
# Returns the column's class to be used
|
10
|
-
#
|
11
|
-
# @return [Constant]
|
12
|
-
def self.column_factory
|
13
|
-
::ActiveRecord::ConnectionAdapters::DepartureAdapter::Column
|
14
|
-
end
|
15
|
-
|
16
9
|
# Constructor
|
17
10
|
#
|
18
11
|
# @param name [String, Symbol]
|
@@ -59,7 +52,7 @@ module Lhm
|
|
59
52
|
limit: cast_type.limit
|
60
53
|
)
|
61
54
|
mysql_metadata = ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata.new(metadata)
|
62
|
-
@column ||=
|
55
|
+
@column ||= Departure::RailsAdapter.for_current.sql_column.new(
|
63
56
|
name,
|
64
57
|
default_value,
|
65
58
|
mysql_metadata,
|
data/test_database.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
require 'active_record/connection_adapters/mysql2_adapter'
|
3
|
+
require 'departure'
|
3
4
|
|
4
5
|
# Setups the test database with the schema_migrations table that ActiveRecord
|
5
6
|
# requires for the migrations, plus a table for the Comment model used throught
|
@@ -70,11 +71,6 @@ class TestDatabase
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def conn
|
73
|
-
|
74
|
-
host: @config['hostname'],
|
75
|
-
username: @config['username'],
|
76
|
-
password: @config['password'],
|
77
|
-
reconnect: true
|
78
|
-
)
|
74
|
+
ActiveRecord::Base.connection
|
79
75
|
end
|
80
76
|
end
|
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: 6.
|
4
|
+
version: 6.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Zayats
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date:
|
18
|
+
date: 2025-03-31 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: railties
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 7.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 7.
|
32
|
+
version: 7.3.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
version: 7.0.0
|
43
43
|
- - "<"
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 7.
|
45
|
+
version: 7.3.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: activerecord
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: 7.0.0
|
56
56
|
- - "<"
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: 7.
|
58
|
+
version: 7.3.0
|
59
59
|
type: :runtime
|
60
60
|
prerelease: false
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: 7.0.0
|
69
69
|
- - "<"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 7.
|
71
|
+
version: 7.3.0
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: mysql2
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,30 +211,25 @@ files:
|
|
211
211
|
- RELEASING.md
|
212
212
|
- Rakefile
|
213
213
|
- bin/console
|
214
|
+
- bin/rails
|
214
215
|
- bin/rspec
|
215
216
|
- bin/setup
|
216
217
|
- config.yml.erb
|
217
218
|
- configuration.rb
|
218
219
|
- departure.gemspec
|
219
220
|
- docker-compose.yml
|
220
|
-
- gemfiles/rails_6_0.gemfile
|
221
|
-
- gemfiles/rails_6_0.gemfile.lock
|
222
221
|
- gemfiles/rails_6_1.gemfile
|
223
222
|
- gemfiles/rails_6_1.gemfile.lock
|
224
223
|
- gemfiles/rails_7_0.gemfile
|
225
224
|
- gemfiles/rails_7_0.gemfile.lock
|
226
225
|
- gemfiles/rails_7_1.gemfile
|
227
226
|
- gemfiles/rails_7_1.gemfile.lock
|
228
|
-
- gemfiles/
|
229
|
-
- gemfiles/
|
230
|
-
- gemfiles/ruby_2.7_rails_6_1.gemfile
|
231
|
-
- gemfiles/ruby_2.7_rails_6_1.gemfile.lock
|
232
|
-
- gemfiles/ruby_2.7_rails_7_0.gemfile
|
233
|
-
- gemfiles/ruby_2.7_rails_7_0.gemfile.lock
|
234
|
-
- gemfiles/ruby_2.7_rails_7_1.gemfile
|
235
|
-
- gemfiles/ruby_2.7_rails_7_1.gemfile.lock
|
227
|
+
- gemfiles/rails_7_2.gemfile
|
228
|
+
- gemfiles/rails_7_2.gemfile.lock
|
236
229
|
- lib/active_record/connection_adapters/for_alter.rb
|
230
|
+
- lib/active_record/connection_adapters/patch_connection_handling.rb
|
237
231
|
- lib/active_record/connection_adapters/percona_adapter.rb
|
232
|
+
- lib/active_record/connection_adapters/rails_7_2_departure_adapter.rb
|
238
233
|
- lib/departure.rb
|
239
234
|
- lib/departure/alter_argument.rb
|
240
235
|
- lib/departure/cli_generator.rb
|
@@ -250,6 +245,8 @@ files:
|
|
250
245
|
- lib/departure/migration.rb
|
251
246
|
- lib/departure/null_logger.rb
|
252
247
|
- lib/departure/option.rb
|
248
|
+
- lib/departure/rails_adapter.rb
|
249
|
+
- lib/departure/rails_patches/active_record_migrator_with_advisory_lock_patch.rb
|
253
250
|
- lib/departure/railtie.rb
|
254
251
|
- lib/departure/runner.rb
|
255
252
|
- lib/departure/user_options.rb
|
@@ -278,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
275
|
- !ruby/object:Gem::Version
|
279
276
|
version: '0'
|
280
277
|
requirements: []
|
281
|
-
rubygems_version: 3.
|
278
|
+
rubygems_version: 3.5.23
|
282
279
|
signing_key:
|
283
280
|
specification_version: 4
|
284
281
|
summary: pt-online-schema-change runner for ActiveRecord migrations
|