database_flusher 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75d8472e33710dc5a47fa06ae32e618e929d6b20
|
4
|
+
data.tar.gz: 5eaf9adc3245e5f0ab400a592db7d884382cc66a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
17
|
-
|
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
|