feat: add payment_orders table migration
This commit is contained in:
15
migrations/002_add_payment_orders.sql
Normal file
15
migrations/002_add_payment_orders.sql
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-- migrations/002_add_payment_orders.sql
|
||||||
|
CREATE TABLE IF NOT EXISTS payment_orders (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
user_id INTEGER NOT NULL REFERENCES users(id),
|
||||||
|
order_no VARCHAR(64) UNIQUE NOT NULL,
|
||||||
|
package_type VARCHAR(20) NOT NULL,
|
||||||
|
amount INTEGER NOT NULL,
|
||||||
|
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
||||||
|
paid_at TIMESTAMPTZ,
|
||||||
|
expires_at TIMESTAMPTZ,
|
||||||
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_payment_orders_user_id ON payment_orders(user_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_payment_orders_order_no ON payment_orders(order_no);
|
||||||
Reference in New Issue
Block a user