switchman 1.10.2 → 1.10.3

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
  SHA1:
3
- metadata.gz: a94b2792f84cce23eb6a12e27c9dedcc0725f81f
4
- data.tar.gz: 0ba93bf24a105041150a48ac7f364183c528cc7b
3
+ metadata.gz: d61d2718f40a07addd2a2bbdbd6835a067800217
4
+ data.tar.gz: 0e8df6c7e4c19b9a1b270d0580521423e3942a27
5
5
  SHA512:
6
- metadata.gz: 685010c8f3444e089bb6f3dab279f27002a3c58bdb51981fe6afac4055d1f3eb78a8653721c030072a5ebf28cfb2c61dd88ee290b1058bf8df938f8c6d1e2e8c
7
- data.tar.gz: 207b0fe9091da5765054e498a4c3433866be039c92b20c564cbcbc69a7fcd72c6a7e4ae4eedf71b10f33a1dc6470137ba26598b208ecf8bbe20efb417def9f56
6
+ metadata.gz: c5117529fa38094b92df0d730747b1b69f2c35fddf1295630153f96ab98969d70f1e7bf541d2261f6138a3a47751a68f56f35d1bc233ac2db7ea2f463d139de2
7
+ data.tar.gz: 8581bae2c4474151156155d7960c000cae51dfe54d7dde9524f944608c065e267fb7b7aa2e46ea97f279210774301d32509e101d84e0f4cbcab42a7d09a7bd96
@@ -213,6 +213,28 @@ module Switchman
213
213
  algorithm = nil if DatabaseServer.creating_new_shard && algorithm == "CONCURRENTLY"
214
214
  [index_name, index_type, index_columns, index_options, algorithm, using]
215
215
  end
216
+
217
+ def rename_table(table_name, new_name)
218
+ clear_cache!
219
+ execute "ALTER TABLE #{quote_table_name(table_name)} RENAME TO #{quote_local_table_name(new_name)}"
220
+ pk, seq = pk_and_sequence_for(new_name)
221
+ if pk
222
+ idx = "#{table_name}_pkey"
223
+ new_idx = "#{new_name}_pkey"
224
+ execute "ALTER INDEX #{quote_table_name(idx)} RENAME TO #{quote_local_table_name(new_idx)}"
225
+ if seq && seq.identifier == "#{table_name}_#{pk}_seq"
226
+ new_seq = "#{new_name}_#{pk}_seq"
227
+ execute "ALTER TABLE #{seq.quoted} RENAME TO #{quote_local_table_name(new_seq)}"
228
+ end
229
+ end
230
+ rename_table_indexes(table_name, new_name)
231
+ end
232
+
233
+ def rename_index(table_name, old_name, new_name)
234
+ validate_index_length!(table_name, new_name)
235
+
236
+ execute "ALTER INDEX #{quote_column_name(old_name)} RENAME TO #{quote_local_table_name(new_name)}"
237
+ end
216
238
  end
217
239
  end
218
240
  end
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.10.2"
2
+ VERSION = "1.10.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-19 00:00:00.000000000 Z
13
+ date: 2017-08-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -177,7 +177,6 @@ files:
177
177
  - db/migrate/20130328212039_create_switchman_shards.rb
178
178
  - db/migrate/20130328224244_create_default_shard.rb
179
179
  - db/migrate/20161206323434_add_back_default_string_limits_switchman.rb
180
- - db/shard_1708.sqlite3
181
180
  - lib/switchman.rb
182
181
  - lib/switchman/action_controller/caching.rb
183
182
  - lib/switchman/active_record/abstract_adapter.rb
@@ -244,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
243
  version: '0'
245
244
  requirements: []
246
245
  rubyforge_project:
247
- rubygems_version: 2.5.1
246
+ rubygems_version: 2.6.11
248
247
  signing_key:
249
248
  specification_version: 4
250
249
  summary: Rails 4 sharding magic
File without changes