How can I use a schema to generate something like this:
We have a 1 to many relationship between items and tokens, but an item can only have one minted token, example below:
CREATE TABLE Token (
id INT PRIMARY KEY AUTO_INCREMENT,
itemId INT,
status ENUM('Minted', 'Redeemed'),
uniqueMinted AS (CASE WHEN status = 'Minted' THEN itemId END),
UNIQUE(itemId, uniqueMinted)
);
Im not sure how to handle the uniqueMinted column
0 Replies