switchman 3.5.4 → 3.5.6

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: 524551c3432d001d8cbfc030baa81bf534d75b4fd9ac8a5224a018bd31ef40d8
4
- data.tar.gz: 0dbb04287be903ca4ec0c08df57fbc2f7913795baf3ae14cde806eb0c145b3a7
3
+ metadata.gz: b1d87b95f94fe959e18717de83ef0b39415dbf1479e57d4d3dde269aebde2f6e
4
+ data.tar.gz: 660a121e4d107cf2db3792eab635ee0847fdc7a950d0338281c4b63b77a5d4fc
5
5
  SHA512:
6
- metadata.gz: 9fc1195f6ae2b2d5c8041610c3bd2bd814a25db507ead5263a5bbe42331d852d21f2b8b9bb143ea8ee78f0d16303386e3f42a2acda8aabbdd862efab3fe17e7e
7
- data.tar.gz: c2a6ca3e3347342474a04e882c2b10635219404427b80b3c89d1d7a26686cc15355a8c3fcf60972ce2a8ed44a7fcdb020958c7611046653d5f53e47f087d85ca
6
+ metadata.gz: e09ee49ddff4718ca169890eff74e9d4bf4b8122e152762a6220b68093c185cbc7dc9c3bc82035a5f336fead51b98847f56ba2291da5ad2f98a355bc1cf04f90
7
+ data.tar.gz: 15772217715f825b21433adef3548e938ac891770809dc2eed5bf9384fa3e9b8259ccaed696841c5c442d195d73f7f465d0171834021d5d23fec747a0ca72fd4
@@ -11,11 +11,11 @@ module Switchman
11
11
  end
12
12
  end
13
13
 
14
- module AssociationQueryValue
14
+ module PolymorphicArrayValue
15
15
  def convert_to_id(value)
16
16
  case value
17
17
  when ::ActiveRecord::Base
18
- value.id
18
+ value.send(primary_key(value))
19
19
  else
20
20
  super
21
21
  end
@@ -87,11 +87,8 @@ module Switchman
87
87
  ::ActiveRecord::Relation.include(ActiveRecord::SpawnMethods)
88
88
  ::ActiveRecord::Relation.include(CallSuper)
89
89
 
90
- ::ActiveRecord::PredicateBuilder::AssociationQueryValue.prepend(
91
- ActiveRecord::PredicateBuilder::AssociationQueryValue
92
- )
93
90
  ::ActiveRecord::PredicateBuilder::PolymorphicArrayValue.prepend(
94
- ActiveRecord::PredicateBuilder::AssociationQueryValue
91
+ ActiveRecord::PredicateBuilder::PolymorphicArrayValue
95
92
  )
96
93
 
97
94
  ::ActiveRecord::Tasks::DatabaseTasks.singleton_class.prepend(ActiveRecord::Tasks::DatabaseTasks)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "3.5.4"
4
+ VERSION = "3.5.6"
5
5
  end
@@ -209,21 +209,28 @@ module Switchman
209
209
 
210
210
  module ActiveRecord
211
211
  module PostgreSQLDatabaseTasks
212
- def structure_dump(filename, extra_flags = nil)
213
- set_psql_env
214
- args = ["--schema-only", "--no-privileges", "--no-owner", "--file", filename]
215
- args.concat(Array(extra_flags)) if extra_flags
216
- shard = Shard.current.name
217
- serialized_search_path = shard
218
- args << "--schema=#{Shellwords.escape(shard)}"
219
-
220
- ignore_tables = ::ActiveRecord::SchemaDumper.ignore_tables
221
- args += ignore_tables.flat_map { |table| ["-T", table] } if ignore_tables.any?
222
-
223
- args << db_config.database
224
- run_cmd("pg_dump", args, "dumping")
225
- remove_sql_header_comments(filename)
226
- File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
212
+ if ::Rails.version < "7.0"
213
+ def structure_dump(filename, extra_flags = nil)
214
+ set_psql_env
215
+ args = ["--schema-only", "--no-privileges", "--no-owner", "--file", filename]
216
+ args.concat(Array(extra_flags)) if extra_flags
217
+ shard = Shard.current.name
218
+ serialized_search_path = shard
219
+ args << "--schema=#{Shellwords.escape(shard)}"
220
+
221
+ ignore_tables = ::ActiveRecord::SchemaDumper.ignore_tables
222
+ args += ignore_tables.flat_map { |table| ["-T", table] } if ignore_tables.any?
223
+
224
+ args << db_config.database
225
+ run_cmd("pg_dump", args, "dumping")
226
+ remove_sql_header_comments(filename)
227
+ File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
228
+ end
229
+ else
230
+ def structure_dump(...)
231
+ ::ActiveRecord.dump_schemas = Switchman::Shard.current.name
232
+ super
233
+ end
227
234
  end
228
235
  end
229
236
  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: 3.5.4
4
+ version: 3.5.6
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: 2023-06-21 00:00:00.000000000 Z
13
+ date: 2023-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord