Synced procedure scripts from test

This commit is contained in:
Maksym Buz
2026-03-26 15:57:37 +00:00
parent 4c78959d98
commit e5fd9fd1fa
5 changed files with 462 additions and 16 deletions

View File

@@ -1,7 +1,6 @@
-- ============================================================================
-- SCRIPT: 00_partitions_init.sql
-- DESCRIPTION: Creates the 'partitions' schema and configuration table.
-- Defines the structure for managing Zabbix partitioning.
-- Creates the 'partitions' schema and configuration table.
-- Defines the structure for managing Zabbix partitioning.
-- ============================================================================
CREATE SCHEMA IF NOT EXISTS partitions;
@@ -12,14 +11,14 @@ CREATE TABLE IF NOT EXISTS partitions.config (
period text NOT NULL CHECK (period IN ('day', 'week', 'month', 'year')),
keep_history interval NOT NULL,
future_partitions integer NOT NULL DEFAULT 5,
last_updated timestamp WITH TIME ZONE DEFAULT now(),
last_updated timestamp WITH TIME ZONE DEFAULT (now() AT TIME ZONE 'UTC'),
PRIMARY KEY (table_name)
);
-- Table to track installed version of the partitioning solution
CREATE TABLE IF NOT EXISTS partitions.version (
version text PRIMARY KEY,
installed_at timestamp with time zone DEFAULT now(),
installed_at timestamp with time zone DEFAULT (now() AT TIME ZONE 'UTC'),
description text
);