arrival 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c332dc7b7c51a5b6618708a6eb86048150299eb763768f14f0e16c1c3ddd4edb
4
- data.tar.gz: cd107ee392065839636c80f6c03884d5e137d1d974f7af98a3354f1d939c946f
3
+ metadata.gz: d1e2f10a31f7bc2d3087e7a8861df36aaf746b602c2e9819c2b9474ba0265ebf
4
+ data.tar.gz: c9bd276b6c165ca87d3e716c257736ae0d4777a312389f7372671a7ef97c90be
5
5
  SHA512:
6
- metadata.gz: 810977503202add1a717f2ef5a63eebaeac5fadda9cbe46a7f1bc0817e42f28957b425dd4bf4ca5e182ec6e92c009ace7b188780efc85bf28c7cc6e1fd1c3e23
7
- data.tar.gz: 64cc923ed13acfad1f6259be3b268e15f69501a4beed5d59c737c978b1f29da6a6a0d8f32fd213a6611db10451670cf4ff6aeab68f36d8b7aededc4918a0a50b
6
+ metadata.gz: 8079d723c39aa6d60fa24d8824dc8c1a6cfbc3ee614b00f78807aa0694043fdcb89e23432dd74c899a1e875edd30294c3ff23f23bf27a2c6761d9f55a02f11f3
7
+ data.tar.gz: b5771ab12e86691db61a22592855b0eec127a577c034cbe61badda2665975d87dec16083cca0b241bb6eeeec1127ca8def9e9725a1ce46f87f5b3bd15fa690c9
@@ -0,0 +1,3 @@
1
+ main/
2
+ replica/
3
+ arrival*.gem
data/Dockerfile CHANGED
@@ -1,22 +1,27 @@
1
- FROM ruby:2.6
2
- ENV GHOST_VERSION=1.0.48
1
+ FROM ruby:2.6.5
3
2
 
3
+ ENV GHOST_VERSION=v1.0.48 \
4
+ GHOST_TIMESTAMP=20190214020851
4
5
  # Install apt based dependencies required to run Rails as
5
6
  # well as RubyGems. As the Ruby image itself is based on a
6
7
  # Debian image, we use apt-get to install those.
7
8
  RUN apt-get update && \
8
9
  apt-get install -y \
9
- build-essential \
10
- percona-toolkit && \
10
+ mariadb-client && \
11
+ # build-essential \
12
+ # percona-toolkit && \
11
13
  apt-get clean && \
12
14
  apt-get remove
13
15
 
14
- # Download gh-ost and install the binary
15
16
  WORKDIR /usr/bin
16
- RUN wget https://github.com/github/gh-ost/releases/download/v$GHOST_VERSION/gh-ost-binary-linux-20190214020851.tar.gz && \
17
- tar -xvf gh-ost-binary-linux-20190214020851.tar.gz
17
+ RUN wget --no-verbose --tries=5 \
18
+ https://github.com/github/gh-ost/releases/download/$GHOST_VERSION/gh-ost-binary-linux-$GHOST_TIMESTAMP.tar.gz && \
19
+ tar -xvf gh-ost-binary-linux-$GHOST_TIMESTAMP.tar.gz
18
20
 
19
21
  RUN mkdir -p /app /app/lib/arrival
22
+ # Configure the main working directory. This is the base
23
+ # directory used in any further RUN, COPY, and ENTRYPOINT
24
+ # commands.
20
25
  WORKDIR /app
21
26
 
22
27
  # Copy the Gemfile as well as the Gemfile.lock and install
@@ -25,10 +30,7 @@ WORKDIR /app
25
30
  # are made.
26
31
  COPY arrival.gemspec Gemfile ./
27
32
  COPY lib/arrival/version.rb ./lib/arrival/
28
-
29
- RUN gem update --system && \
30
- gem install bundler -v 1.17.3 && \
31
- bundle install --jobs $(nproc) --retry 5
33
+ RUN gem install bundler -v 1.17.3 && bundle install --jobs $(nproc) --retry 5
32
34
 
33
35
  # Copy the main application.
34
36
  COPY . ./
