dynamic_migrations 3.8.6 → 3.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/lib/dynamic_migrations/postgres/generator/enum.rb +13 -9
  4. data/lib/dynamic_migrations/postgres/generator/fragment.rb +1 -1
  5. data/lib/dynamic_migrations/postgres/generator/function.rb +13 -13
  6. data/lib/dynamic_migrations/postgres/generator/migration.rb +45 -7
  7. data/lib/dynamic_migrations/postgres/generator/table_migration.rb +2 -0
  8. data/lib/dynamic_migrations/postgres/generator.rb +100 -46
  9. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/extensions.rb +2 -2
  10. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/enums.rb +10 -10
  11. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/functions.rb +11 -11
  12. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/columns.rb +11 -11
  13. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/foreign_key_constraints.rb +11 -11
  14. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/indexes.rb +11 -11
  15. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/primary_key.rb +6 -6
  16. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/triggers.rb +11 -11
  17. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/unique_constraints.rb +11 -11
  18. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables/validations.rb +11 -11
  19. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas/tables.rb +8 -8
  20. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations/schemas.rb +3 -3
  21. data/lib/dynamic_migrations/postgres/server/database/differences/to_migrations.rb +4 -4
  22. data/lib/dynamic_migrations/postgres/server/database/differences.rb +17 -17
  23. data/lib/dynamic_migrations/postgres/server/database/schema/enum.rb +7 -0
  24. data/lib/dynamic_migrations/postgres/server/database/schema/table.rb +61 -1
  25. data/lib/dynamic_migrations/version.rb +1 -1
  26. data/sig/dynamic_migrations/postgres/generator/enum.rbs +2 -0
  27. data/sig/dynamic_migrations/postgres/generator/function.rbs +1 -0
  28. data/sig/dynamic_migrations/postgres/generator/migration.rbs +1 -0
  29. data/sig/dynamic_migrations/postgres/generator/schema_migration.rbs +2 -0
  30. data/sig/dynamic_migrations/postgres/generator/table_migration.rbs +3 -0
  31. data/sig/dynamic_migrations/postgres/generator.rbs +3 -1
  32. data/sig/dynamic_migrations/postgres/server/database/schema/enum.rbs +3 -0
  33. data/sig/dynamic_migrations/postgres/server/database/schema/table.rbs +3 -0
  34. metadata +2 -2
@@ -10,10 +10,10 @@ module DynamicMigrations
10
10
  module Functions
11
11
  def process_functions schema_name, configuration_functions, database_functions
12
12
  # process all the functions
13
- log.info " Processing Functions..."
13
+ log.debug " Processing Functions"
14
14
  function_names = (configuration_functions.keys + database_functions.keys).uniq
15
15
  function_names.each do |function_name|
16
- log.info " Processing Function #{function_name}..."
16
+ log.debug " Processing Function #{function_name}"
17
17
  process_function schema_name, function_name, configuration_functions[function_name] || {}, database_functions[function_name] || {}
18
18
  end
19
19
  end
@@ -22,7 +22,7 @@ module DynamicMigrations
22
22
  # If the function exists in the configuration but not in the database
23
23
  # then we have to create it.
24
24
  if configuration_function[:exists] == true && !database_function[:exists]
25
- log.info " Function `#{function_name}` exists in configuration but not in the database"
25
+ log.debug " Function `#{function_name}` exists in configuration but not in the database"
26
26
 
27
27
  # a migration to create the function
28
28
  function = @database.configured_schema(schema_name).function(function_name)
@@ -31,7 +31,7 @@ module DynamicMigrations
31
31
  # If the schema exists in the database but not in the configuration
32
32
  # then we need to delete it.
33
33
  elsif database_function[:exists] == true && !configuration_function[:exists]
34
- log.info " Function `#{function_name}` exists in database but not in the configuration"
34
+ log.debug " Function `#{function_name}` exists in database but not in the configuration"
35
35
 
36
36
  # a migration to create the function
37
37
  function = @database.loaded_schema(schema_name).function(function_name)
@@ -40,19 +40,19 @@ module DynamicMigrations
40
40
  # If the function exists in both the configuration and database representations
41
41
  # but the definition is different then we need to update the definition.
42
42
  elsif configuration_function[:normalized_definition][:matches] == false
43
- log.info " Function `#{function_name}` exists in both configuration and the database"
43
+ log.debug " Function `#{function_name}` exists in both configuration and the database"
44
44
 
