activerecord-postgres_enum 2.0.2 → 2.1.0

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
  SHA256:
3
- metadata.gz: 4658a60bc93da30adf1d9cb7d2f6fce18521c2bfb063ff822c51b69d2e1f9d34
4
- data.tar.gz: 661cde0de2e935c4d2e67e51282073faafd5991b6391e2a4e09669ba3711a6e4
3
+ metadata.gz: 1b774ca52773f7346d01b9db6bf6b5a914c10253597c6796f6b6619612dfba64
4
+ data.tar.gz: 92c8bfb4e74845ce4a44d381c775b9443a22e2d091a55904d3deb7d2c0d5d0bc
5
5
  SHA512:
6
- metadata.gz: c880fa8bb243ea447630342c78e272839fbc961b694ec6610b46987ead637d64b5cb29d87550a18c0b654ca17e6afd84511ea7c6a813ab3657e3ab4fb1408f66
7
- data.tar.gz: 542a619f5c41b67242aa379524588bb31b1d430d30e9f007244813c6b2ba746d3615a756bd932532a22a2555827f360768e91aadbcff3a814b874ae1c62a4367
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 `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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=#{quote value}
62
- AND enumtypid=(SELECT oid FROM pg_type WHERE typname='#{name}')
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module PostgresEnum
5
- VERSION = "2.0.2"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  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.2
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-05-28 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord