partitioned 1.2.1 → 1.3.0
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.
@@ -116,48 +116,14 @@ module Partitioned
|
|
116
116
|
# Create a single child table.
|
117
117
|
#
|
118
118
|
def create_partition_table(*partition_key_values)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
sql = "select * from pg_table_def where tablename = '#{configurator.parent_table_name(*partition_key_values)}' and schemaname = '#{configurator.parent_table_schema_name(*partition_key_values)}'"
|
129
|
-
sql_column_rows = execute(sql)
|
130
|
-
sql_column_rows.each do |row|
|
131
|
-
column_info = []
|
132
|
-
column_name = row['column']
|
133
|
-
column_info << column_name
|
134
|
-
column_info << row['type']
|
135
|
-
if row['notnull'] == "t"
|
136
|
-
column_info << "not null"
|
137
|
-
end
|
138
|
-
if row['encoding'] != 'none'
|
139
|
-
column_info << "encode #{row['encoding']}"
|
140
|
-
end
|
141
|
-
if row['sortkey'] != "0"
|
142
|
-
sortkeys[row['sortkey'].to_i - 1] = column_name
|
143
|
-
end
|
144
|
-
sql_columns << column_info.join(" ")
|
145
|
-
end
|
146
|
-
|
147
|
-
if sortkeys.blank?
|
148
|
-
sql_sortkeys = ""
|
149
|
-
else
|
150
|
-
sql_sortkeys = " sortkey (#{sortkeys.join(',')})"
|
151
|
-
end
|
152
|
-
sql = <<-SQL
|
153
|
-
create table #{configurator.table_name(*partition_key_values)}
|
154
|
-
(
|
155
|
-
#{sql_columns.join(', ')}
|
156
|
-
) #{sql_sortkeys}
|
157
|
-
SQL
|
158
|
-
execute(sql)
|
159
|
-
|
160
|
-
# unset search_path
|
119
|
+
options = {
|
120
|
+
:partitioned_model => @parent_table_class,
|
121
|
+
:temporary => false,
|
122
|
+
:table_name => configurator.table_name(*partition_key_values)
|
123
|
+
}
|
124
|
+
@redshift_table_creator =
|
125
|
+
::ActiverecordRedshift::TableManager.new(@parent_table_class.connection, options)
|
126
|
+
@redshift_table_creator.duplicate_table
|
161
127
|
end
|
162
128
|
|
163
129
|
#
|
data/lib/partitioned/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: partitioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
236
|
version: '0'
|
237
237
|
requirements: []
|
238
238
|
rubyforge_project:
|
239
|
-
rubygems_version: 1.8.
|
239
|
+
rubygems_version: 1.8.25
|
240
240
|
signing_key:
|
241
241
|
specification_version: 3
|
242
242
|
summary: Postgres table partitioning support for ActiveRecord.
|