~jan0sch/smederee

~jan0sch/smederee/modules/hub/src/main/resources/db/migration/tickets/V6__ticket_comments.sql
 ..
0 CREATE TABLE tickets.ticket_comments
1 (
2 id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
3 ticket BIGINT NOT NULL,
4 content TEXT NOT NULL,
5 submitter UUID DEFAULT NULL,
6 created_at TIMESTAMP WITH TIME ZONE NOT NULL,
7 updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
8 CONSTRAINT ticket_comments_fk_ticket FOREIGN KEY (ticket)
9 REFERENCES tickets.tickets (id) ON UPDATE CASCADE ON DELETE CASCADE,
10 CONSTRAINT ticket_comments_fk_submitter FOREIGN KEY (submitter)
11 REFERENCES tickets.users (uid) ON UPDATE CASCADE ON DELETE SET NULL
12 )
13 WITH (
14 OIDS=FALSE
15 );
16
17 COMMENT ON TABLE tickets.ticket_comments IS 'Comments on tickets.';
18 COMMENT ON COLUMN tickets.ticket_comments.id IS 'An auto generated primary key.';
19 COMMENT ON COLUMN tickets.ticket_comments.ticket IS 'The unique ID of the ticket to which the comment belongs.';
20 COMMENT ON COLUMN tickets.ticket_comments.content IS 'Required field to hold the content of the comment.';
21 COMMENT ON COLUMN tickets.ticket_comments.submitter IS 'The unique ID of the user account that created the comment.';
22 COMMENT ON COLUMN tickets.ticket_comments.created_at IS 'The timestamp of when the comment was created.';
23 COMMENT ON COLUMN tickets.ticket_comments.updated_at IS 'A timestamp when the comment was last changed.';