@@ -0,0 +1,39 @@
1
+ FROM ruby:2.2
2
+ ENV GHOST_VERSION=1.0.48
3
+
4
+ # Install apt based dependencies required to run Rails as
5
+ # well as RubyGems. As the Ruby image itself is based on a
6
+ # Debian image, we use apt-get to install those.
7
+ RUN apt-get update && \
8
+ apt-get install -y \
9
+ build-essential \
10
+ percona-toolkit && \
11
+ apt-get clean && \
12
+ apt-get remove
13
+
14
+ # Configure the main working directory. This is the base
15
+ # directory used in any further RUN, COPY, and ENTRYPOINT
16
+ # commands.
17
+ RUN mkdir -p /app /app/lib/arrival
18
+ WORKDIR /usr/bin
19
+ RUN wget https://github.com/github/gh-ost/releases/download/v$GHOST_VERSION/gh-ost-binary-linux-20190214020851.tar.gz
20
+ WORKDIR /app
21
+
22
+ # Copy the Gemfile as well as the Gemfile.lock and install
23
+ # the RubyGems. This is a separate step so the dependencies
24
+ # will be cached unless changes to one of those two files
25
+ # are made.
26
+ COPY arrival.gemspec Gemfile ./
27
+ COPY lib/arrival/version.rb ./lib/arrival/
28
+
29
+ RUN gem update --system && \
30
+ gem install bundler -v 1.17.3 && \
31
+ bundle install --jobs $(nproc) --retry 5
32
+
33
+ # Copy the main application.
34
+ COPY . ./
35
+
36
+ # The main command to run when the container starts. Also
37
+ # tell the Rails dev server to bind to all interfaces by
38
+ # default.
39
+ #CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
- require './configuration'
5
4
  require './test_database'
6
5
 
7
6
  RSpec::Core::RakeTask.new(:spec)
@@ -9,9 +8,9 @@ RSpec::Core::RakeTask.new(:spec)
9
8
  task default: :spec
10
9
 
11
10
  namespace :db do
12
- desc 'Create the test database'
11
+ desc 'Create the database'
13
12
  task :create do
14
- config = Configuration.new
15
- TestDatabase.new(config).setup_test_database
13
+ TestDatabase.new.setup_test_database
14
+ puts "Database is created"
16
15
  end
17
16
  end
@@ -17,13 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_runtime_dependency 'railties', '~> 5.2.0'
21
20
  spec.add_runtime_dependency 'activerecord', '~> 5.2.0'
22
- spec.add_runtime_dependency 'mysql2', '>= 0.4.0', '<= 0.5.2'
21
+ spec.add_runtime_dependency 'mysql2', '>= 0.4.0', '<= 0.5.3'
23
22
 
24
23
  spec.add_development_dependency 'rake', '~> 10.0'
25
24
  spec.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
26
25
  spec.add_development_dependency 'rspec-its', '~> 1.2'
27
- spec.add_development_dependency 'pry' #,'~> 8.2', '>= 8.2.1'
28
- spec.add_development_dependency 'climate_control', '~> 0.0.3'
26
+ spec.add_development_dependency 'pry' ,'~> 0.12.2'
27
+ # spec.add_development_dependency 'simplecov' #,'~> 8.2', '>= 8.2.1'
29
28
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
- require 'percona_migrator'
4
+ require 'arrival'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -0,0 +1,4 @@
1
+ username: 'replica_user'
2
+ password: 'replica_pass'
3
+ database: 'arrival_test'
4
+ hostname: 'mysql-replica'
@@ -1,13 +1,10 @@
1
1
  require 'yaml'
2
- require 'erb'
3
2
 
4
3
  class Configuration
5
- CONFIG_PATH = 'config.yml.erb'.freeze
6
-
7
4
  attr_reader :config
8
5
 
9
6
  def initialize
10
- @config = YAML.load(ERB.new(File.read(CONFIG_PATH)).result).freeze
7
+ @config = YAML.safe_load(File.read('config.yml')).freeze
11
8
  end
12
9
 
13
10
  def [](key)