45
- log.info " Function `#{function_name}` definition is different"
45
+ log.debug " Function `#{function_name}` definition is different"
46
46
  function = @database.configured_schema(schema_name).function(function_name)
47
47
  @generator.update_function function
48
48
  # does the description also need to be updated
49
49
  if configuration_function[:description][:matches] == false
50
50
  # if the description was removed
51
51
  if configuration_function[:description].nil?
52
- log.info " Function `#{function_name}` description exists in database but not in the configuration"
52
+ log.debug " Function `#{function_name}` description exists in database but not in the configuration"
53
53
  @generator.remove_function_comment function
54
54
  else
55
- log.info " Function `#{function_name}` description does not match"
55
+ log.debug " Function `#{function_name}` description does not match"
56
56
  @generator.set_function_comment function
57
57
  end
58
58
  end
@@ -60,15 +60,15 @@ module DynamicMigrations
60
60
  # If the function exists in both the configuration and database representations
61
61
  # but the description is different then we need to update the description.
62
62
  elsif configuration_function[:description][:matches] == false
63
- log.info " Function `#{function_name}` exists in both configuration and the database"
63
+ log.debug " Function `#{function_name}` exists in both configuration and the database"
64
64
 
65
65
  function = @database.configured_schema(schema_name).function(function_name)
66
66
  # if the description was removed
67
67
  if configuration_function[:description].nil?
68
- log.info " Function `#{function_name}` description exists in database but not in the configuration"
68
+ log.debug " Function `#{function_name}` description exists in database but not in the configuration"
69
69
  @generator.remove_function_comment function
70
70
  else
71
- log.info " Function `#{function_name}` description does not match"
71
+ log.debug " Function `#{function_name}` description does not match"
72
72
  @generator.set_function_comment function
73
73
  end
74
74
  end
@@ -11,10 +11,10 @@ module DynamicMigrations
11
11
  module Columns
12
12
  def process_columns schema_name, table_name, configuration_columns, database_columns
13
13
  # process all the columns
14
- log.info " Processing Columns..."
14
+ log.debug " Processing Columns"
15
15
  column_names = (configuration_columns.keys + database_columns.keys).uniq
16
16
  column_names.each do |column_name|
17
- log.info " Processing Column #{column_name}..."
17
+ log.debug " Processing Column #{column_name}"
18
18
  process_column schema_name, table_name, column_name, configuration_columns[column_name] || {}, database_columns[column_name] || {}
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ module DynamicMigrations
23
23
  # If the column exists in the configuration but not in the database
24
24
  # then we have to create it.
25
25
  if configuration_column[:exists] == true && !database_column[:exists]
26
- log.info " Column `#{column_name}` exists in configuration but not in the database"
26
+ log.debug " Column `#{column_name}` exists in configuration but not in the database"
27
27
 
28
28
  # a migration to create the column
29
29
  column = @database.configured_schema(schema_name).table(table_name).column(column_name)
@@ -32,7 +32,7 @@ module DynamicMigrations
32
32
  # If the schema exists in the database but not in the configuration
33
33
  # then we need to delete it.
34
34
  elsif database_column[:exists] == true && !configuration_column[:exists]
35
- log.info " Column `#{column_name}` exists in database but not in the configuration"
35
+ log.debug " Column `#{column_name}` exists in database but not in the configuration"
36
36
 
37
37
  # a migration to create the column
38
38
  column = @database.loaded_schema(schema_name).table(table_name).column(column_name)
@@ -42,9 +42,9 @@ module DynamicMigrations
42
42
  # but the definition (except description, which is handled seeprately below) is different
43
43
  # then we need to update the definition.
44
44
  elsif configuration_column.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
45
- log.info " Column `#{column_name}` exists in both configuration and the database"
45
+ log.debug " Column `#{column_name}` exists in both configuration and the database"
46
46
 
47
- log.info " Column `#{column_name}` is different"
47
+ log.debug " Column `#{column_name}` is different"
48
48
  # update the column
49
49
  column = @database.configured_schema(schema_name).table(table_name).column(column_name)
50
50
  @generator.change_column column
@@ -52,10 +52,10 @@ module DynamicMigrations
52
52
  if configuration_column[:description][:matches] == false
53
53
  # if the description was removed
54
54
  if configuration_column[:description].nil?
