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 +4 -4
- data/lib/switchman/database_server.rb +8 -1
- data/lib/switchman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36690ef40f267eaebf781f63dd9e236b5ac3db9a8241e139a4d38e97fc8e7102
|
4
|
+
data.tar.gz: 83e6084591b9d1a24ade9c3cb0e1a9b92b2d5c2af3fdc18057c9d0922728d53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lib/switchman/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|