- Implemented frontend views for products and subscriptions using FastAPI and Jinja2 templates. - Created API endpoints for managing subscriptions, including creation, listing, and status updates. - Added HTML templates for displaying active subscriptions and their statistics. - Established database migrations for sag_subscriptions, sag_subscription_items, and products, including necessary indexes and triggers for automatic subscription number generation. - Introduced product price history tracking to monitor changes in product pricing.
20 lines
665 B
SQL
20 lines
665 B
SQL
-- Migration 109: Product price history
|
|
-- Track changes to product pricing
|
|
|
|
CREATE TABLE IF NOT EXISTS product_price_history (
|
|
id SERIAL PRIMARY KEY,
|
|
product_id INTEGER NOT NULL REFERENCES products(id) ON DELETE CASCADE,
|
|
price_type VARCHAR(50) NOT NULL DEFAULT 'sales_price',
|
|
old_price DECIMAL(10,2),
|
|
new_price DECIMAL(10,2),
|
|
note TEXT,
|
|
changed_by VARCHAR(255),
|
|
changed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_product_price_history_product
|
|
ON product_price_history(product_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_product_price_history_changed_at
|
|
ON product_price_history(changed_at);
|