-- +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
