database_flusher 0.2.2 → 0.2.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
  SHA1:
3
- metadata.gz: b93093d2e4702c62c77468100a39fceaf158241b
4
- data.tar.gz: f5730052c7cd40c607aef47a431e3146daa331ab
3
+ metadata.gz: 75d8472e33710dc5a47fa06ae32e618e929d6b20
4
+ data.tar.gz: 5eaf9adc3245e5f0ab400a592db7d884382cc66a
5
5
  SHA512:
6
- metadata.gz: 2a8653bab04c38ca4785ffad6d812eba8d40beaa227dd0a649a45dfd4babd73bd389ccc6bb190331d674709562e547bf43605076776cd05d713f0a7f18cadf5f
7
- data.tar.gz: 983debad0e6b4c93067e46336539115a1b8cfeb3c7fdce70850337736bd3a62034bb4bd8626fb1fd8c88b6802896b4805e4a1ad8fcc168e01fbb449e6d946aec
6
+ metadata.gz: d95f2e35fa0107d9011119bf590cb655f06850f1436a3aafae43c3101e8c5c356eace416d2138b5fc9d2287d51a469b0b4126ff0d35b0f7593fb48c312f677e9
7
+ data.tar.gz: 23e7639d7fb80545489f65820a48f7d48465060699a8959a8a2cd567000192f38ba68460a8372d576f50eb2a42aaeebe2e8aeb2ba8c3a387add426f65fd1ba05
data/README.md CHANGED
@@ -11,14 +11,22 @@ database_flusher is a tiny and fast database cleaner inspired by [database_clean
11
11
  * Fast `:deletion` strategy that cleans only tables/collections where `INSERT` statements were performed
12
12
  * Faster `disable_referential_integrity` for PostgreSQL
13
13
  * Executes multiple `DELETE` statements as one query with ActiveRecord
14
+ * Supports only one database for each ORM
14
15
 
15
16
  ## Supported ORMs and strategies
16
17
 
17
- | ORM | Deletion | Transaction |
18
- |:-------------|:---------|:------------|
19
- | ActiveRecord | Yes | Yes |
20
- | Mongoid | Yes | No |
18
+ | ORM | Deletion | Transaction |
19
+ |:--------------------|:---------|:------------|
20
+ | ActiveRecord >= 4.2 | Yes | Yes |
21
+ | Mongoid >= 5.0 | Yes | No |
21
22
 
23
+ mysql2 needs `MULTI_STATEMENTS` flag to be set and requires active_record >= 5.0.0
24
+
25
+ ```yaml
26
+ adapter: mysql2
27
+ flags:
28
+ - MULTI_STATEMENTS
29
+ ```
22
30
 
23
31
  ## Installation
24
32
 
@@ -13,11 +13,8 @@ module DatabaseFlusher
13
13
  private
14
14
 
15
15
  def execute_multi(sql)
16
- _result = raw_connection.query sql
17
- while raw_connection.next_result
18
- # just to make sure that all queries are finished
19
- _result = raw_connection.store_result
20
- end
16
+ execute sql
17
+ raw_connection.abandon_results!
21
18
  end
22
19
  end
23
20
  end
@@ -42,8 +42,8 @@ module DatabaseFlusher
42
42
  def clean
43
43
  return if collections.empty?
44
44
  # puts "Cleaning #{collections.inspect}"
45
+ client = ::Mongoid::Clients.default
45
46
  collections.each do |name|
46
- client = ::Mongoid::Clients.default
47
47
  client[name].delete_many
48
48
  end
49
49
  collections.clear
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module DatabaseFlusher
3
- VERSION = '0.2.2'.freeze
3
+ VERSION = '0.2.3'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_flusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgars Beigarts