Skip to content

Not wrapping index or unique_index migration macro in create silently fails #656

@deepankar-j

Description

@deepankar-j

Elixir version

1.18.1

Database and Version

SQL Server 2017

Ecto Versions

ecto v3.12.5, ecto_sql v3.12.1

Database Adapter and Versions (postgrex, myxql, etc)

tds 2.3.5

Current behavior

Steps:

  • Create a migration with the following declarations in the change (note that we're purposely forgetting to wrap the functions in a create macro)
       unique_index(:my_table, [:my_column])
       index(:my_table, [:my_column2])
  • Run migration

Expected behavior

Running the migration should fail.

Actual behavior: The migration passes without creating the indices.

This is dangerous because developers (especially with the help of AI coding tools) can easily forget to wrap the index declarations with the requisite create(...) function macro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions