activerecord-postgres_enum 2.0.0 → 2.0.1

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: 3cef504021e0ff35024356c599daaed71ce72fe3be8d1c3b24fc038fa2b0b5ff
4
- data.tar.gz: 7fbbe81954d2bdaeef201f1cc5abb4cdaefa216c3603ba7a8dd949ec06d8ea8a
3
+ metadata.gz: 3d36ad353392d74fe6bdd5aaeb03cc682cb0f84205b5502ecff4681dd5833afb
4
+ data.tar.gz: 3c854bb369675b9a188dc8b102d35053fbe942f5939ea8675ea0fb3cfe3f9848
5
5
  SHA512:
6
- metadata.gz: 847fc44c04be544a22d468e73dbba779324cfc3a32cbb615dc664090c45a870f963881d875c5b83f72e7808fae878861580ce031a8f105a8f4a34c90e3ea9d36
7
- data.tar.gz: a87a1a3250627e1e0112c5fc3e8d4b0ad27a33d5099ca4b7f5bf65bc169e19ee505b43df63176c2f12df45f4eba061bf5b6b10abcb6a7338cd63ed4776032cf0
6
+ metadata.gz: 8a95d1362c9bd42e9201c386e26908d3cb0ea7162554a2fd81e5d1b102ff4087d6b47dd5966d3770e00efea5d18e7e8438947f55118057b6dc223d4a070d8ccd
7
+ data.tar.gz: 827677270881d6e14b394fa043d8c40c6ac2f789f791d484ddf7f0d7f1cbdba365840b3c8e370002c3fb56db46a7f1ce493cb1a9d27fd2f99c4ccae9ad27cfb8
@@ -4,10 +4,12 @@ module ActiveRecord
4
4
  module PostgresEnum
5
5
  # provide support for writing out the 'create_enum' calls in schema.rb
6
6
  module SchemaDumper
7
- def tables(stream)
8
- types(stream)
7
+ unless ActiveRecord::PostgresEnum.rails_7?
8
+ def tables(stream)
9
+ types(stream)
9
10
 
10
- super
11
+ super
12
+ end
11
13
  end
12
14
 
13
15
  private
@@ -25,10 +27,12 @@ module ActiveRecord
25
27
  end
26
28
  end
27
29
 
28
- def prepare_column_options(column)
29
- spec = super
30
- spec[:enum_type] ||= "\"#{column.sql_type}\"" if column.enum?
31
- spec
30
+ unless ActiveRecord::PostgresEnum.rails_7?
31
+ def prepare_column_options(column)
32
+ spec = super
33
+ spec[:enum_type] ||= "\"#{column.sql_type}\"" if column.enum?
34
+ spec
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module PostgresEnum
5
- VERSION = "2.0.0"
5
+ VERSION = "2.0.1"
6
6
  end
7
7
  end
@@ -6,39 +6,39 @@ require "active_record/connection_adapters/postgresql/schema_statements"
6
6
  require "active_record/connection_adapters/postgresql_adapter"
7
7
  require "active_support/lazy_load_hooks"
8
8
 
9
- require "active_record/postgres_enum/version"
10
- require "active_record/postgres_enum/postgresql_adapter"
11
- require "active_record/postgres_enum/schema_dumper"
12
- require "active_record/postgres_enum/schema_statements"
13
- require "active_record/postgres_enum/column"
14
- require "active_record/postgres_enum/column_methods"
15
- require "active_record/postgres_enum/command_recorder"
16
- require "active_record/postgres_enum/enum_validator"
17
-
18
9
  module ActiveRecord
19
10
  module PostgresEnum
20
11
  def self.rails_7?
21
- Rails::VERSION::MAJOR == 7
12
+ ActiveRecord::VERSION::MAJOR == 7
22
13
  end
23
14
 
24
15
  def self.rails_5?
25
- Rails::VERSION::MAJOR == 5
16
+ ActiveRecord::VERSION::MAJOR == 5
26
17
  end
27
18
  end
28
19
  end
29
20
 
21
+ require "active_record/postgres_enum/version"
22
+ require "active_record/postgres_enum/postgresql_adapter"
23
+ require "active_record/postgres_enum/schema_dumper"
24
+ require "active_record/postgres_enum/schema_statements"
25
+ require "active_record/postgres_enum/column"
26
+ require "active_record/postgres_enum/column_methods"
27
+ require "active_record/postgres_enum/command_recorder"
28
+ require "active_record/postgres_enum/enum_validator"
29
+
30
30
  ActiveSupport.on_load(:active_record) do
31
31
  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend ActiveRecord::PostgresEnum::PostgreSQLAdapter
32
32
 
33
+ ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper.prepend(
34
+ ActiveRecord::PostgresEnum::SchemaDumper
35
+ )
36
+
33
37
  ActiveRecord::Migration::CommandRecorder.prepend ActiveRecord::PostgresEnum::CommandRecorder
34
38
 
35
39
  unless ActiveRecord::PostgresEnum.rails_7?
36
40
  ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:enum] = {}
37
41
 
38
- ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaDumper.prepend(
39
- ActiveRecord::PostgresEnum::SchemaDumper
40
- )
41
-
42
42
  if ActiveRecord::PostgresEnum.rails_5?
43
43
  ActiveRecord::ConnectionAdapters::PostgreSQLColumn.prepend(
44
44
  ActiveRecord::PostgresEnum::Column
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.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Merkushin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-20 00:00:00.000000000 Z
11
+ date: 2021-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.1'
139
- description:
139
+ description:
140
140
  email:
141
141
  - merkushin.m.s@gmail.com
142
142
  executables: []
@@ -160,7 +160,7 @@ licenses:
160
160
  - MIT
161
161
  metadata:
162
162
  allowed_push_host: https://rubygems.org
163
- post_install_message:
163
+ post_install_message:
164
164
  rdoc_options: []
165
165
  require_paths:
166
166
  - lib
@@ -175,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.3.1
179
- signing_key:
178
+ rubygems_version: 3.2.32
179
+ signing_key:
180
180
  specification_version: 4
181
181
  summary: Integrate PostgreSQL's enum data type into ActiveRecord's schema and migrations.
182
182
  test_files: []