dynamic_migrations 3.8.5 → 3.8.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: 0237e61916864ca25f8f7ba1c8882ee7cd8ba687eb2ead948f7dc602cc11e58d
4
- data.tar.gz: 8e883bcf30a9b2bf549b7e52062e1cd0576aecaedbe24eb20314522b7e6a6ac8
3
+ metadata.gz: 00405e194209e083433ebb55aa305922a16e24290ead4f240420602c9465bc90
4
+ data.tar.gz: 57b7136d7eb1f7efc5382101cf24a4dc5ed4852e66a5f67faf368294e05632c0
5
5
  SHA512:
6
- metadata.gz: c026e79bd2af5e73e7cc994fa0a3a28ed480c99f79e151377ae1f01a4953696875d9b3b3df8e53e8e4b6d0e463cadb784ceeed49e0e37b6b6fe9929261f030c5
7
- data.tar.gz: 4de30c0cdc9586519da3790fd073eaa4e039214fff6448a064b1fc603a694f3264885ffa3258f542f588e22523173eec55b26c9596753d03a72bbebc5145e7a6
6
+ metadata.gz: bc594cb118caa67c0e9982f839c762e074b789b083328a1b69b3261297bd34055a53739f51cabb6f6e5685ea76f80eb4574b45649fd202bf213a579713842fac
7
+ data.tar.gz: 8d42ee7274c26e25086eae4e9c2646f958f930a18fd03eb9c6262f734cf55af380499763e3508a05156a6f1baad4c7bc30007e9d242674d9594bf83e75a7bf1f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.8.6](https://github.com/craigulliott/dynamic_migrations/compare/v3.8.5...v3.8.6) (2023-10-08)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * replacing enum casts with the temporary enums when normalizing check clause and action conditions ([0cb67fc](https://github.com/craigulliott/dynamic_migrations/commit/0cb67fcff4d7833ec1dd60453526b1bc3dbe45ee))
9
+
3
10
  ## [3.8.5](https://github.com/craigulliott/dynamic_migrations/compare/v3.8.4...v3.8.5) (2023-10-08)
4
11
 
5
12
 
@@ -224,6 +224,13 @@ module DynamicMigrations
224
224
  $$ BEGIN END $$;
225
225
  SQL
226
226
 
227
+ temp_action_condition = action_condition
228
+ # string replace any real enum names with their temp enum names
229
+ temp_enums.each do |temp_enum_name, enum|
230
+ temp_action_condition.gsub!("::#{enum.name}", "::#{temp_enum_name}")
231
+ temp_action_condition.gsub!("::#{enum.full_name}", "::#{temp_enum_name}")
232
+ end
233
+
227
234
  # create a temporary trigger, from which we will fetch the normalized action condition
228
235
  connection.exec(<<~SQL)
229
236
  CREATE TRIGGER trigger_normalized_action_condition_temp_trigger
@@ -134,9 +134,16 @@ module DynamicMigrations
134
134
 
135
135
  temp_enums = table.create_temp_table(connection, "validation_normalized_check_clause_temp_table")
136
136
 
137
+ temp_check_clause = check_clause
138
+ # string replace any real enum names with their temp enum names
139
+ temp_enums.each do |temp_enum_name, enum|
140
+ temp_check_clause.gsub!("::#{enum.name}", "::#{temp_enum_name}")
141
+ temp_check_clause.gsub!("::#{enum.full_name}", "::#{temp_enum_name}")
142
+ end
143
+
137
144
  connection.exec(<<~SQL)
138
145
  ALTER TABLE validation_normalized_check_clause_temp_table
139
- ADD CONSTRAINT #{name} CHECK (#{check_clause})
146
+ ADD CONSTRAINT #{name} CHECK (#{temp_check_clause})
140
147
  SQL
141
148
 
142
149
  # get the normalized version of the constraint
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicMigrations
4
- VERSION = "3.8.5"
4
+ VERSION = "3.8.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.5
4
+ version: 3.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott