Skip to content

Commit

Permalink
Declare initial database state
Browse files Browse the repository at this point in the history
  • Loading branch information
mechakdotdev committed Oct 2, 2024
1 parent 696f5ce commit 2228ac8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
INSERT INTO "projects" (name, description)
VALUES ('Alpha Project', 'Primary project for creating new project');
INSERT INTO "projects" (name, description)
VALUES ('Beta Project', 'Description of the secondary project');

INSERT INTO "tasks" (projectId, title, priority, dueDate, description)
VALUES (1, 'Create Alpha repo', 1, DATE '2024-10-01', 'Complete the first task');
INSERT INTO "tasks" (projectId, title, priority, dueDate, description)
VALUES (1, 'Add branch rules', 2, DATE '2024-10-10', 'Complete the second task');
INSERT INTO "tasks" (projectId, title, priority, dueDate, description)
VALUES (2, 'Create repo for Beta', 3, DATE '2024-10-05', 'Task for Project Beta');

INSERT INTO "labels" (taskId, title, description)
VALUES (1, 'Urgent', 'Needs to be done ASAP');
INSERT INTO "labels" (taskId, title, description)
VALUES (1, 'Research', 'Requires investigation');
INSERT INTO "labels" (taskId, title, description)
VALUES (2, 'Review', 'Needs to be reviewed by the team');
INSERT INTO "labels" (taskId, title, description)
VALUES (3, 'Follow-up', 'Requires follow-up after completion');
26 changes: 26 additions & 0 deletions src/main/resources/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE TABLE "projects"
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description VARCHAR(255)
);

CREATE TABLE "tasks"
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
projectId BIGINT,
title VARCHAR(255) NOT NULL,
priority INT,
dueDate DATE,
description VARCHAR(255),
FOREIGN KEY (projectId) REFERENCES "projects" (id)
);

CREATE TABLE "labels"
(
id BIGINT AUTO_INCREMENT PRIMARY KEY,
taskId BIGINT,
title VARCHAR(255) NOT NULL,
description VARCHAR(255),
FOREIGN KEY (taskId) REFERENCES "tasks" (id)
);

0 comments on commit 2228ac8

Please sign in to comment.