Sha256: 3ccbdbe75ed71a56944496750e84a072387acfdc1af66e97e3a389e0fae0885a
Contents?: true
Size: 855 Bytes
Versions: 7
Compression:
Stored size: 855 Bytes
Contents
module Ridgepole class DSLParser def initialize(options = {}) @options = options end def parse(dsl, opts = {}) definition, execute = Context.eval(dsl, opts) check_orphan_index(definition) check_orphan_foreign_key(definition) [definition, execute] end private def check_orphan_index(definition) definition.each do |table_name, attrs| raise "Table `#{table_name}` to create the index is not defined: #{attrs[:indices].keys.join(',')}" if attrs[:indices] && !(attrs[:definition]) end end def check_orphan_foreign_key(definition) definition.each do |table_name, attrs| raise "Table `#{table_name}` to create the foreign key is not defined: #{attrs[:foreign_keys].keys.join(',')}" if attrs[:foreign_keys] && !(attrs[:definition]) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems