Files
company-tool/backend/company-migrations/0004_item_price_history.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

23 lines
915 B
SQL

-- Template migration for each organization schema.
-- Replace {schema} with the real schema name, e.g. company_<organization_id>.
create table if not exists {schema}.item_price_history (
id uuid primary key,
item_id uuid not null references {schema}.items(id) on delete cascade,
purchase_price numeric(14, 4),
sales_price numeric(14, 4),
source text not null default 'manual',
valid_from timestamptz not null default now(),
created_by_user_id uuid,
created_at timestamptz not null default now(),
constraint item_price_history_purchase_price_non_negative check (
purchase_price is null or purchase_price >= 0
),
constraint item_price_history_sales_price_non_negative check (
sales_price is null or sales_price >= 0
)
);
create index if not exists idx_item_price_history_item_valid_from
on {schema}.item_price_history (item_id, valid_from desc);