feat: add projects and quotas schema
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Projekte-und-Quotas-Migration mit Defaults und Constraints angelegt.
|
||||
- Kern-Tabellen-Migration fuer `profiles`, `tenants` und `memberships` angelegt.
|
||||
- `golang-migrate`-Setup mit Baseline-Migration und Make-Targets fuer Up/Down/Version angelegt.
|
||||
- Gemeinsames Go-Modul `platform/` mit ENV-Konfiguration und strukturiertem JSON-Logging angelegt.
|
||||
|
||||
@@ -39,6 +39,11 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda
|
||||
- [x] `profiles.id` referenziert `auth.users.id`
|
||||
- [x] Rollen-Enum `membership_role` mit `owner`, `admin`, `member`, `viewer` angelegt
|
||||
- [x] FKs, Unique-/Primary-Keys und Indizes gesetzt
|
||||
- [x] E2-T03: Projekte & Quotas
|
||||
- [x] Migration fuer `projects` und `project_quotas` angelegt
|
||||
- [x] Projekte referenzieren eindeutig einen Tenant
|
||||
- [x] Quotas referenzieren 1:1 ein Projekt und erhalten Defaults
|
||||
- [x] Quota-Checks fuer nicht-negative Werte gesetzt
|
||||
|
||||
## MVP-Backlog
|
||||
|
||||
@@ -79,3 +84,4 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda
|
||||
- 2026-06-10: Gemeinsamer Go-Config-/Logging-Layer angelegt; Tests fuer Config-Defaults und Validierung ergaenzt.
|
||||
- 2026-06-10: `golang-migrate`-Setup mit Baseline-Migration angelegt; lokaler Up/Down-Lauf gegen Supabase verifiziert.
|
||||
- 2026-06-10: Kern-Tabellen-Migration `0002_core_identity` angelegt und lokal gegen Supabase verifiziert.
|
||||
- 2026-06-10: Projekte-und-Quotas-Migration `0003_projects_and_quotas` angelegt und lokal gegen Supabase verifiziert.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
DROP TABLE IF EXISTS public.project_quotas;
|
||||
DROP INDEX IF EXISTS public.projects_tenant_id_idx;
|
||||
DROP TABLE IF EXISTS public.projects;
|
||||
@@ -0,0 +1,23 @@
|
||||
CREATE TABLE public.projects (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id uuid NOT NULL REFERENCES public.tenants(id) ON DELETE CASCADE,
|
||||
name text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT projects_name_not_blank_check CHECK (btrim(name) <> '')
|
||||
);
|
||||
|
||||
CREATE INDEX projects_tenant_id_idx ON public.projects (tenant_id);
|
||||
|
||||
CREATE TABLE public.project_quotas (
|
||||
project_id uuid PRIMARY KEY REFERENCES public.projects(id) ON DELETE CASCADE,
|
||||
max_vcpu integer NOT NULL DEFAULT 8,
|
||||
max_ram_mb integer NOT NULL DEFAULT 16384,
|
||||
max_disk_gb integer NOT NULL DEFAULT 200,
|
||||
max_vms integer NOT NULL DEFAULT 10,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT project_quotas_max_vcpu_check CHECK (max_vcpu >= 0),
|
||||
CONSTRAINT project_quotas_max_ram_mb_check CHECK (max_ram_mb >= 0),
|
||||
CONSTRAINT project_quotas_max_disk_gb_check CHECK (max_disk_gb >= 0),
|
||||
CONSTRAINT project_quotas_max_vms_check CHECK (max_vms >= 0)
|
||||
);
|
||||
Reference in New Issue
Block a user