backfiller 0.1.0 → 0.1.1

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: e03f52ddf2d8dbe1a7aada95079d1bbbeb6588e0a361122062a6c7e1c871d01d
4
- data.tar.gz: d6b0f6b92fe6da8ac84338ff76435f16a6eea506ce42e762a594f2e81af05542
3
+ metadata.gz: d546e155a0790fdb0190454b6f59ccfa7847000ea93e64c785b7af932446c2aa
4
+ data.tar.gz: f8fb83e301f507909783ac29eb405c80d7497c318915a6af2c3df803f2a85ce2
5
5
  SHA512:
6
- metadata.gz: d2d62553aa42545079e829e93c58d01171047b6874112e123fe2f4bc0bb0bf5117c5334bd5b527600d216bc3997ed137b8f5ffded9327e068fde057f006b909c
7
- data.tar.gz: ab0c2aa054baabd9afd9b94bdd5cf9b3313420ef41971c374b3c4571cacf551ebef04e7dc0488f389a6f179a766fea7cb15bf4133a1b58d274b79331127353df
6
+ metadata.gz: 6741e63a19b01bbc57829817f558838ccbe31adc18ec53fcad2115b23cba122a396e4981d0b773ad46a3af3d531771efd29fbca5d20a700a9a849a31a196b2d4
7
+ data.tar.gz: 0bf707056834e42d4e94fcf50477d121eb4e2fb8b4b31a98e13eb5be926a7cb32d1260726fd10f14d43ed0c3631bafc5788257cc835dab551cba57d084250fc8
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1
4
+
5
+ * Support Rails 6.0.0
data/README.md CHANGED
@@ -7,11 +7,11 @@ This gem maybe handly for `no-downtime` deployment especially when you need to f
7
7
 
8
8
  ## Typical no-downtime and non-locking cycle
9
9
 
10
- * add migaration that adds new column (null: true)
10
+ * add migration that adds new column (null: true)
11
11
  * deploy and run migration task
12
12
  * deploy code that starts filling new column in corresponding flows
13
13
  * add backfill task
14
- * deploy and run backflill task
14
+ * deploy and run backfill task
15
15
  * [optional] add migration that invokes backfill task asn so keep all environments consistent (except production environment because we already backfilled data)
16
16
  * add migration that disallow null values (null: false)
17
17
  * deploy code that starts using new column
@@ -49,7 +49,7 @@ Or install it yourself as:
49
49
 
50
50
  ## Usage
51
51
 
52
- Assume we we want to backfill `profiles.name` column from `users.first_name`, `users.last_name` columns.
52
+ Assume we want to backfill `profiles.name` column from `users.first_name`, `users.last_name` columns.
53
53
 
54
54
  Create backfill task into `db/backfill/profile_name.rb` and defined required methods:
55
55
 
@@ -148,6 +148,7 @@ class Backfill::ProfileName
148
148
  #{connection.quote(row['profile_name'])},
149
149
  )
150
150
  SQL
151
+ end
151
152
  connection.execute 'COMMIT'
152
153
  end
153
154
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "backfiller"
7
- spec.version = "0.1.0"
7
+ spec.version = "0.1.1"
8
8
  spec.authors = ["Andriy Yanko"]
9
9
  spec.email = ["andriy.yanko@railsware.com"]
10
10
 
@@ -9,8 +9,6 @@ module Backfiller
9
9
 
10
10
  attr_accessor :task_namespace
11
11
 
12
- attr_accessor :connection_pool
13
-
14
12
  attr_accessor :batch_size
15
13
 
16
14
  attr_accessor :logger
@@ -13,8 +13,6 @@ module Backfiller
13
13
 
14
14
  config.batch_size = 1_000
15
15
 
16
- config.connection_pool = defined?(ApplicationRecord) ? ApplicationRecord.connection_pool : ActiveRecord::Base.connection_pool
17
-
18
16
  config.logger = defined?(ApplicationRecord) ? ApplicationRecord.logger : ActiveRecord::Base.logger
19
17
  end
20
18
  end
@@ -9,7 +9,7 @@ module Backfiller
9
9
 
10
10
  def initialize(task_name)
11
11
  @task = build_task(task_name)
12
- @connection_pool = @task.respond_to?(:connection_pool) ? @task.connection_pool : Backfiller.connection_pool
12
+ @connection_pool = @task.respond_to?(:connection_pool) ? @task.connection_pool : default_connection_pool
13
13
  @batch_size = @task.respond_to?(:batch_size) ? @task.batch_size : Backfiller.batch_size
14
14
  @process_method = @task.respond_to?(:process_row) ? @task.method(:process_row) : self.method(:process_row)
15
15
  end
@@ -36,6 +36,10 @@ module Backfiller
36
36
 
37
37
  ###########################################################################
38
38
 
39
+ def default_connection_pool
40
+ defined?(ApplicationRecord) ? ApplicationRecord.connection_pool : ActiveRecord::Base.connection_pool
41
+ end
42
+
39
43
  def acquire_connection
40
44
  connection_pool.checkout
41
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backfiller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andriy Yanko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-03 00:00:00.000000000 Z
11
+ date: 2019-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
+ - Changelog.md
78
79
  - Gemfile
79
80
  - README.md
80
81
  - Rakefile