In my mysql table, I store rows which act as walls on a playing field. The table columns are like:
- id
- owner_id
- x
- y
The id column, is the primary key, the owner_id is the foreign key, the x and y are the location of the wall. How can I set a constraint that the x and y columns together be unique? If I put a unique constraint on both columns, then it will act separately on each column. This is because I don't want 2 existing walls in the same location. But walls can be destroyed and built on that location again later.
Anyone know how to do this?
Thanks