55
- log.info " Column `#{column_name}` description exists in database but not in the configuration"
55
+ log.debug " Column `#{column_name}` description exists in database but not in the configuration"
56
56
  @generator.remove_column_comment column
57
57
  else
58
- log.info " Column `#{column_name}` description does not match"
58
+ log.debug " Column `#{column_name}` description does not match"
59
59
  @generator.set_column_comment column
60
60
  end
61
61
  end
@@ -63,15 +63,15 @@ module DynamicMigrations
63
63
  # If the column exists in both the configuration and database representations
64
64
  # but the description is different then we need to update the description.
65
65
  elsif configuration_column[:description][:matches] == false
66
- log.info " Column `#{column_name}` exists in both configuration and the database"
66
+ log.debug " Column `#{column_name}` exists in both configuration and the database"
67
67
 
68
68
  column = @database.configured_schema(schema_name).table(table_name).column(column_name)
69
69
  # if the description was removed
70
70
  if configuration_column[:description].nil?
71
- log.info " Column `#{column_name}` description exists in database but not in the configuration"
71
+ log.debug " Column `#{column_name}` description exists in database but not in the configuration"
72
72
  @generator.remove_column_comment column
73
73
  else
74
- log.info " Column `#{column_name}` description does not match"
74
+ log.debug " Column `#{column_name}` description does not match"
75
75
  @generator.set_column_comment column
76
76
  end
77
77
  end
@@ -11,10 +11,10 @@ module DynamicMigrations
11
11
  module ForeignKeyConstraints
12
12
  def process_foreign_key_constraints schema_name, table_name, configuration_foreign_key_constraints, database_foreign_key_constraints
13
13
  # process all the foreign_key_constraints
14
- log.info " Processing Foreign Key Constraints..."
14
+ log.debug " Processing Foreign Key Constraints"
15
15
  foreign_key_constraint_names = (configuration_foreign_key_constraints.keys + database_foreign_key_constraints.keys).uniq
16
16
  foreign_key_constraint_names.each do |foreign_key_constraint_name|
17
- log.info " Processing Foreign Key Constraint #{foreign_key_constraint_name}..."
17
+ log.debug " Processing Foreign Key Constraint #{foreign_key_constraint_name}"
18
18
  process_foreign_key_constraint schema_name, table_name, foreign_key_constraint_name, configuration_foreign_key_constraints[foreign_key_constraint_name] || {}, database_foreign_key_constraints[foreign_key_constraint_name] || {}
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ module DynamicMigrations
23
23
  # If the foreign_key_constraint exists in the configuration but not in the database
24
24
  # then we have to create it.
25
25
  if configuration_foreign_key_constraint[:exists] == true && !database_foreign_key_constraint[:exists]
26
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in configuration but not in the database"
26
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in configuration but not in the database"
27
27
 
28
28
  # a migration to create the foreign_key_constraint
29
29
  foreign_key_constraint = @database.configured_schema(schema_name).table(table_name).foreign_key_constraint(foreign_key_constraint_name)
@@ -32,7 +32,7 @@ module DynamicMigrations
32
32
  # If the schema exists in the database but not in the configuration
33
33
  # then we need to delete it.
34
34
  elsif database_foreign_key_constraint[:exists] == true && !configuration_foreign_key_constraint[:exists]
35
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in database but not in the configuration"
35
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in database but not in the configuration"
36
36
 
37
37
  # a migration to create the foreign_key_constraint
38
38
  foreign_key_constraint = @database.loaded_schema(schema_name).table(table_name).foreign_key_constraint(foreign_key_constraint_name)
@@ -42,9 +42,9 @@ module DynamicMigrations
42
42
  # but the definition (except description, which is handled seeprately below) is different
43
43
  # then we need to update the definition.
44
44
  elsif configuration_foreign_key_constraint.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
45
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in both configuration and the database"
45
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in both configuration and the database"
46
46
 
47
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` is different"
47
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` is different"
48
48
  # recreate the foreign_key_constraint
49
49
  original_foreign_key_constraint = @database.loaded_schema(schema_name).table(table_name).foreign_key_constraint(foreign_key_constraint_name)
50
50
  updated_foreign_key_constraint = @database.configured_schema(schema_name).table(table_name).foreign_key_constraint(foreign_key_constraint_name)
@@ -53,10 +53,10 @@ module DynamicMigrations
53
53
  if configuration_foreign_key_constraint[:description][:matches] == false
54
54
  # if the description was removed
55
55
  if configuration_foreign_key_constraint[:description].nil?
