findmypast-oss / mssql_ecto

Ecto adapter for Mssqlex
Apache License 2.0
49 stars 20 forks source link

Alter table remove column migration removes primary key #38

Open pasibonfire opened 6 years ago

pasibonfire commented 6 years ago

Expected Behavior

Removing a column should remove only the column. If the removed column is primary key, only then the constraint should be deleted.

Current Behavior

Migration that removes a column (or rollback for add column) removes the primary key constraint from the table.

Possible Solution

Adding primary_key: false doesn't remove the constraint. If this is expected behaviour, there is no documentation about it.

Steps to Reproduce (for bugs)

  1. Clone https://github.com/pasibonfire/mssql_ecto.git
  2. Checkout branch fix_remove_column
  3. Run docker-compose build
  4. Run docker-compose run mssql_ecto mix test

Context

Your Environment