feat(schema): items reference their release by foreign key
Hosts that require referential integrity (kof22's foreign key guardrail) get fk_release_notes_item_release_id from the qbit itself (ON DELETE CASCADE). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f6d435fb09
commit
7734da4ece
7 files changed
+11
-9
No files matched your search
@@ -30,7 +30,7 @@ This file provides guidance to Codex when working with code in this repository.
|
||||
- Internal fields (source refs, titles, commit, source log, component versions) never leave the admin tables or appear in the UI API.
|
||||
- Nothing an automated drafter wrote is published unless settings say AUTO_PUBLISH; the sanitizer gates every publish.
|
||||
- No secrets in metadata: GitHub tokens are read from the environment at call time.
|
||||
- No foreign keys; DB changes only in the Liquibase changelog.
|
||||
- DB changes only in the Liquibase changelog; the only foreign key is item -> release.
|
||||
|
||||
## Naming (owner rule)
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ All notable changes are documented here. This project follows Keep a Changelog a
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Release records, items, settings and per-user read state as standard QQQ tables (`release_notes_*`) with a Liquibase changelog (no foreign keys) and seeded settings (require approval, all users, notify).
|
||||
- Release records, items, settings and per-user read state as standard QQQ tables (`release_notes_*`) with a Liquibase changelog (item-to-release foreign key) and seeded settings (require approval, all users, notify).
|
||||
- Once-per-version detection across pods and restarts (unique app + version), started by the host after startup.
|
||||
- `ReleaseSource` SPI with `GitHubReleaseSource` (TAG and WINDOW modes; token read from the environment at call time) and `ComponentVersionsSource`.
|
||||
- `ReleaseNotesDrafter` SPI with the deterministic `RuleBasedDrafter` and `ReleaseNotesSanitizer` (no internal references, personal data or secrets in published text).
|
||||
|
||||
@@ -30,7 +30,7 @@ This file provides guidance to Claude Code when working with code in this reposi
|
||||
- Internal fields (source refs, titles, commit, source log, component versions) never leave the admin tables or appear in the UI API.
|
||||
- Nothing an automated drafter wrote is published unless settings say AUTO_PUBLISH; the sanitizer gates every publish.
|
||||
- No secrets in metadata: GitHub tokens are read from the environment at call time.
|
||||
- No foreign keys; DB changes only in the Liquibase changelog.
|
||||
- DB changes only in the Liquibase changelog; the only foreign key is item -> release.
|
||||
|
||||
## Naming (owner rule)
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ for users who opted in, by email) and adds the release to a "What's new" page. D
|
||||
```
|
||||
|
||||
Include `db/liquibase/qbit-release-notes/release_notes.changelog.sql` once in the host's Liquibase
|
||||
changelog. It creates the four tables (no foreign keys) and seeds the settings row.
|
||||
changelog. It creates the four tables (items reference their release by foreign key) and seeds the
|
||||
settings row.
|
||||
|
||||
```java
|
||||
ReleaseNotesQBitConfig config = new ReleaseNotesQBitConfig()
|
||||
|
||||
+2
-2
@@ -43,8 +43,8 @@ notifications, not alerts.
|
||||
`Website-Backend#262`), source title. Internal fields never leave the admin tables.
|
||||
- `release_notes_user_state`: user id, last seen at. Drives the per-user "new" indicator.
|
||||
|
||||
No foreign keys (QQQ joins only). All DDL in the qbit's Liquibase changelog, runnable by the
|
||||
application database user.
|
||||
Items reference their release with a foreign key (`ON DELETE CASCADE`); no other table is
|
||||
referenced. All DDL is in the qbit's Liquibase changelog, runnable by the application database user.
|
||||
|
||||
## Detection
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS release_notes_release (
|
||||
CREATE INDEX IF NOT EXISTS release_notes_release_status_published ON release_notes_release (app_name, status, published_at);
|
||||
|
||||
-- changeset qbit-release-notes:3
|
||||
-- comment: Release items: customer text plus internal source references. No foreign keys (QQQ joins).
|
||||
-- comment: Release items: customer text plus internal source references; each belongs to one release.
|
||||
CREATE TABLE IF NOT EXISTS release_notes_item (
|
||||
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
release_id INTEGER NOT NULL,
|
||||
@@ -58,7 +58,8 @@ CREATE TABLE IF NOT EXISTS release_notes_item (
|
||||
source_ref VARCHAR(200),
|
||||
source_title VARCHAR(500),
|
||||
create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
modify_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
modify_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_release_notes_item_release_id FOREIGN KEY (release_id) REFERENCES release_notes_release (id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS release_notes_item_release ON release_notes_item (release_id);
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class ReleaseNotesMetaDataTest
|
||||
}
|
||||
}
|
||||
String script = new String(getClass().getClassLoader().getResourceAsStream(ReleaseNotesMetaData.CHANGELOG).readAllBytes(), java.nio.charset.StandardCharsets.UTF_8);
|
||||
assertThat(script).doesNotContainIgnoringCase("FOREIGN KEY (").doesNotContainIgnoringCase(" REFERENCES ");
|
||||
assertThat(script).contains("CONSTRAINT fk_release_notes_item_release_id FOREIGN KEY (release_id) REFERENCES release_notes_release (id)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user