Files
company-tool/backend/company-migrations/0012_item_supplier_prices.sql
Torsten Schulz (local) 0e539710c0 feat: Add password reset functionality with request and reset forms
feat: Implement price list import feature with preview and apply options

feat: Create price rules management page with CRUD operations

feat: Develop quotes management page with itemized quotes and status tracking

feat: Introduce organization registration page for new users

feat: Build suppliers management page with detailed supplier information

feat: Create users management page for inviting and managing roles

chore: Add TypeScript configuration for improved type checking

chore: Set up Vite configuration for development server and API proxy

chore: Add Vite environment type definitions for better TypeScript support
2026-06-02 15:28:38 +02:00

29 lines
1.3 KiB
SQL

alter table {schema}.items
add column if not exists manufacturer_code text;
create table if not exists {schema}.item_supplier_prices (
id uuid primary key,
item_id uuid not null references {schema}.items(id) on delete cascade,
supplier_id uuid not null references {schema}.suppliers(id) on delete cascade,
external_item_number text not null,
purchase_price numeric(14, 4) not null,
currency text not null default 'EUR',
is_preferred boolean not null default false,
valid_from date,
valid_until date,
source text not null default 'manual',
created_at timestamptz not null default now(),
updated_at timestamptz not null default now(),
constraint item_supplier_prices_purchase_price_non_negative check (purchase_price >= 0),
constraint item_supplier_prices_currency_valid check (char_length(currency) = 3),
constraint item_supplier_prices_valid_range check (
valid_until is null or valid_from is null or valid_until >= valid_from
)
);
create unique index if not exists idx_item_supplier_prices_supplier_external
on {schema}.item_supplier_prices (supplier_id, external_item_number);
create index if not exists idx_item_supplier_prices_item
on {schema}.item_supplier_prices (item_id, purchase_price);