Class: Fides::Sqlite3Writer

Inherits:
Object
  • Object
show all
Includes:
SqlWriter
Defined in:
lib/fides/sqlite3_writer.rb

Class Method Summary collapse

Methods included from SqlWriter

included

Class Method Details

.executable_add_statements(interface_name, models, polymorphic_model) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fides/sqlite3_writer.rb', line 8

def self.executable_add_statements(interface_name, models, polymorphic_model)
  statements = []
  statements << drop_constraint_sql(interface_name, "create")
  statements << create_constraint_sql(interface_name, models, polymorphic_model)
  models.each do |model|
    statements << drop_constraint_sql(model.constantize.table_name, "delete")
    statements << delete_constraint_sql(interface_name, model, polymorphic_model)
  end
  statements << drop_constraint_sql(interface_name, "update")
  statements << update_constraint_sql(interface_name, models, polymorphic_model)
  return statements
end

.executable_remove_statements(interface_name) ⇒ Object



21
22
23
24
25
26
# File 'lib/fides/sqlite3_writer.rb', line 21

def self.executable_remove_statements(interface_name)
  statements = []
  statements << drop_constraint_sql(interface_name, "create")
  statements << drop_constraint_sql(interface_name, "delete")
  return statements
end