activerecord6-redshift-adapter 1.1.3 → 1.2.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: aed3175ea88bb9b6b163ffc7b198768b81c16330dc1d7b480d7d1a17356f6033
4
- data.tar.gz: 66de7284e67e34a05bbd376be4cd8c3ee0a0c3b7565db16229a7c1512eb0de41
3
+ metadata.gz: 9b6838020bc89ee6ffd8861657f32f98219011a7cf3f4592fc341704a866fff8
4
+ data.tar.gz: 232c5134bb175bc46a1762b7dc9a002bcd79656b7a7a20fef07aeea0b105e99d
5
5
  SHA512:
6
- metadata.gz: c840dd282c228c3aab781e770ac40a8c5a2ee3ddb71c6d380f27cf6a9c411ed3ff5c659cfa6dbaa768da6db58dadbdefec8736309f4cff360a5639fcf2c83c96
7
- data.tar.gz: bce5739dd4b207c1c92f726b80ad0a920eeb04b3f5d76800e5ff0121bd3a2c79474a967795c6ca4c7d567b6c8654dd9620188aa8397f0ee0a38886a072eb0439
6
+ metadata.gz: dad43df760170a8b2cfb967c17d0726fb66006f8f070d7b932dd66f415705dc53cbca96a227298c3781dc2f75c69f7806c7c08b90895837717f84b534a1ed927
7
+ data.tar.gz: 0db86869e3b6f4a02dcdbd2c28a92678e006e24d1f0bd95566dd8b7f3697e19d8c3edc7be4a514a24c36e7a77558317f5849663931b5916e6e20d6e2f2c56750
@@ -3,8 +3,18 @@ module ActiveRecord
3
3
  class RedshiftColumn < Column #:nodoc:
4
4
  delegate :oid, :fmod, to: :sql_type_metadata
5
5
 
6
- def initialize(name, default, sql_type_metadata, null = true, default_function = nil)
7
- super name, default, sql_type_metadata, null, default_function
6
+ if ActiveRecord::VERSION::MAJOR >= 6 && ActiveRecord::VERSION::MINOR >= 1
7
+ # Required for Rails 6.1, see https://github.com/rails/rails/pull/41756
8
+ mattr_reader :array, default: false
9
+ alias :array? :array
10
+
11
+ def initialize(name, default, sql_type_metadata, null = true, default_function = nil, **)
12
+ super name, default, sql_type_metadata, null, default_function
13
+ end
14
+ else
15
+ def initialize(name, default, sql_type_metadata, null = true, default_function = nil)
16
+ super name, default, sql_type_metadata, null, default_function
17
+ end
8
18
  end
9
19
  end
10
20
  end
@@ -87,7 +87,14 @@ module ActiveRecord
87
87
 
88
88
  # Executes a SELECT query and returns an array of rows. Each row is an
89
89
  # array of field values.
90
- def select_rows(sql, name = nil, binds = [])
90
+ def select_rows(arel, name = nil, binds = [])
91
+ if respond_to?(:arel_from_relation, true)
92
+ arel = arel_from_relation(arel)
93
+ sql, binds = to_sql_and_binds(arel, [])
94
+ else
95
+ arel, binds = binds_from_relation arel, []
96
+ sql = to_sql(arel, binds)
97
+ end
91
98
  execute_and_clear(sql, name, binds) do |result|
92
99
  result.values
93
100
  end
@@ -1,21 +1,42 @@
1
1
  module ActiveRecord
2
2
  module ConnectionAdapters
3
3
  module Redshift
4
- class SchemaCreation < AbstractAdapter::SchemaCreation
5
- private
6
4
 
7
- def visit_ColumnDefinition(o)
8
- o.sql_type = type_to_sql(o.type, limit: o.limit, precision: o.precision, scale: o.scale)
9
- super
5
+ if ActiveRecord::VERSION::MAJOR >= 6 && ActiveRecord::VERSION::MINOR >= 1
6
+ class SchemaCreation < SchemaCreation
7
+ private
8
+
9
+ def visit_ColumnDefinition(o)
10
+ o.sql_type = type_to_sql(o.type, limit: o.limit, precision: o.precision, scale: o.scale)
11
+ super
12
+ end
13
+
14
+ def add_column_options!(sql, options)
15
+ column = options.fetch(:column) { return super }
16
+ if column.type == :uuid && options[:default] =~ /\(\)/
17
+ sql << " DEFAULT #{options[:default]}"
18
+ else
19
+ super
20
+ end
21
+ end
10
22
  end
23
+ else
24
+ class SchemaCreation < AbstractAdapter::SchemaCreation
25
+ private
11
26
 
12
- def add_column_options!(sql, options)
13
- column = options.fetch(:column) { return super }
14
- if column.type == :uuid && options[:default] =~ /\(\)/
15
- sql << " DEFAULT #{options[:default]}"
16
- else
27
+ def visit_ColumnDefinition(o)
28
+ o.sql_type = type_to_sql(o.type, limit: o.limit, precision: o.precision, scale: o.scale)
17
29
  super
18
30
  end
31
+
32
+ def add_column_options!(sql, options)
33
+ column = options.fetch(:column) { return super }
34
+ if column.type == :uuid && options[:default] =~ /\(\)/
35
+ sql << " DEFAULT #{options[:default]}"
36
+ else
37
+ super
38
+ end
39
+ end
19
40
  end
20
41
  end
21
42
 
@@ -159,7 +159,7 @@ module ActiveRecord
159
159
  super(connection, logger, config)
160
160
 
161
161
  @visitor = Arel::Visitors::PostgreSQL.new self
162
- @visitor.extend(ConnectionAdapters::DetermineIfPreparableVisitor)
162
+ @visitor.extend(ConnectionAdapters::DetermineIfPreparableVisitor) if defined?(ConnectionAdapters::DetermineIfPreparableVisitor)
163
163
  @prepared_statements = false
164
164
 
165
165
  @connection_parameters = connection_parameters
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord6-redshift-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nancy Foen
@@ -11,29 +11,26 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-08-04 00:00:00.000000000 Z
14
+ date: 2021-06-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pg
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - ">="
20
+ - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '0.18'
22
+ version: '1.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.18'
29
+ version: '1.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activerecord
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 6.0.0
37
34
  - - "~>"
38
35
  - !ruby/object:Gem::Version
39
36
  version: '6.0'
@@ -41,14 +38,11 @@ dependencies:
41
38
  prerelease: false
42
39
  version_requirements: !ruby/object:Gem::Requirement
43
40
  requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 6.0.0
47
41
  - - "~>"
48
42
  - !ruby/object:Gem::Version
49
43
  version: '6.0'
50
- description: Amazon Redshift _makeshift_ adapter for ActiveRecord 6.
51
- email: fantast.d@gmail.com
44
+ description: Amazon Redshift adapter for ActiveRecord 6.x.
45
+ email: contact@quent.in
52
46
  executables: []
53
47
  extensions: []
54
48
  extra_rdoc_files: []