Is there any method of constraining column types between tables in MariaDB? When creating foreign keys column types have to match. I would like to make sure two or more columns always stay the same type but without creating FK relationship.
I've got two tables:
playerswith position of player:
yfields with type "TINYINT UNSIGNED"
npcsalso with position of npc:
I want to prevent situation when npcs.x has different type than players.x (and same for
I would imagine that in some distant future somebody might want to change position in favor of something like SIGNED value. I want to be sure that those fields in two tables are still the same type so whenever there is a copy process (spawn npc on player location) data types in those fields are the same.
If there only existed user defined type functionality I will certainly mark those fields the same type here and there. For now I can only think of something like Polymorphic Association as some kind of probable solution here, but I haven't tried it yet.