activerecord-postgres_enum 2.0.2 → 2.1.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b774ca52773f7346d01b9db6bf6b5a914c10253597c6796f6b6619612dfba64
|
4
|
+
data.tar.gz: 92c8bfb4e74845ce4a44d381c775b9443a22e2d091a55904d3deb7d2c0d5d0bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 716129b56fd13a1630fb6de9fb0a74608921dcad4e35e47523bc0c2c901fb72aa202eb95f483bd0a0bcd2a1f2fd1cbeb3603fa6b80791274d30688bf82e3417a
|
7
|
+
data.tar.gz: a8c8a21b0164e61d16d2e3ef5ed3d2726bed463ddc0f63dcf36e9b60cb5bed87f699a4a639f68d642b0f11d63a13a057d8113417479091b93b91166dc64eb9b0
|
data/README.md
CHANGED
@@ -85,7 +85,7 @@ rename_enum_value :mood, "pensive", "wistful"
|
|
85
85
|
|
86
86
|
## Development
|
87
87
|
|
88
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `
|
88
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
89
89
|
|
90
90
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
91
91
|
|
@@ -10,8 +10,10 @@ module ActiveRecord
|
|
10
10
|
t.typtype,
|
11
11
|
array_to_string(array_agg(e.enumlabel ORDER BY e.enumsortorder), '\t\t', '') as enumlabels
|
12
12
|
FROM pg_type t
|
13
|
+
INNER JOIN pg_namespace n ON n.oid = t.typnamespace
|
13
14
|
LEFT JOIN pg_enum e ON e.enumtypid = t.oid
|
14
|
-
WHERE typtype = 'e'
|
15
|
+
WHERE t.typtype = 'e'
|
16
|
+
AND n.nspname = ANY(current_schemas(true))
|
15
17
|
GROUP BY t.OID, t.typname, t.typtype
|
16
18
|
ORDER BY t.typname
|
17
19
|
SQL
|
@@ -58,8 +60,12 @@ module ActiveRecord
|
|
58
60
|
def remove_enum_value(name, value)
|
59
61
|
sql = %{
|
60
62
|
DELETE FROM pg_enum
|
61
|
-
WHERE enumlabel
|
62
|
-
AND enumtypid
|
63
|
+
WHERE enumlabel = #{quote value}
|
64
|
+
AND enumtypid IN (SELECT t.oid
|
65
|
+
FROM pg_type t
|
66
|
+
INNER JOIN pg_namespace n ON n.oid = t.typnamespace
|
67
|
+
WHERE t.typname = '#{name}'
|
68
|
+
AND n.nspname = ANY(current_schemas(true)))
|
63
69
|
}
|
64
70
|
execute sql
|
65
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Merkushin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|