rails_data_fix 0.1.4 → 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: 07572a29bead134f69bff648317cfe5cb92d631610eb09eb25cdaacb1e642f12
4
- data.tar.gz: 69f7ea6372a80a52ce4371465848f1dbca7cd3cc2ba282a9af12c252e9a7d0b7
3
+ metadata.gz: 996eb4ae785df03d116c4ea96a790f4ef788750ca41eb85f99df2ae7f76ed835
4
+ data.tar.gz: dab788752610b9ee408ce298e74329c4abf65ce2c446b0a0db8095ed9885ff5f
5
5
  SHA512:
6
- metadata.gz: 214d8fd1784d8939eb3a344a2b5dcfde3f92fe9cd9f58307ffc2c8be328549a765f6c2687a2e4b25a453710b5dba71328a6c29a49b59560631489b772df92347
7
- data.tar.gz: ef2b215dfc2195a46149e7fb059d13b702ebb27f4ce32bc23abe44ee54a743d44762a24d458d0d07c38241d7762a99e750d1a122675a49ffcab6610c68696afa
6
+ metadata.gz: 7036ae2d223d26ed6a9393f11b794b5924146c9a76c65c3f935351a026502b54f6c2f215998a44957437179ddbbfcfd4a8e6c4620e79da9c006a4ccd841fcf6d
7
+ data.tar.gz: 6e4e64ad4e5babc3fc4e81d11f7b86c50ff65d61a7a6a8fb10561e2aa0591ed8ad15ea87fb062d7a4561b73c4fe3739c85d535f2e9fe186b464b7d7d5906909c
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DataFix
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
@@ -57,7 +57,7 @@ namespace :data_fix do
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
59
  dry_run_msg = "WOULD RUN: #{cmd}"
60
- when "mysql2"
60
+ when "mysql2"
61
61
  db_host = config["host"]
62
62
  db_name = config["database"]
63
63
  db_username = config["username"]
@@ -65,6 +65,15 @@ namespace :data_fix do
65
65
  backup_db_name = "db/#{db_name}-#{Rails.env}-#{Date.today.strftime('%Y-%m-%d')}.sql"
66
66
  cmd = "mysqldump -u #{db_name} -p#{db_password} #{db_name} > \"#{backup_db_name}\""
67
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}"
68
77
  else
69
78
  dry_run_mgs = ""
70
79
  end
@@ -75,13 +84,9 @@ namespace :data_fix do
75
84
  system cmd
76
85
  puts_and_log "backup performed and available as #{backup_db_name}."
77
86
  else
78
- puts "WARNING: I don't know how to backup for #{config[:adapter]})"
79
- answer = ""
80
- while (answer != "Y" and answer != "n")
81
- puts "Proceed anyway? [Y/n]"
82
- answer = gets.chomp
83
- end
84
- exit unless answer == "Y"
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
85
90
  end
86
91
  end
87
92
 
@@ -136,6 +141,12 @@ namespace :data_fix do
136
141
  df_run false, ENV["STEP"]
137
142
  end
138
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
+
139
150
  desc 'Status: show which data fixes have been run'
140
151
  task status: :environment do
141
152
  exit_if_not_installed
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_data_fix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita