Update README with current features and screenshots
- Cross-platform support (Windows/Linux) with Windows Updates and Winget - Added dependency confirmation workflow and refresh token authentication - New screenshots: History, Live Operations, Windows Agent Details - Local CLI features with terminal output and cache system - Updated known limitations - Proxmox integration is broken - Organized docs to docs/ folder and updated .gitignore - Probably introduced a dozen bugs with Windows agents - stay tuned
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
-- Fix foreign key relationship for update_logs table to reference current_package_state instead of update_packages
|
||||
-- This ensures compatibility with the new event sourcing system
|
||||
|
||||
-- First, drop the existing foreign key constraint
|
||||
ALTER TABLE update_logs DROP CONSTRAINT IF EXISTS update_logs_update_package_id_fkey;
|
||||
|
||||
-- Add the new foreign key constraint to reference current_package_state
|
||||
ALTER TABLE update_logs
|
||||
ADD CONSTRAINT update_logs_update_package_id_fkey
|
||||
FOREIGN KEY (update_package_id) REFERENCES current_package_state(id) ON DELETE SET NULL;
|
||||
|
||||
-- Add index for better performance on the new foreign key
|
||||
CREATE INDEX IF NOT EXISTS idx_logs_update_package ON update_logs(update_package_id);
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Add pending_dependencies and checking_dependencies status to support dependency confirmation workflow
|
||||
ALTER TABLE current_package_state
|
||||
DROP CONSTRAINT IF EXISTS current_package_state_status_check;
|
||||
|
||||
ALTER TABLE current_package_state
|
||||
ADD CONSTRAINT current_package_state_status_check
|
||||
CHECK (status IN ('pending', 'approved', 'updated', 'failed', 'ignored', 'installing', 'pending_dependencies', 'checking_dependencies'));
|
||||
|
||||
-- Also update any legacy tables if they exist
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'updates') THEN
|
||||
ALTER TABLE updates
|
||||
DROP CONSTRAINT IF EXISTS updates_status_check,
|
||||
ADD CONSTRAINT updates_status_check
|
||||
CHECK (status IN ('pending', 'approved', 'scheduled', 'installing', 'installed', 'failed', 'ignored', 'pending_dependencies', 'checking_dependencies'));
|
||||
END IF;
|
||||
END $$;
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Add missing command statuses to the check constraint
|
||||
-- This allows 'timed_out', 'cancelled', and 'running' statuses that the application uses
|
||||
|
||||
-- First drop the existing constraint
|
||||
ALTER TABLE agent_commands DROP CONSTRAINT IF EXISTS agent_commands_status_check;
|
||||
|
||||
-- Add the new constraint with all valid statuses
|
||||
ALTER TABLE agent_commands
|
||||
ADD CONSTRAINT agent_commands_status_check
|
||||
CHECK (status::text = ANY (ARRAY[
|
||||
'pending'::character varying,
|
||||
'sent'::character varying,
|
||||
'running'::character varying,
|
||||
'completed'::character varying,
|
||||
'failed'::character varying,
|
||||
'timed_out'::character varying,
|
||||
'cancelled'::character varying
|
||||
]::text[]));
|
||||
@@ -0,0 +1,13 @@
|
||||
-- Expand status column to accommodate longer status values
|
||||
-- checking_dependencies (23 chars) and pending_dependencies (21 chars) exceed current 20 char limit
|
||||
|
||||
ALTER TABLE current_package_state
|
||||
ALTER COLUMN status TYPE character varying(30);
|
||||
|
||||
-- Update check constraint to match new length
|
||||
ALTER TABLE current_package_state
|
||||
DROP CONSTRAINT IF EXISTS current_package_state_status_check;
|
||||
|
||||
ALTER TABLE current_package_state
|
||||
ADD CONSTRAINT current_package_state_status_check
|
||||
CHECK (status::text = ANY (ARRAY['pending'::character varying, 'approved'::character varying, 'updated'::character varying, 'failed'::character varying, 'ignored'::character varying, 'installing'::character varying, 'pending_dependencies'::character varying, 'checking_dependencies'::character varying]::text[]));
|
||||
@@ -0,0 +1,29 @@
|
||||
-- 008_create_refresh_tokens_table.sql
|
||||
-- Create refresh tokens table for secure token renewal
|
||||
|
||||
CREATE TABLE IF NOT EXISTS refresh_tokens (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
agent_id UUID NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
||||
token_hash VARCHAR(64) NOT NULL, -- SHA-256 hash of the refresh token
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
last_used_at TIMESTAMP,
|
||||
revoked BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
CONSTRAINT unique_token_hash UNIQUE(token_hash)
|
||||
);
|
||||
|
||||
-- Index for fast agent lookup
|
||||
CREATE INDEX IF NOT EXISTS idx_refresh_tokens_agent_id ON refresh_tokens(agent_id);
|
||||
|
||||
-- Index for expiration cleanup
|
||||
CREATE INDEX IF NOT EXISTS idx_refresh_tokens_expires_at ON refresh_tokens(expires_at);
|
||||
|
||||
-- Index for token validation
|
||||
CREATE INDEX IF NOT EXISTS idx_refresh_tokens_hash_not_revoked
|
||||
ON refresh_tokens(token_hash) WHERE NOT revoked;
|
||||
|
||||
COMMENT ON TABLE refresh_tokens IS 'Stores long-lived refresh tokens for agent token renewal without re-registration';
|
||||
COMMENT ON COLUMN refresh_tokens.token_hash IS 'SHA-256 hash of the refresh token for secure storage';
|
||||
COMMENT ON COLUMN refresh_tokens.expires_at IS 'Refresh token expiration (default: 90 days from creation)';
|
||||
COMMENT ON COLUMN refresh_tokens.last_used_at IS 'Timestamp of last successful token renewal';
|
||||
COMMENT ON COLUMN refresh_tokens.revoked IS 'Flag to revoke token before expiration';
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Add version tracking to agents table
|
||||
-- This enables the hybrid version tracking system
|
||||
|
||||
ALTER TABLE agents
|
||||
ADD COLUMN current_version VARCHAR(50) DEFAULT '0.1.3',
|
||||
ADD COLUMN update_available BOOLEAN DEFAULT FALSE,
|
||||
ADD COLUMN last_version_check TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- Add index for faster queries on update status
|
||||
CREATE INDEX idx_agents_update_available ON agents(update_available);
|
||||
CREATE INDEX idx_agents_current_version ON agents(current_version);
|
||||
|
||||
-- Add comment to document the purpose
|
||||
COMMENT ON COLUMN agents.current_version IS 'The version of the agent currently running';
|
||||
COMMENT ON COLUMN agents.update_available IS 'Whether an update is available for this agent';
|
||||
COMMENT ON COLUMN agents.last_version_check IS 'Last time the agent version was checked';
|
||||
Reference in New Issue
Block a user