Duration
43s
Input Tokens
1031
Output Tokens
3081
Cost
$0.00
Context
Input
Create a new table where I can store how much we pay instructors each month.Expected output
CREATE TABLE instructor_payouts ( instructor_id INT REFERENCES users(user_id), payout_month DATE, amount DECIMAL(10, 2), PRIMARY KEY (instructor_id, payout_month) );Model output
CREATE TABLE instructor_payments (
payment_id SERIAL PRIMARY KEY,
instructor_id INT NOT NULL REFERENCES users(user_id),
payment_month INT NOT NULL CHECK (payment_month BETWEEN 1 AND 12),
payment_year INT NOT NULL CHECK (payment_year >= 2020),
amount DECIMAL(10, 2) NOT NULL CHECK (amount >= 0),
payment_status TEXT DEFAULT 'pending' CHECK (payment_status IN ('pending', 'paid', 'cancelled')),
processed_at TIMESTAMP,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
CONSTRAINT unique_instructor_month_year UNIQUE (instructor_id, payment_month, payment_year)
);
COMMENT ON TABLE instructor_payments IS 'Stores monthly payment records for instructors';