vanikam/migrations/20240917094208_cqrs_billing_bill_query.sql
Aravinth Manivannan dbbbb86a8c
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
feat: CRUD bill aggregate
2024-09-17 16:13:43 +05:30

31 lines
779 B
SQL

-- SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
CREATE TABLE IF NOT EXISTS cqrs_billing_bill_query
(
version bigint CHECK (version >= 0) NOT NULL,
created_time timestamp with time zone DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
bill_id UUID NOT NULL UNIQUE,
store_id UUID NOT NULL,
token_number INTEGER NOT NULL,
total_price_minor INTEGER DEFAULT NULL,
total_price_major INTEGER DEFAULT NULL,
total_price_currency TEXT DEFAULT NULL,
deleted BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (bill_id)
);
CREATE TABLE IF NOT EXISTS cqrs_billing_bill_next_token_id
(
store_id UUID NOT NULL,
token_number INTEGER NOT NULL DEFAULT 1,
PRIMARY KEY (store_id)
);