56
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` description exists in database but not in the configuration"
56
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` description exists in database but not in the configuration"
57
57
  @generator.remove_foreign_key_constraint_comment updated_foreign_key_constraint
58
58
  else
59
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` does not match"
59
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` does not match"
60
60
  @generator.set_foreign_key_constraint_comment updated_foreign_key_constraint
61
61
  end
62
62
  end
@@ -64,15 +64,15 @@ module DynamicMigrations
64
64
  # If the foreign_key_constraint exists in both the configuration and database representations
65
65
  # but the description is different then we need to update the description.
66
66
  elsif configuration_foreign_key_constraint[:description][:matches] == false
67
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in both configuration and the database"
67
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` exists in both configuration and the database"
68
68
 
69
69
  foreign_key_constraint = @database.configured_schema(schema_name).table(table_name).foreign_key_constraint(foreign_key_constraint_name)
70
70
  # if the description was removed
71
71
  if configuration_foreign_key_constraint[:description].nil?
72
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` description exists in database but not in the configuration"
72
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` description exists in database but not in the configuration"
73
73
  @generator.remove_foreign_key_constraint_comment foreign_key_constraint
74
74
  else
75
- log.info " Foreign Key Constraint `#{foreign_key_constraint_name}` description does not match"
75
+ log.debug " Foreign Key Constraint `#{foreign_key_constraint_name}` description does not match"
76
76
  @generator.set_foreign_key_constraint_comment foreign_key_constraint
77
77
  end
78
78
  end
@@ -11,10 +11,10 @@ module DynamicMigrations
11
11
  module Indexes
12
12
  def process_indexes schema_name, table_name, configuration_indexes, database_indexes
13
13
  # process all the indexes
14
- log.info " Processing Indexes..."
14
+ log.debug " Processing Indexes"
15
15
  index_names = (configuration_indexes.keys + database_indexes.keys).uniq
16
16
  index_names.each do |index_name|
17
- log.info " Processing Index #{index_name}..."
17
+ log.debug " Processing Index #{index_name}"
18
18
  process_index schema_name, table_name, index_name, configuration_indexes[index_name] || {}, database_indexes[index_name] || {}
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ module DynamicMigrations
23
23
  # If the index exists in the configuration but not in the database
24
24
  # then we have to create it.
25
25
  if configuration_index[:exists] == true && !database_index[:exists]
26
- log.info " Index `#{index_name}` exists in configuration but not in the database"
26
+ log.debug " Index `#{index_name}` exists in configuration but not in the database"
27
27
 
28
28
  # a migration to create the index
29
29
  index = @database.configured_schema(schema_name).table(table_name).index(index_name)
@@ -32,7 +32,7 @@ module DynamicMigrations
32
32
  # If the schema exists in the database but not in the configuration
33
33
  # then we need to delete it.
34
34
  elsif database_index[:exists] == true && !configuration_index[:exists]
35
- log.info " Index `#{index_name}` exists in database but not in the configuration"
35
+ log.debug " Index `#{index_name}` exists in database but not in the configuration"
36
36
 
37
37
  # a migration to create the index
38
38
  index = @database.loaded_schema(schema_name).table(table_name).index(index_name)
@@ -42,9 +42,9 @@ module DynamicMigrations
42
42
  # but the definition (except description, which is handled seeprately below) is different
43
43
  # then we need to update the definition.
44
44
  elsif configuration_index.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
45
- log.info " Index `#{index_name}` exists in both configuration and the database"
45
+ log.debug " Index `#{index_name}` exists in both configuration and the database"
46
46
 
47
- log.info " Index `#{index_name}` is different"
47
+ log.debug " Index `#{index_name}` is different"
48
48
  # rebild the index
49
49
  original_index = @database.loaded_schema(schema_name).table(table_name).index(index_name)
50
50
  updated_index = @database.configured_schema(schema_name).table(table_name).index(index_name)
@@ -53,10 +53,10 @@ module DynamicMigrations
53
53
  if configuration_index[:description][:matches] == false
54
54
  # if the description was removed
55
55
  if configuration_index[:description].nil?
56
- log.info " Index `#{index_name}` description exists in database but not in the configuration"
56
+ log.debug " Index `#{index_name}` description exists in database but not in the configuration"
57
57
  @generator.remove_index_comment updated_index
58
58
  else
