Schema: billing (part 2)
Part of the generated database reference.
price_lists
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.23-branch-scope-cleanup
- Rust source:
botschema/src/billing/catalog.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| org_id |
UUID |
no |
β |
FK |
organizations.org_id |
| bot_id |
UUID |
no |
β |
β |
β |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| description |
TEXT |
yes |
β |
β |
β |
| currency |
VARCHAR(255) |
no |
'USD' |
β |
β |
| is_default |
BOOLEAN |
no |
FALSE |
β |
β |
| valid_from |
VARCHAR(255) |
yes |
β |
β |
β |
| valid_until |
VARCHAR(255) |
yes |
β |
β |
β |
| customer_group |
VARCHAR(255) |
yes |
β |
β |
β |
| discount_percent |
NUMERIC |
no |
0 |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
product_categories
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.98-product-categories-display-order
- Rust source:
botschema/src/billing/catalog.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| org_id |
UUID |
no |
β |
FK |
organizations.org_id |
| bot_id |
UUID |
no |
β |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| description |
TEXT |
yes |
β |
β |
β |
| parent_id |
UUID |
yes |
β |
FK |
product_categories.id |
| image_url |
TEXT |
yes |
β |
β |
β |
| sort_order |
INTEGER |
no |
0 |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| display_order |
INTEGER |
yes |
β |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
Drift: in migrations only: slug
product_price_lists
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.23-branch-scope-cleanup
- Rust source:
botschema/src/billing/pos.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| bot_id |
UUID |
no |
β |
β |
β |
| name |
VARCHAR(100) |
no |
β |
β |
β |
| currency |
CHAR(3) |
no |
'BRL' |
β |
β |
| is_default |
BOOLEAN |
no |
false |
β |
β |
| valid_from |
DATE |
yes |
β |
β |
β |
| valid_until |
DATE |
yes |
β |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
product_prices
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.07-inventory-pos
- Rust source:
botschema/src/billing/pos.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| price_list_id |
UUID |
no |
β |
FK |
product_price_lists.id |
| product_id |
UUID |
no |
β |
β |
β |
| variation_id |
UUID |
yes |
β |
β |
β |
| price |
NUMERIC(12,2) |
no |
β |
β |
β |
| min_quantity |
NUMERIC(12,3) |
no |
1 |
β |
β |
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.23-branch-scope-cleanup
- Rust source:
botschema/src/billing/pos.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| bot_id |
UUID |
no |
β |
β |
β |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| discount_type |
VARCHAR(20) |
no |
β |
β |
β |
| discount_value |
NUMERIC(12,2) |
no |
β |
β |
β |
| product_ids |
JSONB |
yes |
β |
β |
β |
| min_purchase |
NUMERIC(12,2) |
yes |
β |
β |
β |
| valid_from |
DATE |
no |
β |
β |
β |
| valid_until |
DATE |
no |
β |
β |
β |
| is_active |
BOOLEAN |
no |
true |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
product_stock
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.23-branch-scope-cleanup
- Rust source:
botschema/src/billing/pos.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| bot_id |
UUID |
no |
β |
β |
β |
| product_id |
UUID |
no |
β |
β |
β |
| variation_id |
UUID |
yes |
β |
β |
β |
| branch_id |
UUID |
no |
β |
FK |
branches.id |
| quantity |
NUMERIC(12,3) |
no |
0 |
β |
β |
| reserved |
NUMERIC(12,3) |
no |
0 |
β |
β |
| reorder_point |
NUMERIC(12,3) |
yes |
β |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
product_variants
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.15.1-consolidated
- Rust source:
botschema/src/billing/inventory.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| product_id |
UUID |
no |
β |
FK |
products.id |
| sku |
VARCHAR(255) |
yes |
β |
β |
β |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| price_adjustment |
NUMERIC |
no |
0 |
β |
β |
| stock_quantity |
INTEGER |
no |
0 |
β |
β |
| attributes |
JSONB |
no |
'{}' |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| global_trade_number |
VARCHAR(255) |
yes |
β |
β |
β |
| net_weight |
NUMERIC |
yes |
β |
β |
β |
| gross_weight |
NUMERIC |
yes |
β |
β |
β |
| width |
NUMERIC |
yes |
β |
β |
β |
| height |
NUMERIC |
yes |
β |
β |
β |
| length |
NUMERIC |
yes |
β |
β |
β |
| color |
VARCHAR(255) |
yes |
β |
β |
β |
| size |
VARCHAR(255) |
yes |
β |
β |
β |
| images |
JSONB |
yes |
'[]' |
β |
β |
product_variations
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.23-branch-scope-cleanup
- Rust source:
botschema/src/billing/pos.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| bot_id |
UUID |
no |
β |
β |
β |
| product_id |
UUID |
no |
β |
β |
β |
| sku |
VARCHAR(100) |
no |
β |
β |
β |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| attributes |
JSONB |
no |
'{}' |
β |
β |
| price |
NUMERIC(12,2) |
no |
β |
β |
β |
| cost_price |
NUMERIC(12,2) |
yes |
β |
β |
β |
| barcode |
VARCHAR(100) |
yes |
β |
β |
β |
| weight |
NUMERIC(10,3) |
yes |
β |
β |
β |
| is_active |
BOOLEAN |
no |
true |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
products
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.8.15-products-trim-columns
- Rust source:
botschema/src/billing/catalog.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| org_id |
UUID |
no |
β |
FK |
organizations.org_id |
| bot_id |
UUID |
no |
β |
β |
β |
| sku |
VARCHAR(255) |
yes |
β |
β |
β |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| description |
TEXT |
yes |
β |
β |
β |
| category |
VARCHAR(255) |
yes |
β |
β |
β |
| product_type |
VARCHAR(255) |
no |
'physical' |
β |
β |
| price |
NUMERIC |
no |
0 |
β |
β |
| cost |
NUMERIC |
yes |
β |
β |
β |
| currency |
VARCHAR(255) |
no |
'USD' |
β |
β |
| tax_rate |
NUMERIC |
no |
0 |
β |
β |
| unit |
VARCHAR(255) |
no |
'unit' |
β |
β |
| stock_quantity |
INTEGER |
no |
0 |
β |
β |
| low_stock_threshold |
INTEGER |
no |
10 |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| images |
JSONB |
no |
'[]' |
β |
β |
| attributes |
JSONB |
no |
'{}' |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
| category_id |
UUID |
yes |
β |
β |
β |
| is_public |
BOOLEAN |
no |
true |
β |
β |
Indexes: idx_products_is_public(is_public), idx_unified_search_products(to_tsvector('english', COALESCE(name::text, '')
Drift: in migrations only: barcode, batch_number, brand, color, dimensions, excise_tax_code, excise_tax_rate, expiration_date, external_category_id, external_id, external_metadata, fiscal_code, gender, global_trade_number, gross_weight, height, length, manufacture_date, material, max_stock, meta_description, meta_title, min_stock, model, net_weight, origin_code, package_count, profit_margin, reorder_point, sale_end, sale_price, sale_start, sales_tax_code, sales_tax_rate, service_tax_code, service_tax_rate, shipping_cost, size, slug, tags, tax_class, tax_code, tax_unit_code, vat_code, vat_rate, warehouse_location, weight, width
services
- Domain:
billing Β· Feature gate: #[cfg(feature = "billing")] Β· Migration: 6.5.40-services-tax
- Rust source:
botschema/src/billing/catalog.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| org_id |
UUID |
no |
β |
FK |
organizations.org_id |
| bot_id |
UUID |
no |
β |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
| name |
VARCHAR(255) |
no |
β |
β |
β |
| description |
TEXT |
yes |
β |
β |
β |
| category |
VARCHAR(255) |
yes |
β |
β |
β |
| service_type |
VARCHAR(255) |
no |
'hourly' |
β |
β |
| hourly_rate |
NUMERIC |
yes |
β |
β |
β |
| fixed_price |
NUMERIC |
yes |
β |
β |
β |
| currency |
VARCHAR(255) |
no |
'USD' |
β |
β |
| duration_minutes |
INTEGER |
yes |
β |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| attributes |
JSONB |
no |
'{}' |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| tax_rate |
DECIMAL(5,2) |
no |
0 |
β |
β |