bmc_hub/migrations/078_nextcloud_audit_log.sql
Christian 56d6d45aa2 feat(sag): Add Varekøb & Salg module with database migration and frontend template
- Created a new SQL migration for the sag_salgsvarer table to manage sales and purchase items.
- Implemented a new HTML template for the Varekøb & Salg module, including summary cards and tables for sales and purchases.
- Added JavaScript functions for loading and rendering order data dynamically.
- Introduced a new backend search module for customers, contacts, hardware, and locations with autocomplete functionality.
- Developed an email templates API for managing system and customer-specific email templates.
- Created multiple migrations for Nextcloud instances, cache, audit logs, email templates, sag comments, hardware locations, and billing methods.
- Enhanced the sag module with solutions, order lines, work types, and 2FA support for user authentication.
2026-02-02 20:23:56 +01:00

23 lines
805 B
SQL

-- Migration: 078_nextcloud_audit_log
-- Created: 2026-02-01
CREATE TABLE IF NOT EXISTS nextcloud_audit_log (
id BIGSERIAL NOT NULL,
customer_id INTEGER NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
instance_id INTEGER REFERENCES nextcloud_instances(id) ON DELETE SET NULL,
event_type VARCHAR(50) NOT NULL,
request_meta JSONB,
response_meta JSONB,
actor_user_id INTEGER,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
PRIMARY KEY (id, created_at)
) PARTITION BY RANGE (created_at);
-- Create current month partition
CREATE TABLE IF NOT EXISTS nextcloud_audit_log_2026_02
PARTITION OF nextcloud_audit_log
FOR VALUES FROM ('2026-02-01') TO ('2026-03-01');
CREATE INDEX IF NOT EXISTS idx_nextcloud_audit_customer_created
ON nextcloud_audit_log (customer_id, created_at DESC);