7 lines
431 B
MySQL
7 lines
431 B
MySQL
|
|
-- Partial unique index: prevents duplicate RECORDING_CREATE / RECORDING_FEATURED points
|
||
|
|
-- for the same recording. RECORDING_PLAY / RECORDING_COMPLETE are excluded so a user
|
||
|
|
-- can earn play points across multiple sessions.
|
||
|
|
CREATE UNIQUE INDEX "user_points_unique_action_recording"
|
||
|
|
ON "user_points" ("user_id", "action", "recording_id")
|
||
|
|
WHERE "action" IN ('RECORDING_CREATE', 'RECORDING_FEATURED') AND "recording_id" IS NOT NULL;
|