59
- log.info " Index `#{index_name}` does not match"
59
+ log.debug " Index `#{index_name}` does not match"
60
60
  @generator.set_index_comment updated_index
61
61
  end
62
62
  end
@@ -64,15 +64,15 @@ module DynamicMigrations
64
64
  # If the index exists in both the configuration and database representations
65
65
  # but the description is different then we need to update the description.
66
66
  elsif configuration_index[:description][:matches] == false
67
- log.info " Index `#{index_name}` exists in both configuration and the database"
67
+ log.debug " Index `#{index_name}` exists in both configuration and the database"
68
68
 
69
69
  index = @database.configured_schema(schema_name).table(table_name).index(index_name)
70
70
  # if the description was removed
71
71
  if configuration_index[:description].nil?
72
- log.info " Index `#{index_name}` description exists in database but not in the configuration"
72
+ log.debug " Index `#{index_name}` description exists in database but not in the configuration"
73
73
  @generator.remove_index_comment index
74
74
  else
75
- log.info " Index `#{index_name}` description does not match"
75
+ log.debug " Index `#{index_name}` description does not match"
76
76
  @generator.set_index_comment index
77
77
  end
78
78
  end
@@ -10,14 +10,14 @@ module DynamicMigrations
10
10
  module Tables
11
11
  module PrimaryKey
12
12
  def process_primary_key schema_name, table_name, configuration_primary_key, database_primary_key
13
- log.info " Processing Primary Key..."
13
+ log.debug " Processing Primary Key"
14
14
  configuration_primary_key_exists = configuration_primary_key && configuration_primary_key[:exists]
15
15
  database_primary_key_exists = database_primary_key && database_primary_key[:exists]
16
16
 
17
17
  # If the primary_key exists in the configuration but not in the database
18
18
  # then we have to create it.
19
19
  if configuration_primary_key_exists == true && database_primary_key_exists == false
20
- log.info " Primary Key exists in configuration but not in the database"
20
+ log.debug " Primary Key exists in configuration but not in the database"
21
21
 
22
22
  # a migration to create the primary_key
23
23
  primary_key = @database.configured_schema(schema_name).table(table_name).primary_key
@@ -26,7 +26,7 @@ module DynamicMigrations
26
26
  # If the schema exists in the database but not in the configuration
27
27
  # then we need to delete it.
28
28
  elsif configuration_primary_key_exists == false && database_primary_key_exists == true
29
- log.info " Primary Key exists in database but not in the configuration"
29
+ log.debug " Primary Key exists in database but not in the configuration"
30
30
 
31
31
  # a migration to create the primary_key
32
32
  primary_key = @database.loaded_schema(schema_name).table(table_name).primary_key
@@ -34,18 +34,18 @@ module DynamicMigrations
34
34
 
35
35
  # If the primary_key exists in both the configuration and database representations
36
36
  elsif configuration_primary_key_exists == true && database_primary_key_exists == true
37
- log.info " Primary Key exists in both configuration and the database"
37
+ log.debug " Primary Key exists in both configuration and the database"
38
38
 
39
39
  # If the definition (i.e. the column names) is different then we need to update the primary key.
40
40
  if configuration_primary_key.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
41
- log.info " Primary Key is different"
41
+ log.debug " Primary Key is different"
42
42
  # recreate the primary_key
43
43
  original_primary_key = @database.loaded_schema(schema_name).table(table_name).primary_key
44
44
  updated_primary_key = @database.configured_schema(schema_name).table(table_name).primary_key
45
45
  @generator.recreate_primary_key original_primary_key, updated_primary_key
46
46
  end
47
47
  else
48
- log.info " Primary Key does not exist in either configuration or database"
48
+ log.debug " Primary Key does not exist in either configuration or database"
49
49
  end
50
50
  end
51
51
  end
@@ -10,11 +10,11 @@ module DynamicMigrations
10
10
  module Tables
11
11
  module Triggers
12
12
  def process_triggers schema_name, table_name, configuration_triggers, database_triggers
13
- log.info " Processing Triggers..."
13
+ log.debug " Processing Triggers"
14
14
  # process all the triggers
15
15
  trigger_names = (configuration_triggers.keys + database_triggers.keys).uniq
16
16
  trigger_names.each do |trigger_name|
17
- log.info " Processing Trigger #{trigger_name}..."
17
+ log.debug " Processing Trigger #{trigger_name}"
18
18
  process_trigger schema_name, table_name, trigger_name, configuration_triggers[trigger_name] || {}, database_triggers[trigger_name] || {}
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ module DynamicMigrations
23
23
  # If the trigger exists in the configuration but not in the database
