Skip to content

Commit

Permalink
add writer
Browse files Browse the repository at this point in the history
  • Loading branch information
toydestroyer committed Apr 16, 2023
1 parent 001c329 commit dc7d2a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/database_consistency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
require 'database_consistency/writers/simple/enum_values_inconsistent_with_ar_enum'
require 'database_consistency/writers/simple/enum_values_inconsistent_with_inclusion'
require 'database_consistency/writers/simple/redundant_case_insensitive_option'
require 'database_consistency/writers/simple/three_state_boolean'
require 'database_consistency/writers/simple_writer'

require 'database_consistency/writers/autofix/helpers/migration'
Expand Down
22 changes: 22 additions & 0 deletions lib/database_consistency/writers/simple/three_state_boolean.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module DatabaseConsistency
module Writers
module Simple
class ThreeStateBoolean < Base # :nodoc:
private

def template
'column should be required in the database'
end

def unique_attributes
{
table_name: report.table_name,
column_name: report.column_name
}
end
end
end
end
end
3 changes: 2 additions & 1 deletion lib/database_consistency/writers/simple_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class SimpleWriter < BaseWriter
missing_foreign_key_cascade: Simple::MissingForeignKeyCascade,
enum_values_inconsistent_with_ar_enum: Simple::EnumValuesInconsistentWithArEnum,
enum_values_inconsistent_with_inclusion: Simple::EnumValuesInconsistentWithInclusion,
redundant_case_insensitive_option: Simple::RedundantCaseInsensitiveOption
redundant_case_insensitive_option: Simple::RedundantCaseInsensitiveOption,
three_state_boolean: Simple::ThreeStateBoolean
}.freeze

def write
Expand Down

0 comments on commit dc7d2a0

Please sign in to comment.