Sprint SPRINT_20260417_024_DevOps_dotnet_release_image_stabilization. - Dockerfile.platform + Dockerfile.dotnet-service adjustments for deterministic layer ordering and cache-friendly publish. - devops/release/components.json updates. - devops/compose: .env, README, legacy + stella-services docker-compose, stellaops env example, postgres-init 04/04b/15/16 authority + release schemas, setup.bootstrap.local.yaml. - Gitea build_release.py script. - scripts/register-local-integrations.ps1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
75 lines
2.9 KiB
PL/PgSQL
75 lines
2.9 KiB
PL/PgSQL
-- Platform context tables (regions, environments, preferences) and release control bundles.
|
|
-- Required for the global context/filter UI and release management read models.
|
|
-- Idempotent: uses IF NOT EXISTS and ON CONFLICT.
|
|
|
|
CREATE SCHEMA IF NOT EXISTS platform;
|
|
CREATE SCHEMA IF NOT EXISTS release;
|
|
CREATE SCHEMA IF NOT EXISTS release_app;
|
|
|
|
-- Helper function
|
|
CREATE OR REPLACE FUNCTION release.update_updated_at_column()
|
|
RETURNS TRIGGER AS $$
|
|
BEGIN
|
|
NEW.updated_at = now();
|
|
RETURN NEW;
|
|
END;
|
|
$$ LANGUAGE plpgsql;
|
|
|
|
-- Context regions
|
|
CREATE TABLE IF NOT EXISTS platform.context_regions (
|
|
region_id text PRIMARY KEY,
|
|
display_name text NOT NULL,
|
|
sort_order integer NOT NULL,
|
|
enabled boolean NOT NULL DEFAULT true
|
|
);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS ux_platform_context_regions_sort
|
|
ON platform.context_regions (sort_order, region_id);
|
|
|
|
-- Context environments
|
|
CREATE TABLE IF NOT EXISTS platform.context_environments (
|
|
environment_id text PRIMARY KEY,
|
|
region_id text NOT NULL REFERENCES platform.context_regions(region_id) ON DELETE RESTRICT,
|
|
environment_type text NOT NULL,
|
|
display_name text NOT NULL,
|
|
sort_order integer NOT NULL,
|
|
enabled boolean NOT NULL DEFAULT true
|
|
);
|
|
CREATE INDEX IF NOT EXISTS ix_platform_context_environments_region_sort
|
|
ON platform.context_environments (region_id, sort_order, environment_id);
|
|
CREATE INDEX IF NOT EXISTS ix_platform_context_environments_sort
|
|
ON platform.context_environments (sort_order, region_id, environment_id);
|
|
|
|
-- UI context preferences (per-user filter state)
|
|
CREATE TABLE IF NOT EXISTS platform.ui_context_preferences (
|
|
tenant_id text NOT NULL,
|
|
actor_id text NOT NULL,
|
|
regions text[] NOT NULL DEFAULT ARRAY[]::text[],
|
|
environments text[] NOT NULL DEFAULT ARRAY[]::text[],
|
|
time_window text NOT NULL DEFAULT '24h',
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_by text NOT NULL DEFAULT 'system',
|
|
PRIMARY KEY (tenant_id, actor_id)
|
|
);
|
|
CREATE INDEX IF NOT EXISTS ix_platform_ui_context_preferences_updated
|
|
ON platform.ui_context_preferences (updated_at DESC, tenant_id, actor_id);
|
|
|
|
-- Release control bundles
|
|
CREATE TABLE IF NOT EXISTS release.control_bundles (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id UUID NOT NULL,
|
|
slug TEXT NOT NULL,
|
|
name TEXT NOT NULL,
|
|
description TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
created_by TEXT NOT NULL DEFAULT 'system',
|
|
CONSTRAINT uq_control_bundles_tenant_slug UNIQUE (tenant_id, slug)
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_control_bundles_tenant_name
|
|
ON release.control_bundles (tenant_id, name, id);
|
|
CREATE INDEX IF NOT EXISTS idx_control_bundles_tenant_updated
|
|
ON release.control_bundles (tenant_id, updated_at DESC, id);
|
|
|
|
-- Context regions/environments are intentionally left empty on fresh installs.
|
|
-- The setup and admin surfaces create truthful operator-owned state as needed.
|