24
24
  # then we have to create it.
25
25
  if configuration_trigger[:exists] == true && !database_trigger[:exists]
26
- log.info " Trigger `#{trigger_name}` exists in configuration but not in the database"
26
+ log.debug " Trigger `#{trigger_name}` exists in configuration but not in the database"
27
27
 
28
28
  # a migration to create the trigger
29
29
  trigger = @database.configured_schema(schema_name).table(table_name).trigger(trigger_name)
@@ -32,7 +32,7 @@ module DynamicMigrations
32
32
  # If the schema exists in the database but not in the configuration
33
33
  # then we need to delete it.
34
34
  elsif database_trigger[:exists] == true && !configuration_trigger[:exists]
35
- log.info " Trigger `#{trigger_name}` exists in database but not in the configuration"
35
+ log.debug " Trigger `#{trigger_name}` exists in database but not in the configuration"
36
36
 
37
37
  # a migration to create the trigger
38
38
  trigger = @database.loaded_schema(schema_name).table(table_name).trigger(trigger_name)
@@ -42,9 +42,9 @@ module DynamicMigrations
42
42
  # but the definition (except description, which is handled seeprately below) is different
43
43
  # then we need to update the definition.
44
44
  elsif configuration_trigger.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
45
- log.info " Trigger `#{trigger_name}` exists in both configuration and the database"
45
+ log.debug " Trigger `#{trigger_name}` exists in both configuration and the database"
46
46
 
47
- log.info " Trigger `#{trigger_name}` is different"
47
+ log.debug " Trigger `#{trigger_name}` is different"
48
48
  # recreate the trigger
49
49
  original_trigger = @database.loaded_schema(schema_name).table(table_name).trigger(trigger_name)
50
50
  updated_trigger = @database.configured_schema(schema_name).table(table_name).trigger(trigger_name)
@@ -53,10 +53,10 @@ module DynamicMigrations
53
53
  if configuration_trigger[:description][:matches] == false
54
54
  # if the description was removed
55
55
  if configuration_trigger[:description].nil?
56
- log.info " Trigger `#{trigger_name}` description exists in database but not in the configuration"
56
+ log.debug " Trigger `#{trigger_name}` description exists in database but not in the configuration"
57
57
  @generator.remove_trigger_comment updated_trigger
58
58
  else
59
- log.info " Trigger `#{trigger_name}` description does not match"
59
+ log.debug " Trigger `#{trigger_name}` description does not match"
60
60
  @generator.set_trigger_comment updated_trigger
61
61
  end
62
62
  end
@@ -64,15 +64,15 @@ module DynamicMigrations
64
64
  # If the trigger exists in both the configuration and database representations
65
65
  # but the description is different then we need to update the description.
66
66
  elsif configuration_trigger[:description][:matches] == false
67
- log.info " Trigger `#{trigger_name}` exists in both configuration and the database"
67
+ log.debug " Trigger `#{trigger_name}` exists in both configuration and the database"
68
68
 
69
69
  trigger = @database.configured_schema(schema_name).table(table_name).trigger(trigger_name)
70
70
  # if the description was removed
71
71
  if configuration_trigger[:description].nil?
72
- log.info " Trigger `#{trigger_name}` description exists in database but not in the configuration"
72
+ log.debug " Trigger `#{trigger_name}` description exists in database but not in the configuration"
73
73
  @generator.remove_trigger_comment trigger
74
74
  else
75
- log.info " Trigger `#{trigger_name}` description does not match"
75
+ log.debug " Trigger `#{trigger_name}` description does not match"
76
76
  @generator.set_trigger_comment trigger
77
77
  end
78
78
  end
@@ -10,11 +10,11 @@ module DynamicMigrations
10
10
  module Tables
11
11
  module UniqueConstraints
12
12
  def process_unique_constraints schema_name, table_name, configuration_unique_constraints, database_unique_constraints
13
- log.info " Processing Unique Constraints..."
13
+ log.debug " Processing Unique Constraints"
14
14
  # process all the unique_constraints
15
15
  unique_constraint_names = (configuration_unique_constraints.keys + database_unique_constraints.keys).uniq
16
16
  unique_constraint_names.each do |unique_constraint_name|