@@ -0,0 +1,15 @@
1
+ development:
2
+ adapter: mysql2
3
+ pool: 5
4
+ host: "mysql-main"
5
+ username: "root"
6
+ password: "111"
7
+ database: arrival_development
8
+
9
+ test:
10
+ adapter: mysql2
11
+ pool: 5
12
+ host: "mysql-main"
13
+ username: "root"
14
+ password: "111"
15
+ database: arrival_test
@@ -0,0 +1,80 @@
1
+ 2019-12-04 08:29:48 INFO starting gh-ost 1.0.48
2
+ 2019-12-04 08:29:48 INFO Migrating `arrival_test`.`comments`
3
+ 2019-12-04 08:29:48 INFO connection validated on mysql-replica:3306
4
+ 2019-12-04 08:29:48 INFO User has ALL privileges
5
+ 2019-12-04 08:29:48 INFO binary logs validated on mysql-replica:3306
6
+ 2019-12-04 08:29:48 INFO Inspector initiated on 62e8fa90771a:3306, version 5.7.25-log
7
+ 2019-12-04 08:29:48 INFO Table found. Engine=InnoDB
8
+ 2019-12-04 08:29:48 INFO Estimated number of rows via EXPLAIN: 1
9
+ 2019-12-04 08:29:48 INFO Master forced to be mysql-main:3306
10
+ 2019-12-04 08:29:48 INFO log_slave_updates validated on mysql-replica:3306
11
+ 2019-12-04 08:29:48 INFO connection validated on mysql-replica:3306
12
+ 2019-12-04 08:29:48 INFO Connecting binlog streamer at mysql-bin.000003:513602
13
+ 2019-12-04 08:29:48 INFO rotate to next log from mysql-bin.000003:0 to mysql-bin.000003
14
+ 2019-12-04 08:29:48 INFO connection validated on mysql-main:3306
15
+ 2019-12-04 08:29:49 INFO connection validated on mysql-main:3306
16
+ 2019-12-04 08:29:49 INFO will use time_zone='SYSTEM' on applier
17
+ 2019-12-04 08:29:49 INFO Examining table structure on applier
18
+ 2019-12-04 08:29:49 INFO Applier initiated on fc06e3c916b4:3306, version 5.7.25-log
19
+ 2019-12-04 08:29:49 INFO Dropping table `arrival_test`.`_comments_ghc`
20
+ 2019-12-04 08:29:49 INFO Table dropped
21
+ 2019-12-04 08:29:49 INFO Creating changelog table `arrival_test`.`_comments_ghc`
22
+ 2019-12-04 08:29:49 INFO Changelog table created
23
+ 2019-12-04 08:29:49 INFO Creating ghost table `arrival_test`.`_comments_gho`
24
+ 2019-12-04 08:29:49 INFO Ghost table created
25
+ 2019-12-04 08:29:49 INFO Altering ghost table `arrival_test`.`_comments_gho`
26
+ 2019-12-04 08:29:49 INFO Ghost table altered
27
+ 2019-12-04 08:29:49 INFO Waiting for ghost table to be migrated. Current lag is 0s
28
+ 2019-12-04 08:29:49 INFO Intercepted changelog state GhostTableMigrated
29
+ 2019-12-04 08:29:49 INFO Handled changelog state GhostTableMigrated
30
+ 2019-12-04 08:29:49 INFO Chosen shared unique key is PRIMARY
31
+ 2019-12-04 08:29:49 INFO Shared columns are id
32
+ 2019-12-04 08:29:49 INFO Listening on unix socket file: /tmp/gh-ost.arrival_test.comments.sock
33
+ 2019-12-04 08:29:49 INFO As instructed, counting rows in the background; meanwhile I will use an estimated count, and will update it later on
34
+ 2019-12-04 08:29:49 INFO As instructed, I'm issuing a SELECT COUNT(*) on the table. This may take a while
35
+ 2019-12-04 08:29:49 INFO Migration min values: [<nil>]
36
+ 2019-12-04 08:29:49 INFO Exact number of rows via COUNT: 0
37
+ 2019-12-04 08:29:49 INFO Migration max values: [<nil>]
38
+ 2019-12-04 08:29:49 INFO Waiting for first throttle metrics to be collected
39
+ 2019-12-04 08:29:49 INFO First throttle metrics collected
40
+ 2019-12-04 08:29:49 INFO Row copy complete
41
+ 2019-12-04 08:29:49 INFO Grabbing voluntary lock: gh-ost.430.lock
42
+ 2019-12-04 08:29:49 INFO Setting LOCK timeout as 20 seconds
43
+ 2019-12-04 08:29:49 INFO Looking for magic cut-over table
44
+ 2019-12-04 08:29:49 INFO Creating magic cut-over table `arrival_test`.`_comments_del`
45
+ 2019-12-04 08:29:49 INFO Magic cut-over table created
46
+ 2019-12-04 08:29:49 INFO Locking `arrival_test`.`comments`, `arrival_test`.`_comments_del`
47
+ 2019-12-04 08:29:49 INFO Tables locked
48
+ 2019-12-04 08:29:49 INFO Session locking original & magic tables is 430
49
+ 2019-12-04 08:29:49 INFO Writing changelog state: AllEventsUpToLockProcessed:1575448189399341800
50
+ 2019-12-04 08:29:49 INFO Waiting for events up to lock
51
+ 2019-12-04 08:29:49 INFO Intercepted changelog state AllEventsUpToLockProcessed
52
+ 2019-12-04 08:29:49 INFO Handled changelog state AllEventsUpToLockProcessed
53
+ 2019-12-04 08:29:50 INFO Waiting for events up to lock: got AllEventsUpToLockProcessed:1575448189399341800
54
+ 2019-12-04 08:29:50 INFO Done waiting for events up to lock; duration=920.8407ms
55
+ 2019-12-04 08:29:50 ERROR Error 1213: Deadlock found when trying to get lock; try restarting transaction
56
+ 2019-12-04 08:29:50 INFO Setting RENAME timeout as 10 seconds
57
+ 2019-12-04 08:29:50 INFO Session renaming tables is 432
58
+ 2019-12-04 08:29:50 INFO Issuing and expecting this to block: rename /* gh-ost */ table `arrival_test`.`comments` to `arrival_test`.`_comments_del`, `arrival_test`.`_comments_gho` to `arrival_test`.`comments`
59
+ 2019-12-04 08:29:50 INFO Found atomic RENAME to be blocking, as expected. Double checking the lock is still in place (though I don't strictly have to)
60
+ 2019-12-04 08:29:50 INFO Checking session lock: gh-ost.430.lock
61
+ 2019-12-04 08:29:50 INFO Connection holding lock on original table still exists
62
+ 2019-12-04 08:29:50 INFO Will now proceed to drop magic table and unlock tables
63
+ 2019-12-04 08:29:50 INFO Dropping magic cut-over table
64
+ 2019-12-04 08:29:50 INFO Releasing lock from `arrival_test`.`comments`, `arrival_test`.`_comments_del`
65
+ 2019-12-04 08:29:50 INFO Tables unlocked
66
+ 2019-12-04 08:29:50 INFO Tables renamed
67
+ 2019-12-04 08:29:50 INFO Lock & rename duration: 1.0548297s. During this time, queries on `comments` were blocked
68
+ 2019-12-04 08:29:50 INFO Looking for magic cut-over table
69
+ 2019-12-04 08:29:50 INFO Closed streamer connection. err=<nil>
70
+ 2019-12-04 08:29:50 INFO Dropping table `arrival_test`.`_comments_ghc`
71
+ 2019-12-04 08:29:50 INFO Table dropped
72
+ 2019-12-04 08:29:50 INFO Am not dropping old table because I want this operation to be as live as possible. If you insist I should do it, please add `--ok-to-drop-table` next time. But I prefer you do not. To drop the old table, issue:
73
+ 2019-12-04 08:29:50 INFO -- drop table `arrival_test`.`_comments_del`
74
+ 2019-12-04 08:29:50 INFO Done migrating `arrival_test`.`comments`
75
+ 2019-12-04 08:29:50 INFO Removing socket file: /tmp/gh-ost.arrival_test.comments.sock
76
+ 2019-12-04 08:29:50 INFO Tearing down inspector
77
+ 2019-12-04 08:29:50 INFO Tearing down applier
78
+ 2019-12-04 08:29:50 INFO Tearing down streamer
79
+ 2019-12-04 08:29:50 INFO Tearing down throttler
80
+ 2019-12-04 08:29:50 ERROR Error 1146: Table 'arrival_test._comments_ghc' doesn't exist
@@ -1,10 +1,10 @@
1
1
  version: '3'
2
2
  services:
3
- mysql_main:
3
+ mysql-main:
4
4
  image: mysql:5.7
5
5
  env_file:
6
6
  - ./main/mysql_main.env
7
- container_name: "mysql_main"
7
+ container_name: "mysql-main"
8
8
  restart: "no"
9
9
  # ports:
10
10
  # - 4406:3306
@@ -12,16 +12,16 @@ services:
12
12
  - ./main/conf/mysql.conf.cnf:/etc/mysql/conf.d/mysql.conf.cnf
13
13
  - ./main/data:/var/lib/mysql
14
14
 
15
- mysql_replica:
15
+ mysql-replica:
16
16
  image: mysql:5.7
17
17
  env_file:
18
18
  - ./replica/mysql_replica.env
19
- container_name: "mysql_replica"
19
+ container_name: "mysql-replica"
20
20
  restart: "no"
21
21
  # ports:
22
22
  # - 5506:3306
23
23
  depends_on:
24
- - mysql_main
24
+ - mysql-main
25
25
  volumes:
26
26
  - ./replica/conf/mysql.conf.cnf:/etc/mysql/conf.d/mysql.conf.cnf
27
27
  - ./replica/data:/var/lib/mysql
@@ -29,8 +29,10 @@ services:
29
29
  arrival:
30
30
  build: .
31
31
  depends_on:
32
- - mysql_main
33
- - mysql_replica
32
+ - mysql-main
33
+ - mysql-replica
34
+ volumes:
35
+ - ./:/app/
34
36
  # tty: true
35
37
  # stdin_open: true
36
38
  # environment:
@@ -1,32 +1,29 @@
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 'arrival'
5
- require 'forwardable'
6
-
7
1
  module ActiveRecord
8
2
  module ConnectionHandling
9
3
  # Establishes a connection to the database that's used by all Active
10
4
  # Record objects.
11
- def percona_connection(config)
5
+ def arrival_connection(config)
12
6
  config[:username] = 'root' if config[:username].nil?
13
- mysql2_connection = mysql2_connection(config)
7
+ mysql_connection = mysql2_connection(config)
14
8
 
15
- connection_details =Arrival::ConnectionDetails.new(config)
16
- verbose = ActiveRecord::Migration.verbose
9
+ connection_details = Arrival::ConnectionDetails.new(config)
10
+ ActiveRecord::Migration.verbose
17
11
  sanitizers = [
18
- Arrival::LogSanitizers::PasswordSanitizer.new(connection_details)
12
+ # Arrival::LogSanitizers::PasswordSanitizer.new(connection_details)
19
13
  ]
20
- percona_logger = Arrival::LoggerFactory.build(sanitizers: sanitizers, verbose: verbose)
21
- cli_generator = Arrival::CliGenerator.new(connection_details)
14
+ arrival_logger = Arrival::Logger.new(sanitizers)
15
+
16
+ # arrival_logger =
17
+ cli_generator = Arrival::CliGenerator.new
18
+ # cli_generator =
22
19
 
23
20
  runner = Arrival::Runner.new(
24
- percona_logger,
21
+ arrival_logger,
25
22
  cli_generator,
26
- mysql2_connection
23
+ mysql_connection
27
24
  )
28
25
 
29
- connection_options = { mysql_adapter: mysql2_connection }
26
+ connection_options = { mysql_adapter: mysql_connection }
30
27
 
31
28
  ConnectionAdapters::ArrivalAdapter.new(
32
29
  runner,
@@ -36,7 +33,6 @@ module ActiveRecord
36
33
  )
37
34
  end
38
35
  end
39
-
40
36
  module ConnectionAdapters
41
37
  class ArrivalAdapter < AbstractMysqlAdapter
42
38
  class Column < ActiveRecord::ConnectionAdapters::MySQL::Column
@@ -44,7 +40,6 @@ module ActiveRecord
44
40
  ArrivalAdapter
45
41
  end
46
42
  end
47
-
48
43
  class SchemaCreation < ActiveRecord::ConnectionAdapters::MySQL::SchemaCreation
49
44
  def visit_DropForeignKey(name) # rubocop:disable Naming/MethodName
50
45
  fk_name =
@@ -64,7 +59,7 @@ module ActiveRecord
64
59
  include ForAlterStatements
65
60
  end
66
61
 
67
- ADAPTER_NAME = 'Percona'.freeze
62
+ ADAPTER_NAME = 'Arrival'.freeze
68
63
 
69
64
  def_delegators :mysql_adapter, :last_inserted_id, :each_hash, :set_field_encoding
70
65
 
@@ -1,23 +1,29 @@
1
1
  require 'active_record'
2
- require 'active_support/all'
2
+ # require 'active_support/all'
3
3
 
4
- require 'active_record/connection_adapters/for_alter'
4
+ # require 'active_record/connection_adapters/for_alter'
5
5
 
6
6
  require 'arrival/version'
7
- require 'arrival/log_sanitizers/password_sanitizer'
7
+ require 'arrival/railtie'
8
+ # require 'arrival/runner'
9
+ require 'active_record/connection_adapters/for_alter'
10
+ # require 'arrival/cli_generator'
11
+ # require 'arrival/configuration'
12
+
13
+ # require 'arrival/log_sanitizers/password_sanitizer'
8
14
  require 'arrival/runner'
9
15
  require 'arrival/cli_generator'
10
16
  require 'arrival/logger'
11
- require 'arrival/null_logger'
12
- require 'arrival/logger_factory'
17
+ # require 'arrival/null_logger'
18
+ # require 'arrival/logger_factory'
13
19
  require 'arrival/configuration'
14
20
  require 'arrival/errors'
15
21
  require 'arrival/command'
16
22
 
17
- require 'arrival/railtie' if defined?(Rails)
23
+ # require 'arrival/railtie' if defined?(Rails)
18
24
 
19
- # We need the OS not to buffer the IO to see pt-osc's output while migrating
20
- $stdout.sync = true
25
+ # # We need the OS not to buffer the IO to see pt-osc's output while migrating
26
+ # $stdout.sync = true
21
27
 
22
28
  module Arrival
23
29
  class << self
@@ -29,7 +35,7 @@ module Arrival
29
35
  yield(configuration)
30
36
  end
31
37
 
32
- # Hooks Percona Migrator into Rails migrations by replacing the configured
38
+ # Hooks Arrival into Rails migrations by replacing the configured
33
39
  # database adapter
34
40
  def self.load
35
41
  ActiveRecord::Migration.class_eval do
@@ -40,28 +46,28 @@ module Arrival
40
46
  #
41
47
  # @param direction [Symbol] :up or :down
42
48
  def migrate(direction)
43
- reconnect_with_percona
44
- include_foreigner if defined?(Foreigner)
49
+ reconnect_with_arrival
50
+ # include_foreigner if defined?(Foreigner)
45
51
 
46
- ::Lhm.migration = self
52
+ # ::Lhm.migration = self
47
53
  original_migrate(direction)
48
54
  end
49
55
 
50
56
  # Includes the Foreigner's Mysql2Adapter implemention in
51
57
  # ArrivalAdapter to support foreign keys
52
- def include_foreigner
53
- Foreigner::Adapter.safe_include(
54
- :ArrivalAdapter,
55
- Foreigner::ConnectionAdapters::Mysql2Adapter
56
- )
57
- end
58
+ # def include_foreigner
59
+ # Foreigner::Adapter.safe_include(
60
+ # :ArrivalAdapter,
61
+ # Foreigner::ConnectionAdapters::Mysql2Adapter
62
+ # )
63
+ # end
58
64
 
59
65
  # Make all connections in the connection pool to use PerconaAdapter
60
66
  # instead of the current adapter.
61
- def reconnect_with_percona
62
- connection_config = ActiveRecord::Base
63
- .connection_config.merge(adapter: 'percona')
64
- ActiveRecord::Base.establish_connection(connection_config)
67
+ def reconnect_with_arrival
68
+ ActiveRecord::Base.establish_connection(
69
+ TestDatabase.new.env_config.merge("adapter" => "arrival")
70
+ )
65
71
  end
66
72
  end
67
73
  end