rails_data_fix 0.1.1 → 0.1.5

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: 9aecc5561ca42500f7eeac7f0c491994a2ec22bffe93ac3a562ec3b233c09bc0
4
- data.tar.gz: 7649eb215c34e313ddda879feb54334f56f0d01d140cf799a06e082d6ea40b0c
3
+ metadata.gz: 996eb4ae785df03d116c4ea96a790f4ef788750ca41eb85f99df2ae7f76ed835
4
+ data.tar.gz: dab788752610b9ee408ce298e74329c4abf65ce2c446b0a0db8095ed9885ff5f
5
5
  SHA512:
6
- metadata.gz: b578010033aad671e725ee684ed7619a04c624d2ad39034749a670358e87373de4b402b741d74f26ff48f7cc3d403738116649cb29719824bc4ed0993e014b93
7
- data.tar.gz: 5d5a8ec6b185644d1ba2ca2563e4a908fb574804c1c8982fb3af20fff99bec7b747fbee49ec4383e54c8faef93a25ff93fd46b72e126cdce86df8ec0bef4fb16
6
+ metadata.gz: 7036ae2d223d26ed6a9393f11b794b5924146c9a76c65c3f935351a026502b54f6c2f215998a44957437179ddbbfcfd4a8e6c4620e79da9c006a4ccd841fcf6d
7
+ data.tar.gz: 6e4e64ad4e5babc3fc4e81d11f7b86c50ff65d61a7a6a8fb10561e2aa0591ed8ad15ea87fb062d7a4561b73c4fe3739c85d535f2e9fe186b464b7d7d5906909c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- data_fix (0.1.0)
4
+ rails_data_fix (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -46,7 +46,7 @@ PLATFORMS
46
46
  x86_64-linux
47
47
 
48
48
  DEPENDENCIES
49
- data_fix!
49
+ rails_data_fix!
50
50
  rake (~> 13.0)
51
51
  rspec (~> 3.0)
52
52
  rubocop (~> 1.7)
data/README.org CHANGED
@@ -3,6 +3,19 @@
3
3
 
4
4
  Manage your data maintenance tasks like migrations.
5
5
 
6
+ #+begin_quote
7
+ I am not sure how it slipped through, but I realized there is
8
+ another gem, [[https://rubygems.org/gems/data_migrate/versions][data_migrate]], which does the same thing as =data_fix=.
9
+
10
+ ... well, I should actually say it the other way around, since
11
+ =data_migrate= has been around for longer and has been downloaded
12
+ extensively.
13
+
14
+ We keep using and maintaining =data_fix=, but if you are starting
15
+ from scratch, [[https://rubygems.org/gems/data_migrate/versions][data_migrate]] is probably a more complete and safer
16
+ choice.
17
+ #+end_quote
18
+
6
19
  * Introduction
7
20
 
8
21
  This Rails gem provides a set of tasks to manage DB data maintenance
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DataFix
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.5"
5
5
  end
File without changes
@@ -56,20 +56,38 @@ namespace :data_fix do
56
56
  db_name = config["database"]
57
57
  backup_db_name = db_name.gsub(/\.sqlite3$/, "-#{Date.today.strftime('%Y-%m-%d')}.sqlite3")
58
58
  cmd = "cp \"#{db_name}\" \"#{backup_db_name}\""
59
+ dry_run_msg = "WOULD RUN: #{cmd}"
59
60
  when "mysql2"
60
61
  db_host = config["host"]
61
62
  db_name = config["database"]
62
63
  db_username = config["username"]
63
64
  db_password = config["password"]
64
65
  backup_db_name = "db/#{db_name}-#{Rails.env}-#{Date.today.strftime('%Y-%m-%d')}.sql"
65
- cmd = "mysqldump -u #{db_name} -p #{db_password} #{db_name} > \"#{backup_db_name}\""
66
+ cmd = "mysqldump -u #{db_name} -p#{db_password} #{db_name} > \"#{backup_db_name}\""
67
+ dry_run_msg = "WOULD RUN: #{cmd}"
68
+ when "sqlserver"
69
+ db_host = config["host"]
70
+ db_name = config["database"]
71
+ db_username = config["username"]
72
+ db_password = config["password"]
73
+ db_azure = config["azure"]
74
+ backup_db_name = "db/#{db_name}-#{Rails.env}-#{Date.today.strftime('%Y-%m-%d')}.sql"
75
+ cmd = "sqlcmd -E -S #{db_host} –Q “BACKUP DATABASE #{db_name} TO DISK='#{backup_db_name}'"
76
+ dry_run_msg = "WOULD RUN: #{cmd}"
77
+ else
78
+ dry_run_mgs = ""
66
79
  end
80
+
67
81
  if dry_run
68
- puts_and_log "WOULD RUN: #{cmd}"
69
- else
82
+ puts_and_log dry_run_msg
83
+ elsif cmd
70
84
  system cmd
85
+ puts_and_log "backup performed and available as #{backup_db_name}."
86
+ else
87
+ puts "FATAL ERROR: I don't know how to backup for #{config[:adapter]})"
88
+ puts "--> Use rake data_fix:force_run to execute with no backup"
89
+ exit
71
90
  end
72
- puts_and_log "backup performed and available as #{backup_db_name}."
73
91
  end
74
92
 
75
93
  def df_status
@@ -123,6 +141,12 @@ namespace :data_fix do
123
141
  df_run false, ENV["STEP"]
124
142
  end
125
143
 
144
+ desc 'Run the required data fixes (STEP= to specify the optional number of steps)'
145
+ task force_run: :environment do
146
+ exit_if_not_installed
147
+ df_run false, ENV["STEP"], true
148
+ end
149
+
126
150
  desc 'Status: show which data fixes have been run'
127
151
  task status: :environment do
128
152
  exit_if_not_installed
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_data_fix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-30 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " This gem provides a set of commands to manage data maintenance scripts
14
14
  of a Rails application like migrations. \n\nEach script has a timestamped name;
@@ -34,10 +34,10 @@ files:
34
34
  - bin/console
35
35
  - bin/setup
36
36
  - data_fix.gemspec
37
- - lib/data_fix.rb
38
37
  - lib/data_fix/data_fix.rb
39
38
  - lib/data_fix/railtie.rb
40
39
  - lib/data_fix/version.rb
40
+ - lib/rails_data_fix.rb
41
41
  - lib/tasks/data_fix_tasks.rake
42
42
  homepage: https://ict4g.net/gitea/haoyun/data_fix.git
43
43
  licenses: