Closed pyzlnar closed 2 years ago
Hello!
I found a bug on detect_many_columns_index where it would raise an error and crash. This happens when creating a single column index if it also had options.
detect_many_columns_index
Eg:
create index(:a_table, :my_column, where: "arbitrary_option = null")
** (Protocol.UndefinedError) protocol Enumerable not implemented for :my_column of type Atom. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Range, Stream stacktrace: (elixir 1.13.2) lib/enum.ex:1: Enumerable.impl_for!/1 (elixir 1.13.2) lib/enum.ex:155: Enumerable.count/1 (elixir 1.13.2) lib/enum.ex:656: Enum.count/1 (excellent_migrations 0.1.5) lib/ast_parser.ex:60: ExcellentMigrations.AstParser.detect_many_columns_index/1 (excellent_migrations 0.1.5) lib/ast_parser.ex:24: ExcellentMigrations.AstParser.detect_dangers/1 (excellent_migrations 0.1.5) lib/ast_parser.ex:15: anonymous fn/3 in ExcellentMigrations.AstParser.traverse_ast/2 (excellent_migrations 0.1.5) lib/ast_parser.ex:14: ExcellentMigrations.AstParser.traverse_ast/2
This PR fixes the issue and adds a unit test for good measure.
lmk if something else is needed! :)
Hello!
I found a bug on
detect_many_columns_index
where it would raise an error and crash. This happens when creating a single column index if it also had options.Eg:
This PR fixes the issue and adds a unit test for good measure.
lmk if something else is needed! :)