postshift 0.1.1 → 0.1.2
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 +4 -4
- data/.codeclimate.yml +2 -2
- data/.gitignore +2 -0
- data/LICENSE.txt +15 -48
- data/lib/active_record/connection_adapters/redshift/schema_statements.rb +8 -12
- data/lib/active_record/connection_adapters/redshift_adapter.rb +4 -3
- data/lib/postshift/version.rb +1 -1
- data/postshift.gemspec +3 -3
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af1b26becc44790eac020ebecc177aab32d7898
|
4
|
+
data.tar.gz: 7a2c30a03280b549744a963839a1f9faf0f0ca0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dff95ff03d7f68c7c32255a671d7dbc96da14f39692b19c504acdbe049121586b24e7906c37a34510df549905a7894115a568e059b5d1f5fdec8c5ef07a3f7c
|
7
|
+
data.tar.gz: a7d61ba62cbe47d2486bb946a6621729e06f8b0ca0722652fee4882b13ee651a83fc16f62106575829e318ea046d275400d406cdfb6f9c0fb6e6639bdd06d20b
|
data/.codeclimate.yml
CHANGED
data/.gitignore
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,54 +1,21 @@
|
|
1
|
-
-----------------------------------------------------------------------------------
|
2
1
|
The MIT License (MIT)
|
3
2
|
|
4
|
-
Copyright (c)
|
5
|
-
Copyright (c) 2013 Minero Aoki
|
3
|
+
Copyright (c) 2017 ValiMail Inc.
|
6
4
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
this software and associated documentation files (the "Software"), to deal
|
9
|
-
the Software without restriction, including without limitation the rights
|
10
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
the Software, and to permit persons to whom the Software is
|
12
|
-
subject to the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
13
11
|
|
14
|
-
The above copyright notice and this permission notice shall be included in
|
15
|
-
copies or substantial portions of the Software.
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
16
14
|
|
17
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
-
|
24
|
-
-----------------------------------------------------------------------------------
|
25
|
-
Copyright (c) 2010-2013, Fiksu, Inc.
|
26
|
-
All rights reserved.
|
27
|
-
|
28
|
-
Redistribution and use in source and binary forms, with or without
|
29
|
-
modification, are permitted provided that the following conditions are
|
30
|
-
met:
|
31
|
-
|
32
|
-
o Redistributions of source code must retain the above copyright
|
33
|
-
notice, this list of conditions and the following disclaimer.
|
34
|
-
|
35
|
-
o Redistributions in binary form must reproduce the above copyright
|
36
|
-
notice, this list of conditions and the following disclaimer in the
|
37
|
-
documentation and/or other materials provided with the
|
38
|
-
distribution.
|
39
|
-
|
40
|
-
o Fiksu, Inc. nor the names of its contributors may be used to
|
41
|
-
endorse or promote products derived from this software without
|
42
|
-
specific prior written permission.
|
43
|
-
|
44
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
45
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
46
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
47
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
48
|
-
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
49
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
50
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
51
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
52
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
53
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
54
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -28,17 +28,9 @@ module ActiveRecord
|
|
28
28
|
# create_database 'foo_development', encoding: 'unicode'
|
29
29
|
def create_database(name, options = {})
|
30
30
|
options = { encoding: 'utf8' }.merge!(options.symbolize_keys)
|
31
|
-
|
32
|
-
option_string = options
|
33
|
-
|
34
|
-
when :owner
|
35
|
-
" OWNER = \"#{value}\""
|
36
|
-
when :connection_limit
|
37
|
-
" CONNECTION LIMIT = #{value}"
|
38
|
-
else
|
39
|
-
''
|
40
|
-
end
|
41
|
-
end
|
31
|
+
option_string = ''
|
32
|
+
option_string += " OWNER = \"#{options[:owner]}\"" if options[:owner].present?
|
33
|
+
option_string += " CONNECTION LIMIT = #{options[:connection_limit]}" if options[:connection_limit].present?
|
42
34
|
|
43
35
|
execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}"
|
44
36
|
end
|
@@ -55,6 +47,7 @@ module ActiveRecord
|
|
55
47
|
end
|
56
48
|
|
57
49
|
# Returns the list of all column definitions for a table.
|
50
|
+
# rubocop:disable Metrics/ParameterLists
|
58
51
|
def columns(table_name)
|
59
52
|
column_definitions(table_name.to_s).map do |column_name, type, default, notnull, oid, fmod, encoding|
|
60
53
|
default_value = extract_value_from_default(default)
|
@@ -64,15 +57,18 @@ module ActiveRecord
|
|
64
57
|
new_column(column_name, default_value, type_metadata, notnull == false, table_name, default_function)
|
65
58
|
end
|
66
59
|
end
|
60
|
+
# rubocop:enable Metrics/ParameterLists
|
67
61
|
|
68
62
|
def determine_primary_key_type_conversion(type, default)
|
69
63
|
return 'primary_key' if (type == 'integer' && default.to_s.starts_with?('"identity"'))
|
70
64
|
type
|
71
65
|
end
|
72
66
|
|
67
|
+
# rubocop:disable Metrics/ParameterLists
|
73
68
|
def new_column(name, default, sql_type_metadata = nil, null = true, table_name = nil, default_function = nil) # :nodoc:
|
74
69
|
RedshiftColumn.new(name, default, sql_type_metadata, null, table_name, default_function)
|
75
70
|
end
|
71
|
+
# rubocop:enable Metrics/ParameterLists
|
76
72
|
|
77
73
|
def table_options(table_name) # :nodoc:
|
78
74
|
{}.tap do |options|
|
@@ -107,7 +103,7 @@ module ActiveRecord
|
|
107
103
|
pks.present? ? pks[0] : pks
|
108
104
|
end
|
109
105
|
|
110
|
-
#
|
106
|
+
# This entire method block for 't2.oid::regclass::text' to 't2.relname'
|
111
107
|
def foreign_keys(table_name)
|
112
108
|
fk_info = select_all(<<-SQL.strip_heredoc, 'SCHEMA')
|
113
109
|
SELECT t2.relname AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
@@ -119,7 +119,7 @@ module ActiveRecord
|
|
119
119
|
|
120
120
|
private
|
121
121
|
|
122
|
-
#
|
122
|
+
# Copied from PostgreSQL with minor registration changes. If broken out, could override segments, etc
|
123
123
|
def initialize_type_map(m) # :nodoc:
|
124
124
|
register_class_with_limit m, 'int2', Type::Integer
|
125
125
|
register_class_with_limit m, 'int4', Type::Integer
|
@@ -153,8 +153,7 @@ module ActiveRecord
|
|
153
153
|
# places after decimal = fmod - 4 & 0xffff
|
154
154
|
# places before decimal = (fmod - 4) >> 16 & 0xffff
|
155
155
|
if fmod && (fmod - 4 & 0xffff).zero?
|
156
|
-
#
|
157
|
-
# lookups on PG
|
156
|
+
# Remove this class, and the second argument to lookups on PG
|
158
157
|
Type::DecimalWithoutScale.new(precision: precision)
|
159
158
|
else
|
160
159
|
OID::Decimal.new(precision: precision, scale: scale)
|
@@ -162,6 +161,7 @@ module ActiveRecord
|
|
162
161
|
end
|
163
162
|
end
|
164
163
|
|
164
|
+
# rubocop:disable Style/CyclomaticComplexity
|
165
165
|
def configure_connection
|
166
166
|
if @config[:encoding]
|
167
167
|
@connection.set_client_encoding(@config[:encoding])
|
@@ -180,6 +180,7 @@ module ActiveRecord
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
183
|
+
# rubocop:enable Style/CyclomaticComplexity
|
183
184
|
|
184
185
|
# Returns the list of a table's column names, data types, and default values.
|
185
186
|
#
|
data/lib/postshift/version.rb
CHANGED
data/postshift.gemspec
CHANGED
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.required_ruby_version = '>= 2.2.2'
|
26
26
|
|
27
|
-
spec.add_dependency 'pg', '~> 0.20.0'
|
28
|
-
spec.add_dependency 'activerecord', '
|
29
|
-
spec.add_dependency 'activesupport', '
|
27
|
+
spec.add_dependency 'pg', '~> 0.20', '>= 0.20.0'
|
28
|
+
spec.add_dependency 'activerecord', '~> 5.0'
|
29
|
+
spec.add_dependency 'activesupport', '~> 5.0'
|
30
30
|
|
31
31
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
32
32
|
spec.add_development_dependency 'rake', '~> 10.0'
|
metadata
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postshift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Krupinski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.20'
|
20
|
+
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 0.20.0
|
20
23
|
type: :runtime
|
@@ -22,34 +25,37 @@ dependencies:
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.20'
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 0.20.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activerecord
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '5.0'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - "
|
44
|
+
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '5.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: activesupport
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '5.0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '5.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|