Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: add issue_comment table (#11397)

p0nyd013ded25dc8
diff --git a/backend/migrator/migration/prod/2.15/0015##issue_comment.sql b/backend/migrator/migration/prod/2.15/0015##issue_comment.sql
new file mode 100644
index 0000000000..29c1a5931e
--- /dev/null
+++ b/backend/migrator/migration/prod/2.15/0015##issue_comment.sql
@@ -0,0 +1,20 @@
+CREATE TABLE issue_comment (
+ id BIGSERIAL PRIMARY KEY,
+ row_status row_status NOT NULL DEFAULT 'NORMAL',
+ creator_id INTEGER NOT NULL REFERENCES principal (id),
+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
+ updater_id INTEGER NOT NULL REFERENCES principal (id),
+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
+ issue_id INTEGER NOT NULL REFERENCES issue (id),
+ payload JSONB NOT NULL DEFAULT '{}'
+);
+
+CREATE INDEX idx_issue_comment_issue_id ON issue_comment(issue_id);
+
+ALTER SEQUENCE issue_comment_id_seq RESTART WITH 101;
+
+CREATE TRIGGER update_issue_comment_updated_ts
+BEFORE
+UPDATE
+ ON issue_comment FOR EACH ROW
+EXECUTE FUNCTION trigger_update_updated_ts();
diff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sql
index 7a0382756e..a61480c8ce 100644
--- a/backend/migrator/migration/prod/LATEST.sql
+++ b/backend/migrator/migration/prod/LATEST.sql
@@ -799,6 +799,27 @@ UPDATE
ON activity FOR EACH ROW
EXECUTE FUNCTION trigger_update_updated_ts();
+CREATE TABLE issue_comment (
+ id BIGSERIAL PRIMARY KEY,
+ row_status row_status NOT NULL DEFAULT 'NORMAL',
+ creator_id INTEGER NOT NULL REFERENCES principal (id),
+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
+ updater_id INTEGER NOT NULL REFERENCES principal (id),
+ updated_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),
+ issue_id INTEGER NOT NULL REFERENCES issue (id),
+ payload JSONB NOT NULL DEFAULT '{}'
+);
+
+CREATE INDEX idx_issue_comment_issue_id ON issue_comment(issue_id);
+
+ALTER SEQUENCE issue_comment_id_seq RESTART WITH 101;
+
+CREATE TRIGGER update_issue_comment_updated_ts
+BEFORE
+UPDATE
+ ON issue_comment FOR EACH ROW
+EXECUTE FUNCTION trigger_update_updated_ts();
+
CREATE TABLE query_history (
id BIGSERIAL PRIMARY KEY,
row_status row_status NOT NULL DEFAULT 'NORMAL',
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 11f853ea3a..3fe7046444 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -230,5 +230,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("2.15.14"), releaseVersion)
+ require.Equal(t, semver.MustParse("2.15.15"), releaseVersion)
}