Sha256: 1742dd790cd3387916ee7d665e044fe875f0d74463c4e64e06be4a8a3ad2cf0f
Contents?: true
Size: 899 Bytes
Versions: 4
Compression:
Stored size: 899 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| if attrs[:indices] && !(attrs[:definition]) raise "Table `#{table_name}` to create the index is not defined: #{attrs[:indices].keys.join(',')}" end end end def check_orphan_foreign_key(definition) definition.each do |table_name, attrs| if attrs[:foreign_keys] && !(attrs[:definition]) raise "Table `#{table_name}` to create the foreign key is not defined: #{attrs[:foreign_keys].keys.join(',')}" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems