CREATE TABLE IF NOT EXISTS purchases ( id CHAR(36) PRIMARY KEY DEFAULT UUID(), robloxId BIGINT, -- User that made the purchase productId CHAR(36), -- Product that was purchased hubId CHAR(36), -- Hub that the product belongs to FOREIGN KEY (robloxId) REFERENCES users(robloxId), FOREIGN KEY (productId) REFERENCES products(id), FOREIGN KEY (hubId) REFERENCES hubs(id), UNIQUE (productId, robloxId) )