mirror of
https://github.com/Xevion/xevion.dev.git
synced 2026-01-31 08:26:41 -06:00
feat: add comprehensive tagging system with cooccurrence tracking
- Add tags, project_tags, and tag_cooccurrence tables with proper indexes - Implement full CRUD API endpoints for tag management - Add tag association endpoints for projects with automatic cooccurrence updates - Include related tags and project filtering by tag functionality
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
-- Project status enum
|
||||
CREATE TYPE project_status AS ENUM ('active', 'maintained', 'archived', 'hidden');
|
||||
|
||||
-- Projects table
|
||||
CREATE TABLE projects (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
slug TEXT NOT NULL UNIQUE,
|
||||
title TEXT NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
status project_status NOT NULL DEFAULT 'active',
|
||||
github_repo TEXT,
|
||||
demo_url TEXT,
|
||||
priority INTEGER NOT NULL DEFAULT 0,
|
||||
icon TEXT,
|
||||
last_github_activity TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Indexes for common queries
|
||||
CREATE INDEX idx_projects_status ON projects(status);
|
||||
CREATE INDEX idx_projects_priority ON projects(priority DESC);
|
||||
CREATE INDEX idx_projects_slug ON projects(slug);
|
||||
|
||||
-- Trigger to auto-update updated_at
|
||||
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = NOW();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
||||
|
||||
CREATE TRIGGER update_projects_updated_at BEFORE UPDATE ON projects
|
||||
FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
|
||||
Reference in New Issue
Block a user