Sha256: 3b1f945360188efc23760bd83901ad2df66d7286d8c9788973724edfa0e18653
Contents?: true
Size: 841 Bytes
Versions: 39
Compression:
Stored size: 841 Bytes
Contents
class Ridgepole::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] and not 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] and not attrs[:definition] raise "Table `#{table_name}` to create the foreign key is not defined: #{attrs[:foreign_keys].keys.join(',')}" end end end end
Version data entries
39 entries across 39 versions & 1 rubygems