17
- log.info " Processing Unique Constraint #{unique_constraint_name}..."
17
+ log.debug " Processing Unique Constraint #{unique_constraint_name}"
18
18
  process_unique_constraint schema_name, table_name, unique_constraint_name, configuration_unique_constraints[unique_constraint_name] || {}, database_unique_constraints[unique_constraint_name] || {}
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ module DynamicMigrations
23
23
  # If the unique_constraint exists in the configuration but not in the database
24
24
  # then we have to create it.
25
25
  if configuration_unique_constraint[:exists] == true && !database_unique_constraint[:exists]
26
- log.info " Unique Constraint `#{unique_constraint_name}` exists in configuration but not in the database"
26
+ log.debug " Unique Constraint `#{unique_constraint_name}` exists in configuration but not in the database"
27
27
 
28
28
  # a migration to create the unique_constraint
29
29
  unique_constraint = @database.configured_schema(schema_name).table(table_name).unique_constraint(unique_constraint_name)
@@ -32,7 +32,7 @@ module DynamicMigrations
32
32
  # If the schema exists in the database but not in the configuration
33
33
  # then we need to delete it.
34
34
  elsif database_unique_constraint[:exists] == true && !configuration_unique_constraint[:exists]
35
- log.info " Unique Constraint `#{unique_constraint_name}` exists in database but not in the configuration"
35
+ log.debug " Unique Constraint `#{unique_constraint_name}` exists in database but not in the configuration"
36
36
 
37
37
  # a migration to create the unique_constraint
38
38
  unique_constraint = @database.loaded_schema(schema_name).table(table_name).unique_constraint(unique_constraint_name)
@@ -42,9 +42,9 @@ module DynamicMigrations
42
42
  # but the definition (except description, which is handled seeprately below) is different
43
43
  # then we need to update the definition.
44
44
  elsif configuration_unique_constraint.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
45
- log.info " Unique Constraint `#{unique_constraint_name}` exists in both configuration and the database"
45
+ log.debug " Unique Constraint `#{unique_constraint_name}` exists in both configuration and the database"
46
46
 
47
- log.info " Unique Constraint `#{unique_constraint_name}` is different"
47
+ log.debug " Unique Constraint `#{unique_constraint_name}` is different"
48
48
  # recreate the unique_constraint
49
49
  original_unique_constraint = @database.loaded_schema(schema_name).table(table_name).unique_constraint(unique_constraint_name)
50
50
  updated_unique_constraint = @database.configured_schema(schema_name).table(table_name).unique_constraint(unique_constraint_name)
@@ -53,10 +53,10 @@ module DynamicMigrations
53
53
  if configuration_unique_constraint[:description][:matches] == false
54
54
  # if the description was removed
55
55
  if configuration_unique_constraint[:description].nil?
56
- log.info " Unique Constraint `#{unique_constraint_name}` description exists in database but not in the configuration"
56
+ log.debug " Unique Constraint `#{unique_constraint_name}` description exists in database but not in the configuration"
57
57
  @generator.remove_unique_constraint_comment updated_unique_constraint
58
58
  else
59
- log.info " Unique Constraint `#{unique_constraint_name}` description does not match"
59
+ log.debug " Unique Constraint `#{unique_constraint_name}` description does not match"
60
60
  @generator.set_unique_constraint_comment updated_unique_constraint
61
61
  end
62
62
  end
@@ -64,15 +64,15 @@ module DynamicMigrations
64
64
  # If the unique_constraint exists in both the configuration and database representations
65
65
  # but the description is different then we need to update the description.
66
66
  elsif configuration_unique_constraint[:description][:matches] == false
67
- log.info " Unique Constraint `#{unique_constraint_name}` exists in both configuration and the database"
67
+ log.debug " Unique Constraint `#{unique_constraint_name}` exists in both configuration and the database"
68
68
 
69
69
  unique_constraint = @database.configured_schema(schema_name).table(table_name).unique_constraint(unique_constraint_name)
70
70
  # if the description was removed
71
71
  if configuration_unique_constraint[:description].nil?
72
- log.info " Unique Constraint `#{unique_constraint_name}` description exists in database but not in the configuration"
72
+ log.debug " Unique Constraint `#{unique_constraint_name}` description exists in database but not in the configuration"
73
73
  @generator.remove_unique_constraint_comment unique_constraint
74
74
  else
75
- log.info " Unique Constraint `#{unique_constraint_name}` description does not match"
75
+ log.debug " Unique Constraint `#{unique_constraint_name}` description does not match"
76
76
  @generator.set_unique_constraint_comment unique_constraint
77
77
  end
78
78
  end
@@ -11,10 +11,10 @@ module DynamicMigrations
11
11
  module Validations
12
12
  def process_validations schema_name, table_name, configuration_validations, database_validations
13
13
  # process all the validations
14
- log.info " Processing Validations..."
14
+ log.debug " Processing Validations"
15
15
  validation_names = (configuration_validations.keys + database_validations.keys).uniq
16
16
  validation_names.each do |validation_name|
17
- log.info " Processing Validation #{validation_name}..."
17
+ log.debug " Processing Validation #{validation_name}"
18
18
  process_validation schema_name, table_name, validation_name, configuration_validations[validation_name] || {}, database_validations[validation_name] || {}
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ module DynamicMigrations
23
23
  # If the validation exists in the configuration but not in the database
24
24
  # then we have to create it.
25
25
  if configuration_validation[:exists] == true && !database_validation[:exists]
26
- log.info " Validation `#{validation_name}` exists in configuration but not in the database"
26
+ log.debug " Validation `#{validation_name}` exists in configuration but not in the database"
27
27
 
28
28
  # a migration to create the validation
29
29
  validation = @database.configured_schema(schema_name).table(table_name).validation(validation_name)
@@ -32,7 +32,7 @@ module DynamicMigrations
32
32
  # If the schema exists in the database but not in the configuration
33
33
  # then we need to delete it.
34
34
  elsif database_validation[:exists] == true && !configuration_validation[:exists]
35
- log.info " Validation `#{validation_name}` exists in database but not in the configuration"
35
+ log.debug " Validation `#{validation_name}` exists in database but not in the configuration"
36
36
 
37
37
  # a migration to create the validation
38
38
  validation = @database.loaded_schema(schema_name).table(table_name).validation(validation_name)
@@ -42,9 +42,9 @@ module DynamicMigrations
42
42
  # but the definition (except description, which is handled seeprately below) is different
43
43
  # then we need to update the definition.
44
44
  elsif configuration_validation.except(:exists, :description).filter { |name, attributes| attributes[:matches] == false }.any?
45
- log.info " Validation `#{validation_name}` exists in both configuration and the database"
45
+ log.debug " Validation `#{validation_name}` exists in both configuration and the database"
46
46
 
47
- log.info " Validation `#{validation_name}` is different"
47
+ log.debug " Validation `#{validation_name}` is different"
48
48
  # recreate the validation
49
49
  original_validation = @database.loaded_schema(schema_name).table(table_name).validation(validation_name)
50
50
  updated_validation = @database.configured_schema(schema_name).table(table_name).validation(validation_name)
@@ -53,10 +53,10 @@ module DynamicMigrations
53
53
  if configuration_validation[:description][:matches] == false
54
54
  # if the description was removed
55
55
  if configuration_validation[:description].nil?
56
- log.info " Validation `#{validation_name}` description exists in database but not in the configuration"
56
+ log.debug " Validation `#{validation_name}` description exists in database but not in the configuration"
57
57
  @generator.remove_validation_comment updated_validation
58
58
  else
59
- log.info " Validation `#{validation_name}` does not match"
59
+ log.debug " Validation `#{validation_name}` does not match"
60
60
  @generator.set_validation_comment updated_validation
61
61
  end
62
62
  end
@@ -64,15 +64,15 @@ module DynamicMigrations
64
64
  # If the validation exists in both the configuration and database representations
65
65
  # but the description is different then we need to update the description.
66
66
  elsif configuration_validation[:description][:matches] == false
67
- log.info " Validation `#{validation_name}` exists in both configuration and the database"
67
+ log.debug " Validation `#{validation_name}` exists in both configuration and the database"
68
68
 
69
69
  validation = @database.configured_schema(schema_name).table(table_name).validation(validation_name)
70
70
  # if the description was removed
71
71
  if configuration_validation[:description].nil?
72
- log.info " Validation `#{validation_name}` description exists in database but not in the configuration"
72
+ log.debug " Validation `#{validation_name}` description exists in database but not in the configuration"
73
73
  @generator.remove_validation_comment validation
74
74
  else
75
- log.info " Validation `#{validation_name}` does not match"
75
+ log.debug " Validation `#{validation_name}` does not match"
76
76
  @generator.set_validation_comment validation
77
77
  end
78
78
  end