Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(coderd/database): add tasks data model#19749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 1 commit intomainfromdanielle/tasks/data-model
Sep 10, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletionscoderd/database/dump.sql
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

8 changes: 8 additions & 0 deletionscoderd/database/foreign_key_constraint.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Obligatory reminder to check migration number before merge!

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
DROP TABLE task_workspace_apps;
DROP TABLE tasks;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -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
);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
INSERT INTO public.tasks VALUES (
'f5a1c3e4-8b2d-4f6a-9d7e-2a8b5c9e1f3d', -- id
'bb640d07-ca8a-4869-b6bc-ae61ebb2fda1', -- organization_id
'30095c71-380b-457a-8995-97b8ee6e5307', -- owner_id
'Test Task 1', -- name
'3a9a1feb-e89d-457c-9d53-ac751b198ebe', -- workspace_id
'920baba5-4c64-4686-8b7d-d1bef5683eae', -- template_version_id
'{}'::JSONB, -- template_parameters
'Create a React component for tasks', -- prompt
'2024-11-02 13:10:00.000000+02', -- created_at
NULL -- deleted_at
) ON CONFLICT DO NOTHING;

INSERT INTO public.task_workspace_apps VALUES (
'f5a1c3e4-8b2d-4f6a-9d7e-2a8b5c9e1f3d', -- task_id
'a8c0b8c5-c9a8-4f33-93a4-8142e6858244', -- workspace_build_id
'8fa17bbd-c48c-44c7-91ae-d4acbc755fad', -- workspace_agent_id
'a47965a2-0a25-4810-8cc9-d283c86ab34c' -- workspace_app_id
) ON CONFLICT DO NOTHING;
20 changes: 20 additions & 0 deletionscoderd/database/models.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

1 change: 1 addition & 0 deletionscoderd/database/unique_constraint.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp