activerecord6-redshift-adapter 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/connection_adapters/redshift/oid/decimal.rb +1 -1
- data/lib/active_record/connection_adapters/redshift/schema_definitions.rb +3 -3
- data/lib/active_record/connection_adapters/redshift/schema_statements.rb +7 -7
- data/lib/active_record/connection_adapters/redshift_adapter.rb +11 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95fe63dabddcdce38d3cf4e84d8a891a682ddcbd5884ec19bd0c1907693d1773
|
4
|
+
data.tar.gz: 00c59c4c3f97f14c08a9f140399e9a698d19b7ad5cd18d65e6291c23f7fb9486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07a977cc1444f6e4e303b1b1aa884c736d0eed3b276e04cb706f9b89cad0e24dde2f9a4519fb1647238b80199ae51662d67a499299e0f9a4a44dff36b4598109
|
7
|
+
data.tar.gz: 1fb3715ef714636c9ae987e759b4a2501c87af1e721f32aedf400b2c7436a0582dba50c5a671ea6595d2bb9ad1633f2c8d444cf8be7ec2537d1a6a75723b3457
|
@@ -30,18 +30,18 @@ module ActiveRecord
|
|
30
30
|
# require you to assure that you always provide a UUID value before saving
|
31
31
|
# a record (as primary keys cannot be +nil+). This might be done via the
|
32
32
|
# +SecureRandom.uuid+ method and a +before_save+ callback, for instance.
|
33
|
-
def primary_key(name, type = :primary_key, options
|
33
|
+
def primary_key(name, type = :primary_key, **options)
|
34
34
|
return super unless type == :uuid
|
35
35
|
options[:default] = options.fetch(:default, 'uuid_generate_v4()')
|
36
36
|
options[:primary_key] = true
|
37
37
|
column name, type, options
|
38
38
|
end
|
39
39
|
|
40
|
-
def json(name, options
|
40
|
+
def json(name, **options)
|
41
41
|
column(name, :json, options)
|
42
42
|
end
|
43
43
|
|
44
|
-
def jsonb(name, options
|
44
|
+
def jsonb(name, **options)
|
45
45
|
column(name, :jsonb, options)
|
46
46
|
end
|
47
47
|
end
|
@@ -43,7 +43,7 @@ module ActiveRecord
|
|
43
43
|
module SchemaStatements
|
44
44
|
# Drops the database specified on the +name+ attribute
|
45
45
|
# and creates it again using the provided +options+.
|
46
|
-
def recreate_database(name, options
|
46
|
+
def recreate_database(name, **options) #:nodoc:
|
47
47
|
drop_database(name)
|
48
48
|
create_database(name, options)
|
49
49
|
end
|
@@ -56,7 +56,7 @@ module ActiveRecord
|
|
56
56
|
# Example:
|
57
57
|
# create_database config[:database], config
|
58
58
|
# create_database 'foo_development', encoding: 'unicode'
|
59
|
-
def create_database(name, options
|
59
|
+
def create_database(name, **options)
|
60
60
|
options = { encoding: 'utf8' }.merge!(options.symbolize_keys)
|
61
61
|
|
62
62
|
option_string = options.inject("") do |memo, (key, value)|
|
@@ -151,7 +151,7 @@ module ActiveRecord
|
|
151
151
|
SQL
|
152
152
|
end
|
153
153
|
|
154
|
-
def drop_table(table_name, options
|
154
|
+
def drop_table(table_name, **options)
|
155
155
|
execute "DROP TABLE #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}"
|
156
156
|
end
|
157
157
|
|
@@ -221,7 +221,7 @@ module ActiveRecord
|
|
221
221
|
end
|
222
222
|
|
223
223
|
# Drops the schema for the given schema name.
|
224
|
-
def drop_schema(schema_name, options
|
224
|
+
def drop_schema(schema_name, **options)
|
225
225
|
execute "DROP SCHEMA#{' IF EXISTS' if options[:if_exists]} #{quote_schema_name(schema_name)} CASCADE"
|
226
226
|
end
|
227
227
|
|
@@ -289,13 +289,13 @@ module ActiveRecord
|
|
289
289
|
execute "ALTER TABLE #{quote_table_name(table_name)} RENAME TO #{quote_table_name(new_name)}"
|
290
290
|
end
|
291
291
|
|
292
|
-
def add_column(table_name, column_name, type, options
|
292
|
+
def add_column(table_name, column_name, type, **options) #:nodoc:
|
293
293
|
clear_cache!
|
294
294
|
super
|
295
295
|
end
|
296
296
|
|
297
297
|
# Changes the column of a table.
|
298
|
-
def change_column(table_name, column_name, type, options
|
298
|
+
def change_column(table_name, column_name, type, **options)
|
299
299
|
clear_cache!
|
300
300
|
quoted_table_name = quote_table_name(table_name)
|
301
301
|
sql_type = type_to_sql(type, limit: options[:limit], precision: options[:precision], scale: options[:scale])
|
@@ -342,7 +342,7 @@ module ActiveRecord
|
|
342
342
|
execute "ALTER TABLE #{quote_table_name(table_name)} RENAME COLUMN #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}"
|
343
343
|
end
|
344
344
|
|
345
|
-
def add_index(table_name, column_name, options
|
345
|
+
def add_index(table_name, column_name, **options) #:nodoc:
|
346
346
|
end
|
347
347
|
|
348
348
|
def remove_index!(table_name, index_name) #:nodoc:
|
@@ -583,6 +583,17 @@ module ActiveRecord
|
|
583
583
|
end
|
584
584
|
end
|
585
585
|
|
586
|
+
# SET statements from :variables config hash
|
587
|
+
# https://www.postgresql.org/docs/current/static/sql-set.html
|
588
|
+
variables.map do |k, v|
|
589
|
+
if v == ":default" || v == :default
|
590
|
+
# Sets the value to the global or compile default
|
591
|
+
execute("SET #{k} TO DEFAULT", "SCHEMA")
|
592
|
+
elsif !v.nil?
|
593
|
+
execute("SET #{k} TO #{quote(v)}", "SCHEMA")
|
594
|
+
end
|
595
|
+
end
|
596
|
+
|
586
597
|
end
|
587
598
|
|
588
599
|
def last_insert_id_result(sequence_name) #:nodoc:
|
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nancy Foen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: pg
|
@@ -78,14 +78,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: '3.0'
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.0.3
|
88
|
+
rubygems_version: 3.0.3.1
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Amazon Redshift adapter for ActiveRecord
|