2024-07-15 17:55:09 +05:30
|
|
|
-- SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
--
|
|
|
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS cqrs_inventory_product_query
|
|
|
|
(
|
|
|
|
version bigint CHECK (version >= 0) NOT NULL,
|
|
|
|
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
description TEXT,
|
|
|
|
image TEXT,
|
|
|
|
sku_able BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
product_id UUID NOT NULL UNIQUE,
|
|
|
|
|
|
|
|
|
|
|
|
price_minor INTEGER NOT NULL,
|
|
|
|
price_major INTEGER NOT NULL,
|
|
|
|
price_currency TEXT NOT NULL,
|
|
|
|
|
2024-07-17 16:09:47 +05:30
|
|
|
quantity_major_number INTEGER NOT NULL,
|
|
|
|
quantity_minor_number INTEGER NOT NULL,
|
|
|
|
quantity_major_unit TEXT NOT NULL,
|
|
|
|
quantity_minor_unit TEXT NOT NULL,
|
2024-07-15 17:55:09 +05:30
|
|
|
|
|
|
|
category_id UUID NOT NULL,
|
|
|
|
|
|
|
|
deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
UNIQUE(category_id, name),
|
|
|
|
|
|
|
|
PRIMARY KEY (product_id)
|
|
|
|
);
|
2024-07-15 23:52:59 +05:30
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS cqrs_inventory_product_customizations_query
|
|
|
|
(
|
|
|
|
version bigint CHECK (version >= 0) NOT NULL,
|
|
|
|
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
customization_id UUID NOT NULL UNIQUE,
|
|
|
|
product_id UUID NOT NULL,
|
|
|
|
|
|
|
|
deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
UNIQUE(product_id, name),
|
|
|
|
|
|
|
|
PRIMARY KEY (customization_id)
|
|
|
|
);
|