Civcraft / Bastion

Do not open issues here; open them on the maintained fork @ DevotedMC
https://github.com/DevotedMC/Bastion
2 stars 9 forks source link

DB does not force uniqueness of location #38

Open IAPark opened 8 years ago

IAPark commented 8 years ago

Something else that may be worth considering especially as we're creating a new DB is setting loc_x, loc_y, loc_z, loc_world here to be unique. This would prevent any possible errors resulting in Bastions getting doubled up, might even be worth making it the primary key, but I feel like that's a larger change than we really want to do.

ProgrammerDan commented 8 years ago

So, Civcraft isn't the only server running this plugin, and some might wind up trying to update against live data.

Any changes we make need to at least offer a smooth migration path.

That said, adding a unique constraint post-fact is possible, although tends to be messy for live data. I'll mark this for future consideration :).

IAPark commented 8 years ago

I think it would only create the table if it doesn't already exist so not that big of a deal for other people updating.

ProgrammerDan commented 8 years ago

Good point. My thinking was more that we'd add it as a migration, not to the initial DB craft. If code depends on the uniqueness but we don't enforce it for migrations we create new liabilities for operators.