mysql_rewinder 0.1.2 → 0.1.3

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: 4a2e247f212ee2a165527969e69188036a554e5e812f156adb4f13136b302fbe
4
- data.tar.gz: 9ca4cf5ad37d8ab1343882e0012ea2c350c4fd6305d043fc2dde901a3ae068dd
3
+ metadata.gz: b26b4b3f9253154ce344e453cea49761de30336c9998ce7bd65866172db1f24a
4
+ data.tar.gz: 1c603d2142d178abc6d6a0a6b140e333ff18acdb7749dbd3272a43af5c49ee16
5
5
  SHA512:
6
- metadata.gz: dfe1906efd4de0b8ee5c3eafcb5e102d7fda767f24c9f16da594a19deb081f515281b1c9aec8f6646ae49023271eeb730876f48a6b725f4bbe724d91749e15f2
7
- data.tar.gz: d7a6f5a4e43799a49270f1b65412a3aebb627e2d313be5ff7842ae0d19db70744a7768607aad8255214cad377d1229cf731d8897e088ad4094b3ec898fab3dbf
6
+ metadata.gz: 90f486dabb787181ec7ad00898b0c2240779b353c38cb6f23e9eba7a138ea52ea80ba50f195ff0bed109d4d1d4f4e1022ab5b995aebd67c552a36f1c06edc0bf
7
+ data.tar.gz: 6b3acac13d28c0696b21c729df206a8c141b82e0eff12a675f51e8f2272b43a325278817f1584c4e140324557c05b84cc5c05abd34b1cf9a79f5f45e4131f0ab
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mysql_rewinder (0.1.1)
4
+ mysql_rewinder (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -99,4 +99,4 @@ DEPENDENCIES
99
99
  trilogy
100
100
 
101
101
  BUNDLED WITH
102
- 2.3.15
102
+ 2.5.10
@@ -19,7 +19,11 @@ class MysqlRewinder
19
19
 
20
20
  def clean(tables:)
21
21
  target_tables = (tables - @except_tables) & all_tables
22
- return if target_tables.empty?
22
+
23
+ if target_tables.empty?
24
+ @logger&.debug { "[MysqlRewinder][#{@db_config[:database]}] Skip DELETE query because target_table is empty." }
25
+ return
26
+ end
23
27
 
24
28
  log_and_execute("SET FOREIGN_KEY_CHECKS = 0;")
25
29
  log_and_execute(target_tables.map { |table| "DELETE FROM #{table}" }.join(';'))
@@ -42,7 +46,7 @@ class MysqlRewinder
42
46
  res = @client.execute(sql)
43
47
  duration = (Time.now - start_ts) * 1000
44
48
 
45
- name = "[MysqlRewinder] Cleaner SQL (#{duration.round(1)}ms)"
49
+ name = "[MysqlRewinder][#{@db_config[:database]}] Cleaner SQL (#{duration.round(1)}ms)"
46
50
  msg = "\e[1m\e[30m#{name}\e[0m \e[34m#{sql}\e[0m"
47
51
  @logger.debug msg
48
52
  res
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class MysqlRewinder
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -56,7 +56,10 @@ class MysqlRewinder
56
56
  end
57
57
 
58
58
  @inserted_tables = Set.new
59
- FileUtils.rm(Dir.glob(@inserted_table_record_dir.join("#{@initialized_pid}.*.inserted_tables").to_s))
59
+ files = Dir.glob(@inserted_table_record_dir.join("#{@initialized_pid}.*.inserted_tables").to_s)
60
+
61
+ FileUtils.rm(files)
62
+ @logger&.debug { "[MysqlRewinder] removed files: #{files.join(', ')}" } if files.any?
60
63
  end
61
64
 
62
65
  def calculate_inserted_tables
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_rewinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Sangenya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-04 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: