pg_spec_helper 1.9.2 → 1.9.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/pg_spec_helper/enums.rb +9 -0
- data/lib/pg_spec_helper/functions.rb +9 -0
- 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: 367f0f6859cbc842f1409017730179f8421def4685361ce152167e7f0a2a957c
|
4
|
+
data.tar.gz: d5db47986d366d99c213a7e73fd04cb3dbb1e99599d9dc415495939be4553291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdad9cd1827b9fe6e5ad09a90f302fabd0e059661c25fb10f80ab22aa91d67d294fb83f8b752192dea100b5c11913233aa190847cbc956606cca95ef26e7fa02
|
7
|
+
data.tar.gz: b44a9adba9b17a282e796d4462d82f3353bd94defbcaf291669d67deeb4025072cde08ca1b79470f57c93e9402944708cdec63d7e46f0e3138a0817d710e2a00
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.9.3](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.2...v1.9.3) (2023-08-23)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* deleting enums and triggers instead of removing the public schema, because it may have materialized views in it ([34a8afa](https://github.com/craigulliott/pg_spec_helper/commit/34a8afae9cca995ba8950d7d54ad377869901c19))
|
9
|
+
|
3
10
|
## [1.9.2](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.1...v1.9.2) (2023-08-23)
|
4
11
|
|
5
12
|
|
data/lib/pg_spec_helper/enums.rb
CHANGED
@@ -28,5 +28,14 @@ class PGSpecHelper
|
|
28
28
|
SQL
|
29
29
|
rows.map { |row| row["enum_name"].to_sym }
|
30
30
|
end
|
31
|
+
|
32
|
+
# delete all enums in the provided schema
|
33
|
+
def delete_enums schema_name
|
34
|
+
get_enum_names(schema_name).each do |enum_name|
|
35
|
+
connection.exec(<<~SQL)
|
36
|
+
DROP TYPE #{schema_name}.#{enum_name};
|
37
|
+
SQL
|
38
|
+
end
|
39
|
+
end
|
31
40
|
end
|
32
41
|
end
|
@@ -23,5 +23,14 @@ class PGSpecHelper
|
|
23
23
|
SQL
|
24
24
|
rows.map { |r| r["routine_name"].to_sym }
|
25
25
|
end
|
26
|
+
|
27
|
+
# delete all functions in the provided schema
|
28
|
+
def delete_functions schema_name
|
29
|
+
get_function_names(schema_name).each do |function_name|
|
30
|
+
connection.exec(<<~SQL)
|
31
|
+
DROP FUNCTION #{schema_name}.#{function_name};
|
32
|
+
SQL
|
33
|
+
end
|
34
|
+
end
|
26
35
|
end
|
27
36
|
end
|
@@ -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, functions and enums from within the public schema
|
40
|
+
delete_tables :public
|
41
41
|
end
|
42
42
|
|
43
43
|
def schema_exists? schema_name
|