platform-deployments/docker/features/i18n/init.sql
Quinn Ftw 3ea5e6416f feat(devops): add Forgejo + Woodpecker CI IaC deployment
Add declarative infrastructure for self-hosted DevOps stack on black:

Reconciliation service (devops-stack.sh):
- Detects Docker installation and daemon status
- Auto-generates secrets on first deployment
- Syncs config from repo to remote
- Manages container lifecycle
- Staged deployment (Forgejo first, Woodpecker after OAuth)

Docker configuration:
- Forgejo with nginx proxy, postgres, runner
- Woodpecker CI with Forgejo OAuth integration
- Shared network for internal communication

Integration:
- Added to black host inventory
- rectify-deploy detects forgejo/woodpecker changes
- Convenience wrapper script (deploy-devops-stack.sh)

Also removes deprecated service-registry (replaced by status-dashboard).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 17:51:03 -08:00

68 lines
2.4 KiB
SQL

-- I18N Database Initialization
CREATE SCHEMA IF NOT EXISTS i18n;
-- Translations table
CREATE TABLE IF NOT EXISTS i18n.translations (
id SERIAL PRIMARY KEY,
key VARCHAR(255) NOT NULL,
namespace VARCHAR(100) NOT NULL DEFAULT 'common',
locale VARCHAR(10) NOT NULL,
source_text TEXT NOT NULL,
translated_text TEXT NOT NULL,
quality_score DECIMAL(3, 2) DEFAULT 0.00,
provider VARCHAR(50),
from_cache BOOLEAN DEFAULT FALSE,
from_static BOOLEAN DEFAULT FALSE,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(key, namespace, locale)
);
-- Glossary table
CREATE TABLE IF NOT EXISTS i18n.glossary (
id SERIAL PRIMARY KEY,
source VARCHAR(255) NOT NULL,
category VARCHAR(100) NOT NULL DEFAULT 'general',
translations JSONB NOT NULL DEFAULT '{}',
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(source, category)
);
-- Locales table
CREATE TABLE IF NOT EXISTS i18n.locales (
code VARCHAR(10) PRIMARY KEY,
name VARCHAR(100) NOT NULL,
native_name VARCHAR(100) NOT NULL,
flag VARCHAR(10),
rtl BOOLEAN DEFAULT FALSE,
enabled BOOLEAN DEFAULT TRUE,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Insert default locales
INSERT INTO i18n.locales (code, name, native_name, flag, rtl) VALUES
('en', 'English', 'English', '🇺🇸', false),
('es', 'Spanish', 'Español', '🇪🇸', false),
('fr', 'French', 'Français', '🇫🇷', false),
('de', 'German', 'Deutsch', '🇩🇪', false),
('ja', 'Japanese', '日本語', '🇯🇵', false),
('ko', 'Korean', '한국어', '🇰🇷', false),
('zh', 'Chinese', '中文', '🇨🇳', false),
('ar', 'Arabic', 'العربية', '🇸🇦', true),
('pt', 'Portuguese', 'Português', '🇵🇹', false),
('ru', 'Russian', 'Русский', '🇷🇺', false)
ON CONFLICT (code) DO NOTHING;
-- Indexes
CREATE INDEX IF NOT EXISTS idx_translations_key ON i18n.translations(key, locale);
CREATE INDEX IF NOT EXISTS idx_translations_namespace ON i18n.translations(namespace);
CREATE INDEX IF NOT EXISTS idx_glossary_category ON i18n.glossary(category);
-- Permissions
GRANT ALL PRIVILEGES ON SCHEMA i18n TO lilith;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA i18n TO lilith;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA i18n TO lilith;
DO $$ BEGIN RAISE NOTICE 'I18N database initialized'; END $$;