chore(CF-838): Remove deployment/build migration files
Tables migrated to Jira tracking. PostgreSQL tables will be dropped separately. Archived in s3://macbookdev/db-archive/agiliton-db-2026-02-08.sql.gz Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
-- Migration 012: Builds table for CI/CD tracking
|
|
||||||
-- Purpose: Track builds and link them to sessions and versions
|
|
||||||
-- Dependencies: 001_base_schema.sql (versions table), 010_sessions.sql (sessions table)
|
|
||||||
|
|
||||||
-- Builds table: Store build information linked to sessions and versions
|
|
||||||
CREATE TABLE IF NOT EXISTS builds (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
session_id TEXT REFERENCES sessions(id) ON DELETE SET NULL,
|
|
||||||
version_id TEXT REFERENCES versions(id) ON DELETE CASCADE,
|
|
||||||
|
|
||||||
build_number INTEGER NOT NULL,
|
|
||||||
status TEXT DEFAULT 'pending' CHECK (status IN ('pending', 'running', 'success', 'failed')),
|
|
||||||
|
|
||||||
-- Build metadata
|
|
||||||
git_commit_sha TEXT,
|
|
||||||
git_branch TEXT,
|
|
||||||
build_log_url TEXT,
|
|
||||||
artifacts_url TEXT,
|
|
||||||
|
|
||||||
-- Timing
|
|
||||||
started_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
||||||
finished_at TIMESTAMP WITH TIME ZONE,
|
|
||||||
duration_seconds INTEGER GENERATED ALWAYS AS
|
|
||||||
(EXTRACT(EPOCH FROM (finished_at - started_at))) STORED,
|
|
||||||
|
|
||||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Indexes for efficient querying
|
|
||||||
CREATE INDEX idx_builds_session ON builds(session_id);
|
|
||||||
CREATE INDEX idx_builds_version ON builds(version_id);
|
|
||||||
CREATE INDEX idx_builds_status ON builds(status);
|
|
||||||
CREATE INDEX idx_builds_started ON builds(started_at DESC);
|
|
||||||
CREATE INDEX idx_builds_commit ON builds(git_commit_sha);
|
|
||||||
|
|
||||||
-- Unique constraint: one build number per version
|
|
||||||
CREATE UNIQUE INDEX idx_builds_version_number ON builds(version_id, build_number)
|
|
||||||
WHERE version_id IS NOT NULL;
|
|
||||||
|
|
||||||
-- Comments for documentation
|
|
||||||
COMMENT ON TABLE builds IS 'CI/CD build tracking linked to sessions and versions';
|
|
||||||
COMMENT ON COLUMN builds.session_id IS 'Optional link to session that triggered the build';
|
|
||||||
COMMENT ON COLUMN builds.version_id IS 'Link to version being built';
|
|
||||||
COMMENT ON COLUMN builds.duration_seconds IS 'Auto-calculated build duration in seconds';
|
|
||||||
COMMENT ON COLUMN builds.build_log_url IS 'URL to build logs (e.g., GitHub Actions run)';
|
|
||||||
COMMENT ON COLUMN builds.artifacts_url IS 'URL to build artifacts (e.g., app binary, Docker image)';
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
-- Migration 018: Deployments tracking for deployment centralization
|
|
||||||
-- Purpose: Track all deployments (Docker, MCP, iOS/macOS, services) with logs
|
|
||||||
-- Dependencies: 001_base_schema.sql (tasks table), 010_sessions.sql (sessions table)
|
|
||||||
|
|
||||||
-- Deployments table: Store deployment information linked to sessions and tasks
|
|
||||||
CREATE TABLE IF NOT EXISTS deployments (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
session_id TEXT REFERENCES sessions(id) ON DELETE SET NULL,
|
|
||||||
task_id TEXT REFERENCES tasks(id) ON DELETE SET NULL,
|
|
||||||
|
|
||||||
-- Project identification
|
|
||||||
project_name VARCHAR(255) NOT NULL,
|
|
||||||
project_path TEXT NOT NULL,
|
|
||||||
|
|
||||||
-- Deployment type and method
|
|
||||||
deployment_type VARCHAR(50) NOT NULL CHECK (deployment_type IN (
|
|
||||||
'docker-compose',
|
|
||||||
'mcp-server',
|
|
||||||
'ios-macos-app',
|
|
||||||
'python-service',
|
|
||||||
'node-service'
|
|
||||||
)),
|
|
||||||
deployment_method VARCHAR(50) NOT NULL CHECK (deployment_method IN (
|
|
||||||
'doco-cd',
|
|
||||||
'agiliton-build',
|
|
||||||
'direct',
|
|
||||||
'manual'
|
|
||||||
)),
|
|
||||||
|
|
||||||
-- Status tracking
|
|
||||||
status VARCHAR(50) NOT NULL DEFAULT 'pending' CHECK (status IN (
|
|
||||||
'pending',
|
|
||||||
'running',
|
|
||||||
'success',
|
|
||||||
'failed',
|
|
||||||
'cancelled'
|
|
||||||
)),
|
|
||||||
|
|
||||||
-- Git integration
|
|
||||||
commit_sha VARCHAR(40),
|
|
||||||
git_branch TEXT,
|
|
||||||
|
|
||||||
-- Timing
|
|
||||||
started_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
|
||||||
completed_at TIMESTAMP WITH TIME ZONE,
|
|
||||||
duration_seconds INTEGER GENERATED ALWAYS AS
|
|
||||||
(EXTRACT(EPOCH FROM (completed_at - started_at))) STORED,
|
|
||||||
|
|
||||||
-- Error tracking
|
|
||||||
error_message TEXT,
|
|
||||||
|
|
||||||
-- Extra deployment-specific data (JSON)
|
|
||||||
metadata JSONB DEFAULT '{}'::jsonb,
|
|
||||||
|
|
||||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Deployment logs table: Store deployment log messages
|
|
||||||
CREATE TABLE IF NOT EXISTS deployment_logs (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
deployment_id INT NOT NULL REFERENCES deployments(id) ON DELETE CASCADE,
|
|
||||||
|
|
||||||
timestamp TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
|
||||||
level VARCHAR(20) NOT NULL CHECK (level IN ('debug', 'info', 'warn', 'error')),
|
|
||||||
message TEXT NOT NULL,
|
|
||||||
|
|
||||||
-- Optional structured metadata
|
|
||||||
metadata JSONB DEFAULT '{}'::jsonb
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Indexes for efficient querying
|
|
||||||
CREATE INDEX idx_deployments_project ON deployments(project_name);
|
|
||||||
CREATE INDEX idx_deployments_session ON deployments(session_id);
|
|
||||||
CREATE INDEX idx_deployments_task ON deployments(task_id);
|
|
||||||
CREATE INDEX idx_deployments_status ON deployments(status);
|
|
||||||
CREATE INDEX idx_deployments_started ON deployments(started_at DESC);
|
|
||||||
CREATE INDEX idx_deployments_type ON deployments(deployment_type);
|
|
||||||
CREATE INDEX idx_deployments_commit ON deployments(commit_sha);
|
|
||||||
|
|
||||||
CREATE INDEX idx_deployment_logs_deployment ON deployment_logs(deployment_id);
|
|
||||||
CREATE INDEX idx_deployment_logs_timestamp ON deployment_logs(timestamp DESC);
|
|
||||||
CREATE INDEX idx_deployment_logs_level ON deployment_logs(level);
|
|
||||||
|
|
||||||
-- Comments for documentation
|
|
||||||
COMMENT ON TABLE deployments IS 'Deployment tracking for all project types (Docker, MCP, iOS/macOS, services)';
|
|
||||||
COMMENT ON COLUMN deployments.project_name IS 'Human-readable project name';
|
|
||||||
COMMENT ON COLUMN deployments.project_path IS 'Absolute filesystem path to project';
|
|
||||||
COMMENT ON COLUMN deployments.deployment_type IS 'Type of deployment (docker-compose, mcp-server, ios-macos-app, etc.)';
|
|
||||||
COMMENT ON COLUMN deployments.deployment_method IS 'Method used for deployment (doco-cd, agiliton-build, direct, manual)';
|
|
||||||
COMMENT ON COLUMN deployments.status IS 'Current deployment status';
|
|
||||||
COMMENT ON COLUMN deployments.duration_seconds IS 'Auto-calculated deployment duration in seconds';
|
|
||||||
COMMENT ON COLUMN deployments.metadata IS 'Extra deployment-specific data (runtime, host, build number, etc.)';
|
|
||||||
|
|
||||||
COMMENT ON TABLE deployment_logs IS 'Deployment log messages for debugging and audit trail';
|
|
||||||
COMMENT ON COLUMN deployment_logs.level IS 'Log level (debug, info, warn, error)';
|
|
||||||
COMMENT ON COLUMN deployment_logs.metadata IS 'Optional structured log metadata (source, context, etc.)';
|
|
||||||
Reference in New Issue
Block a user