Files
quyun/backend_v1/database/migrations/20250410130530_create_orders.sql
Rogee 24bd161df9
Some checks failed
build quyun / Build (push) Has been cancelled
feat: add backend_v1 migration
2025-12-19 14:46:58 +08:00

27 lines
801 B
SQL

-- +goose Up
-- +goose StatementBegin
CREATE TABLE orders(
id SERIAL8 PRIMARY KEY,
created_at timestamp NOT NULL DEFAULT now(),
updated_at timestamp NOT NULL DEFAULT now(),
order_no varchar(64) NOT NULL,
sub_order_no varchar(64) NOT NULL DEFAULT '',
transaction_id varchar(64) NOT NULL DEFAULT '',
refund_transaction_id varchar(64) NOT NULL DEFAULT '',
price int8 NOT NULL DEFAULT 0,
discount int2 NOT NULL DEFAULT 100,
currency varchar(10) NOT NULL DEFAULT 'CNY',
payment_method varchar(50) NOT NULL DEFAULT 'wechatpay',
post_id int8 NOT NULL,
user_id int8 NOT NULL,
status int2 NOT NULL,
meta jsonb NOT NULL DEFAULT '{}' ::jsonb
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE orders;
-- +goose StatementEnd