pg_spec_helper 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -3
- data/lib/pg_spec_helper/schemas.rb +4 -4
- data/lib/pg_spec_helper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1285cbc5b11e282ca1e564530c3b031bf0d8455a48d7f7e2b6af112216e0287
|
4
|
+
data.tar.gz: 9c63189e6193d584bae3e84081c50a3dc151e4b717044eee56da6b18e78da48c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f150ef8957731ef55129548b3f8ccc3ff95bf211d57b2b01850df80cba4d080d72323095ee0f1648f8189fcf9487a6d9c418e53565047f8509942a05c71f4039
|
7
|
+
data.tar.gz: 77ad4f5fde90f10bf13eae8390a157adb281ee1e910992b4531604dd8cdef71e72286c38caf887814b051aab74e5d6cd81d4dc0b5e96070bc0c5a245cb3fba2f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.3.0](https://github.com/craigulliott/pg_spec_helper/compare/v1.2.0...v1.3.0) (2023-07-10)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* Dont delete the public schema, just remove all the tables instead. This is useful if you have materialized views in the public schema ([9f69160](https://github.com/craigulliott/pg_spec_helper/commit/9f691602bc851fbeea0d01a0f8e9a7555f154e35))
|
9
|
+
|
3
10
|
## [1.2.0](https://github.com/craigulliott/pg_spec_helper/compare/v1.1.0...v1.2.0) (2023-07-10)
|
4
11
|
|
5
12
|
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ This gem is concerned with the **structure** of your database, not the data/reco
|
|
28
28
|
* Resets your database after each spec, but only if the spec made changes
|
29
29
|
* Ignores `information_schema` and any schemas or tables with names beginning with `pg_`
|
30
30
|
* Configurable to ignore other schemas (such as `postgis`)
|
31
|
-
*
|
31
|
+
* Deletes tables from within the `public` schema, but does not delete the actual schema during cleanup.
|
32
32
|
* Can track and refresh materialized views
|
33
33
|
* Easily access the `PG::Connection` object via `pg_spec_helper.connection` to execute your own SQL
|
34
34
|
|
@@ -52,11 +52,9 @@ And run bundle install
|
|
52
52
|
|
53
53
|
Note, this gem depends on the postgres gem `pg`, which depends on the `libpq` package. On Apple Silicon you can run the following commands before installation to prepare your system.
|
54
54
|
|
55
|
-
```
|
56
55
|
# required for pg gem on apple silicon
|
57
56
|
$ brew install libpq
|
58
57
|
$ export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
|
59
|
-
```
|
60
58
|
|
61
59
|
## Getting Started
|
62
60
|
|
@@ -26,8 +26,8 @@ class PGSpecHelper
|
|
26
26
|
|
27
27
|
# delete all schemas in the database
|
28
28
|
def delete_all_schemas
|
29
|
-
# delete all schemas
|
30
|
-
get_schema_names.each do |schema_name|
|
29
|
+
# delete all schemas except public
|
30
|
+
get_schema_names.reject { |schema_name| schema_name == :public }.each do |schema_name|
|
31
31
|
connection.exec(<<-SQL)
|
32
32
|
-- temporarily set the client_min_messages to WARNING to
|
33
33
|
-- suppress the NOTICE messages about cascading deletes
|
@@ -36,8 +36,8 @@ class PGSpecHelper
|
|
36
36
|
SET client_min_messages TO NOTICE;
|
37
37
|
SQL
|
38
38
|
end
|
39
|
-
#
|
40
|
-
|
39
|
+
# delete all the tables from within the public schema
|
40
|
+
delete_tables :public
|
41
41
|
end
|
42
42
|
|
43
43
|
def schema_exists? schema_name
|