mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(coderd/database): add tasks data model (#19749)
Part of https://github.com/coder/internal/issues/948 Adds the initial part of the tasks data model as per the RFC.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
CREATE TABLE tasks (
|
||||
id UUID NOT NULL PRIMARY KEY,
|
||||
organization_id UUID NOT NULL REFERENCES organizations (id) ON DELETE CASCADE,
|
||||
owner_id UUID NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
workspace_id UUID REFERENCES workspaces (id) ON DELETE CASCADE,
|
||||
template_version_id UUID NOT NULL REFERENCES template_versions (id) ON DELETE CASCADE,
|
||||
template_parameters JSONB NOT NULL DEFAULT '{}'::JSONB,
|
||||
prompt TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL,
|
||||
deleted_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
CREATE TABLE task_workspace_apps (
|
||||
task_id UUID NOT NULL REFERENCES tasks (id) ON DELETE CASCADE,
|
||||
workspace_build_id UUID NOT NULL REFERENCES workspace_builds (id) ON DELETE CASCADE,
|
||||
workspace_agent_id UUID NOT NULL REFERENCES workspace_agents (id) ON DELETE CASCADE,
|
||||
workspace_app_id UUID NOT NULL REFERENCES workspace_apps (id) ON DELETE CASCADE
|
||||
);
|
||||
Reference in New Issue
Block a user