activerecord-pg_enum 1.0.4 → 1.0.5

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: 3bfa16f0e78242be4cacc81ef2205192c4983374507b9f58c0a18703999b2585
4
- data.tar.gz: 65f30e4358092187ef836e268abeb68399c8883db28a77ea052b99ca0bab6406
3
+ metadata.gz: a1844d2fc0b6e855491cfe6790138f17bbcdf042868893239607e56a6eb4db9e
4
+ data.tar.gz: 1f486a2ec6d9a3a817cd8e94ed7f086a235f511c53ce785af69dcc1a9fd710e3
5
5
  SHA512:
6
- metadata.gz: 0a85929872c43348615853cf3464f8b4c62f16a4c21adf1d482b60dac1ffc6e8b28326f472d979b0b0bcf0e1beb547d517ed6ba30e6716e3ad9a83e3813b8bc2
7
- data.tar.gz: 9d6ab586a0dc827ddd4e6c38b3a3e98f6d25047917ffbe79035a81f1d42af0f67257ed249f598ffd5e01328dc34b7026345c0a75ff40b4f8504febe711802ca7
6
+ metadata.gz: bd9431f58919e64098348d4604da5291ea9a52b285adcc70d706af6eadd5465c2cb46a0d5ab5a442b0e2251879090e8cff84b919c8faa3816446306b4b166a19
7
+ data.tar.gz: 86b55af7a6e30f2168551cf557709f7ebacd382fdde08b4eab391457d6537e2a8a068cb54e9373f28bcce6eab366ad3c09cbbc96e0cf2add0c0d6ca0543b157b
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.5] - 2019-11-22
10
+ ### Fixed
11
+ - Don't include schema name in dumped enum types to be consistent with the way tables are dumped (@TylerRick)
12
+
9
13
  ## [1.0.4] - 2019-11-16
10
14
  ### Fixed
11
15
  - Dump enums declared in non-public schemas
data/Rakefile CHANGED
@@ -10,13 +10,8 @@ end
10
10
 
11
11
  task :connection do
12
12
  require "active_record"
13
-
14
- ActiveRecord::Base.establish_connection(
15
- adapter: "postgresql",
16
- port: ENV.fetch("PGPORT", "5432"),
17
- username: ENV.fetch("TEST_USER") { ENV.fetch("USER", "pg_enum") },
18
- password: ENV["TEST_PASSWORD"]
19
- )
13
+ require_relative "spec/support/connection_config"
14
+ ActiveRecord::Base.establish_connection(db_config.except(:database))
20
15
  end
21
16
 
22
17
  namespace :spec do
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-pg_enum (1.0.4)
4
+ activerecord-pg_enum (1.0.5)
5
5
  activerecord (>= 4.1.0)
6
6
  activesupport
7
7
  pg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-pg_enum (1.0.4)
4
+ activerecord-pg_enum (1.0.5)
5
5
  activerecord (>= 4.1.0)
6
6
  activesupport
7
7
  pg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-pg_enum (1.0.4)
4
+ activerecord-pg_enum (1.0.5)
5
5
  activerecord (>= 4.1.0)
6
6
  activesupport
7
7
  pg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-pg_enum (1.0.4)
4
+ activerecord-pg_enum (1.0.5)
5
5
  activerecord (>= 4.1.0)
6
6
  activesupport
7
7
  pg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-pg_enum (1.0.4)
4
+ activerecord-pg_enum (1.0.5)
5
5
  activerecord (>= 4.1.0)
6
6
  activesupport
7
7
  pg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-pg_enum (1.0.4)
4
+ activerecord-pg_enum (1.0.5)
5
5
  activerecord (>= 4.1.0)
6
6
  activesupport
7
7
  pg
@@ -66,7 +66,7 @@ GIT
66
66
  PATH
67
67
  remote: ..
68
68
  specs:
69
- activerecord-pg_enum (1.0.4)
69
+ activerecord-pg_enum (1.0.5)
70
70
  activerecord (>= 4.1.0)
71
71
  activesupport
72
72
  pg
@@ -14,11 +14,12 @@ module ActiveRecord
14
14
  # { "foo_type" => ["foo", "bar", "baz"] }
15
15
  def enum_types
16
16
  res = exec_query(<<-SQL.strip_heredoc, "SCHEMA")
17
- SELECT n.nspname AS schema, t.typname AS enum_name, array_agg(e.enumlabel ORDER BY e.enumsortorder) AS enum_value
17
+ SELECT t.typname AS enum_name, array_agg(e.enumlabel ORDER BY e.enumsortorder) AS enum_value
18
18
  FROM pg_type t
19
19
  JOIN pg_enum e ON t.oid = e.enumtypid
20
20
  JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
21
- GROUP BY schema, enum_name
21
+ WHERE n.nspname = ANY (current_schemas(false))
22
+ GROUP BY enum_name;
22
23
  SQL
23
24
 
24
25
  coltype = res.column_types["enum_value"]
@@ -30,12 +31,8 @@ module ActiveRecord
30
31
  proc { |values| coltype.type_cast(values) }
31
32
  end
32
33
 
33
- public_enums, custom = res.rows.partition { |schema, _, _| schema == "public" }
34
- custom.map! { |schema, name, values| ["#{schema}.#{name}", values] }
35
-
36
- public_enums
37
- .map { |_, name, values| [name, values] }
38
- .concat(custom)
34
+ res.rows
35
+ .map { |name, values| [name, values] }
39
36
  .sort { |a, b| a.first <=> b.first }
40
37
  .each_with_object({}) { |(name, values), memo| memo[name] = deserialize.call(values) }
41
38
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module PGEnum
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-pg_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Lassek
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-17 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -209,7 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubygems_version: 3.0.3
212
+ rubyforge_project:
213
+ rubygems_version: 2.7.6.2
213
214
  signing_key:
214
215
  specification_version: 4
215
216
  summary: Integrate PostgreSQL's enumerated types with the Rails enum feature