seed-snapshot 0.4.0 → 0.5.0

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: 8512d5e57f07a3cfb04a207a8b56cd6a05b850fae598c24d3e263ff6566de613
4
- data.tar.gz: 3385c0eedecfa2451fefdb088b3ff98a5fbe1f41254baaf387197c019bc7155c
3
+ metadata.gz: e0e7df0e9d35515b67d89e5575e97ff66126d53b23fd1ebe9fa7c00cc5ce4e76
4
+ data.tar.gz: 3e4322ce3ebcfa46e0fb167e13cd768ad1705e27a2c3f2e9c30dd0121584f6fb
5
5
  SHA512:
6
- metadata.gz: 1725747fea9e450d1ad025cf58b600105c50afd02e1c1509da33448b53d7738a16e1cdffa87ad33824392d5215fb3cabfa7eb1b870ab1b945b580e77893724e7
7
- data.tar.gz: a25b69dd1e508c9b507ffce260a26fea3a276fb9fc4d483c4e561f5ecd929800ea60a9aad83045cf317dff1c0be4173a9dae614a1abc6ba4369632df5d79d381
6
+ metadata.gz: 94d21e022bda2990d59e218fdb8fb17df37204e10e9749d0c174e593f61c81086f0dc7d64948bcacda25841192089183b193c6675bd9a85a40f306034e5f78a2
7
+ data.tar.gz: edf2b22be083d56af3f0eb3724009841bb791e42022d57523dd292d1b119bd0b83097b23a1d013de7ad763ac3990a58918483fd307b56e32b3183e3592d4adcc
@@ -16,6 +16,10 @@ module Seed
16
16
  @schema_version ||= Digest::SHA1.hexdigest(get_all_versions.sort.join)
17
17
  end
18
18
 
19
+ def client_version
20
+ @client_version ||= ActiveRecord::Base.connection.raw_connection.info[:version]
21
+ end
22
+
19
23
  def database_options
20
24
  @options ||= ActiveRecord::Base.connection.raw_connection.query_options
21
25
  end
data/lib/seed/mysql.rb CHANGED
@@ -1,8 +1,16 @@
1
1
  module Seed
2
2
  class Mysql
3
- def self.dump(file_path, username:, password:, host:, port:, database:, tables:, ignore_tables:)
3
+ def self.dump(file_path, username:, password:, host:, port:, database:, tables:, ignore_tables:, client_version:)
4
4
  host = 'localhost' unless host
5
- cmd = "MYSQL_PWD=#{password} mysqldump -u #{username} -h #{host} #{database} -t #{allow_tables_option(tables)} #{ignore_tables_option(ignore_tables)} > #{file_path}"
5
+
6
+ additional_options =
7
+ if client_version.match?(/\A8/)
8
+ '--skip-column-statistics'
9
+ else
10
+ ''
11
+ end
12
+
13
+ cmd = "MYSQL_PWD=#{password} mysqldump -u #{username} -h #{host} #{database} -t #{allow_tables_option(tables)} #{ignore_tables_option(ignore_tables)} --no-tablespaces #{additional_options} > #{file_path}"
6
14
  system cmd
7
15
  end
8
16
 
data/lib/seed/snapshot.rb CHANGED
@@ -16,7 +16,8 @@ module Seed
16
16
  @configuration.current_version_path,
17
17
  options.merge({
18
18
  tables: tables(classes),
19
- ignore_tables: ignore_tables(ignore_classes)
19
+ ignore_tables: ignore_tables(ignore_classes),
20
+ client_version: @configuration.client_version
20
21
  })
21
22
  )
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module SeedSnapshot
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed-snapshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yo_waka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-11 00:00:00.000000000 Z
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.1.2
159
+ rubygems_version: 3.0.3
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Easy dump/restore tool for ActiveRecord.