mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
Add provisional payout estimates
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE payout_estimates (
|
||||
period DATE NOT NULL
|
||||
CHECK (EXTRACT(DAY FROM period) = 1),
|
||||
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
mod_id BIGINT NOT NULL REFERENCES mods(id) ON DELETE CASCADE,
|
||||
amount NUMERIC(40, 20) NOT NULL
|
||||
CHECK (amount >= 0),
|
||||
created TIMESTAMPTZ NOT NULL,
|
||||
date_available TIMESTAMPTZ NOT NULL,
|
||||
calculated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
PRIMARY KEY (period, user_id, mod_id)
|
||||
);
|
||||
|
||||
CREATE INDEX payout_estimates_user_id
|
||||
ON payout_estimates (user_id);
|
||||
|
||||
CREATE INDEX payout_estimates_mod_id
|
||||
ON payout_estimates (mod_id);
|
||||
|
||||
CREATE INDEX payout_estimates_created
|
||||
ON payout_estimates (created);
|
||||
Reference in New Issue
Block a user