From 121e3f26643299b96dcdf749f5c9a5d9d44c16fe Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 19 May 2026 14:04:26 +0200 Subject: [PATCH] WIP: Adding projects Signed-off-by: Nikolai Rodionov --- internal/repository/projects.go | 4 ++++ migrations/20260518193048_projects_init.up.sql | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/repository/projects.go b/internal/repository/projects.go index 35563fd..4de7726 100644 --- a/internal/repository/projects.go +++ b/internal/repository/projects.go @@ -21,6 +21,10 @@ type ProjectData struct { // CreateProject adds a new projects to the database func CreateProject(ctx context.Context, db *sql.DB, data *ProjectData) error { + query := ` + INSERT INTO projects + (uuid, name, slug, ) + ` return nil } diff --git a/migrations/20260518193048_projects_init.up.sql b/migrations/20260518193048_projects_init.up.sql index 60d8bf0..3a670b1 100644 --- a/migrations/20260518193048_projects_init.up.sql +++ b/migrations/20260518193048_projects_init.up.sql @@ -1,14 +1,15 @@ CREATE TABLE projects ( id UUID PRIMARY KEY, name VARCHAR(120) NOT NULL, - slug VARCHAR(120) NOT NULL UNIQUE, + slug VARCHAR(120) NOT NULL UNIQUE + CHECK ( + slug ~ '^[a-z0-9]+(?:-[a-z0-9]+)*$' + ), description TEXT, owner_user_id UUID NOT NULL, archived_at TIMESTAMP NULL, closed_at TIMESTAMP NULL, billing_account_id UUID NULL, - max_clusters INTEGER DEFAULT 10, - max_nodes INTEGER DEFAULT 100, created_at TIMESTAMP NOT NULL DEFAULT now(), updated_at TIMESTAMP NOT NULL DEFAULT now(), created_by UUID NOT NULL,