NotParcel/migrations/004_generate_purchases_table.sql
2024-12-30 11:37:46 -07:00

10 lines
407 B
SQL

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)
)