mirraj2 / EZDB

Java MySQL API
MIT License
12 stars 9 forks source link

db.deleteColumn can create index issues. #7

Open mazerakham opened 4 years ago

mazerakham commented 4 years ago
db.createColumn("my_table", "col1", ...);
db.createColumn("my_table", "col2", ...);
db.createIndex("my_table", ImmutableSet.of("col1","col2"), true); // unique index on pairs
[... later, after data has been added ...]
db.deleteColumn("my_table", "col2");

throws exception because the index will no longer be unique. Should it delete the index automatically?

I could certainly accept an answer of, "no, the user should do it manually so they don't silently lose an index they might care about", but it seems worth a discussion.