lib/ridgepole/dsl_parser.rb in ridgepole-0.8.8 vs lib/ridgepole/dsl_parser.rb in ridgepole-0.8.9

- old
+ new

@@ -35,13 +35,14 @@ return unless attrs[:options][:options]&.include?('ENGINE=InnoDB') attrs[:foreign_keys].each do |_, foreign_key_attrs| fk_index = foreign_key_attrs[:options][:column] || "#{foreign_key_attrs[:to_table].singularize}_id" next if attrs[:indices]&.any? { |_k, v| v[:column_name].first == fk_index } + next if attrs[:options][:primary_key] == fk_index Ridgepole::Logger.instance.warn(<<-MSG) [WARNING] Table `#{table_name}` has a foreign key on `#{fk_index}` column, but doesn't have any indexes on the column. - Although an index will be added automatically by InnoDB, please add an index explicitly for your future operations. + Although an index will be added automatically by InnoDB, please add an index explicitly before the next operation. MSG end end end end