home / sales_assistant

Produtos

0 rows where seller_id = 1 sorted by name

✎ View and edit SQL

This data as json

0 records

CREATE TABLE product (
    product_id      INTEGER PRIMARY KEY AUTOINCREMENT,
    seller_id       INTEGER NOT NULL REFERENCES seller(seller_id) ON DELETE CASCADE,
    name            TEXT NOT NULL,
    description     TEXT NOT NULL DEFAULT '',
    price_cents     INTEGER NOT NULL CHECK (price_cents >= 0),
    category        TEXT NOT NULL DEFAULT 'general',
    stock_quantity  INTEGER NOT NULL DEFAULT 0,
    unit            TEXT NOT NULL DEFAULT 'un',
    is_active       INTEGER NOT NULL DEFAULT 1,
    image_urls      TEXT NOT NULL DEFAULT '[]',
    variations      TEXT NOT NULL DEFAULT '{}',
    created_at      TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
    updated_at      TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
    CHECK (is_active IN (0, 1))
);
CREATE INDEX idx_product_seller_id ON product(seller_id);
CREATE INDEX idx_product_category ON product(category, seller_id);
CREATE INDEX idx_product_active ON product(seller_id, is_active);
Powered by Datasette · Queries took 1.2ms