dynamic_migrations 3.6.10 → 3.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93b2822411008957140dcf9902d9e769cfaf10ea99e9ac424f5c57effdaff8f4
4
- data.tar.gz: 38e53d341c2f9fd15231f1eea9c670ed1f724d7ce4a6618b587645faafec7356
3
+ metadata.gz: f31ee44c0dced52756c6f563ea8b321b0cbce5d6cd53f7ef7fb796efb5f7e58a
4
+ data.tar.gz: f3151d84b1574d421d9c122310ce3394f98d4920aa571dc168de2858c91cdc7a
5
5
  SHA512:
6
- metadata.gz: 1f383da41e391a24896b2ae6264710c891f9ab6a46382f70953cf424ccffcee1644e42123ccbe6cb29391d494bb9058c12c93c81a7cba9f20f20755e8eb43d10
7
- data.tar.gz: b77823cc86a9f235be6ad33d6eb48b382c671ab8a60465435f060de14ad981acdc29767645af87e2128c817d9a0cdd24bc7aca1a9352a6be44289ac2d13688d5
6
+ metadata.gz: c090b0758ed52dd8b21a5327e83f6d41f23afc5ad3c53bf265166a85245738c37c5188b15dfed27bb890b36db62896590c7dea3fc8d80e130120d43bd548e560
7
+ data.tar.gz: 74eb4c9ad0d25987f588ccdc0239e460bbc7169a82cec5fc7c837077e822570ac11d61ae7a136a27f49a5c7093c2e91100d22dd3247729bbbb63fd9c316e19f2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.6.11](https://github.com/craigulliott/dynamic_migrations/compare/v3.6.10...v3.6.11) (2023-09-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * injecting dependent_function into templated triggers ([9e770a3](https://github.com/craigulliott/dynamic_migrations/commit/9e770a352b176c7b10471e9185ac01feca538c0c))
9
+ * writing enums to the migration files as arrays of strings for more compatibility with special characters ([1910e0f](https://github.com/craigulliott/dynamic_migrations/commit/1910e0f709e5bd560696c2e2b3bd729c7a61e319))
10
+
3
11
  ## [3.6.10](https://github.com/craigulliott/dynamic_migrations/compare/v3.6.9...v3.6.10) (2023-09-13)
4
12
 
5
13
 
@@ -21,7 +21,7 @@ module DynamicMigrations
21
21
  code_comment: code_comment,
22
22
  migration: <<~RUBY
23
23
  create_enum :#{enum.name}, [
24
- :#{enum.values.join(",\n :")}
24
+ "#{enum.values.join("\",\n \"")}"
25
25
  ]
26
26
  RUBY
27
27
  end
@@ -40,7 +40,7 @@ module DynamicMigrations
40
40
  code_comment: code_comment,
41
41
  migration: <<~RUBY
42
42
  add_enum_values :#{updated_enum.name}, [
43
- :#{added_values.join(",\n :")}
43
+ "#{added_values.join("\",\n \"")}"
44
44
  ]
45
45
  RUBY
46
46
  end
@@ -32,7 +32,15 @@ module DynamicMigrations
32
32
  end
33
33
 
34
34
  arguments = template_class.new(trigger, code_comment).fragment_arguments
35
- add_fragment(**arguments)
35
+
36
+ # we only provide a dependent function if the function has more than one trigger
37
+ # or is in a different schema, otherwise it is added to the same migration as this
38
+ # trigger and we don't need to worry about dependencies
39
+ if trigger.function && (trigger.function.triggers.count > 1 || trigger.table.schema != trigger.function.schema)
40
+ add_fragment(dependent_function: trigger.function, **arguments)
41
+ else
42
+ add_fragment(**arguments)
43
+ end
36
44
 
37
45
  # no template, process this as a default trigger (takes all options)
38
46
  else
@@ -50,7 +50,7 @@ module DynamicMigrations
50
50
  process_schema schema_name, differences[:configuration][:schemas][schema_name], differences[:database][:schemas][schema_name]
51
51
  end
52
52
 
53
- # return the migrations organized by schema
53
+ # return the migrations (they are sorted via a dependency algorithm)
54
54
  @generator.migrations
55
55
  end
56
56
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicMigrations
4
- VERSION = "3.6.10"
4
+ VERSION = "3.6.11"
5
5
  end
@@ -12,7 +12,7 @@ module DynamicMigrations
12
12
  def initialize: (untyped validation, untyped code_comment) -> void
13
13
 
14
14
  # abstract method (should actually be added to child classes)
15
- def fragment_arguments: -> {schema: Postgres::Server::Database::Schema, table: Postgres::Server::Database::Schema::Table, migration_method: :add_validation, object: Postgres::Server::Database::Schema::Table::Validation, code_comment: String?, migration: String}
15
+ def fragment_arguments: -> {schema: Postgres::Server::Database::Schema, table: Postgres::Server::Database::Schema::Table, migration_method: Symbol, object: untyped, code_comment: String?, migration: String, dependent_function: Postgres::Server::Database::Schema::Function?}
16
16
 
17
17
  private
18
18
  def assert_not_deferred!: -> nil
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.6.10
4
+ version: 3.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott