switchman 1.14.9 → 1.14.10

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: af371eaa6c622050b8e7db37afe53de773f420c9a4a0e17c51b2b85f6fa8a74c
4
- data.tar.gz: b0002e538ef951ae7e90e1354190e6c38785844b9074254c9548579a20971f1f
3
+ metadata.gz: 36690ef40f267eaebf781f63dd9e236b5ac3db9a8241e139a4d38e97fc8e7102
4
+ data.tar.gz: 83e6084591b9d1a24ade9c3cb0e1a9b92b2d5c2af3fdc18057c9d0922728d53d
5
5
  SHA512:
6
- metadata.gz: 335a626d0904a55dea7be067d553378c030196597cf387e3ef46037f7a26667705e2ed1b8ae54db0588ae395766d6567d9a8692ad15d16a2122e41c208adf82b
7
- data.tar.gz: 9da1e76012054a5f9b9961f593cc326799740568e7135b08a3b8455ddf91a0e75c6a0a922660bc12c4f057dbc3d34a05b622737e5ac9281343cba488135eab0d
6
+ metadata.gz: '0784224cb3eb7bbcf009e2b39ede3c082bc0c990cda3828f9375312f41d874210a655f2cfe7e5de670e30e1c0e84b85378931c3d27eb4ef191249c72775f7973'
7
+ data.tar.gz: 23cbea13d056719ab560b0721238a8088a1205174ba8259debbf6165b55601fec180608bc21abaf70409458bcc8886b60310f42b4824d30a83159bbc491dbc8d
@@ -185,6 +185,7 @@ module Switchman
185
185
  shard = Shard.create!(:id => shard_id,
186
186
  :name => name,
187
187
  :database_server => self)
188
+ schema_already_existed = false
188
189
 
189
190
  begin
190
191
  self.class.creating_new_shard = true
@@ -192,6 +193,10 @@ module Switchman
192
193
  ::Shackles.activate(:deploy) do
193
194
  begin
194
195
  if create_statement
196
+ if (::ActiveRecord::Base.connection.select_value("SELECT 1 FROM pg_namespace WHERE nspname=#{::ActiveRecord::Base.connection.quote(name)}"))
197
+ schema_already_existed = true
198
+ raise "This schema already exists; cannot overwrite"
199
+ end
195
200
  Array(create_statement.call).each do |stmt|
196
201
  ::ActiveRecord::Base.connection.execute(stmt)
197
202
  end
@@ -229,7 +234,9 @@ module Switchman
229
234
  shard
230
235
  rescue
231
236
  shard.destroy
232
- shard.drop_database rescue nil
237
+ unless schema_already_existed
238
+ shard.drop_database rescue nil
239
+ end
233
240
  reset_column_information unless create_schema == false rescue nil
234
241
  raise
235
242
  ensure
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.14.9"
2
+ VERSION = "1.14.10"
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.14.9
4
+ version: 1.14.10
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: 2020-01-17 00:00:00.000000000 Z
13
+ date: 2020-03-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties