Archived
Add business logo branding support
This commit is contained in:
@@ -9,7 +9,7 @@ const drizzleDir = path.resolve(import.meta.dir, "../drizzle");
|
||||
const journalPath = path.join(drizzleDir, "meta/_journal.json");
|
||||
|
||||
const journal = JSON.parse(readFileSync(journalPath, "utf8")) as {
|
||||
entries: Array<{ idx: number; tag: string }>;
|
||||
entries: Array<{ idx: number; tag: string; when: number }>;
|
||||
};
|
||||
|
||||
const sqlTags = readdirSync(drizzleDir)
|
||||
@@ -26,6 +26,27 @@ const idxSequence = journal.entries.map((entry) => entry.idx);
|
||||
const expectedIdx = journal.entries.map((_, i) => i);
|
||||
const badIdx = idxSequence.some((idx, i) => idx !== expectedIdx[i]);
|
||||
|
||||
// drizzle's migrator gates on the single highest `when` already recorded in
|
||||
// the target DB — it doesn't check hashes per-migration. If `when` values
|
||||
// ever go non-increasing (e.g. a migration got deleted/renumbered after
|
||||
// being applied to some environment), later entries can silently be skipped
|
||||
// forever even though drizzle reports success. Keep this strictly increasing.
|
||||
//
|
||||
// 0008 and 0011 are known pre-existing exceptions from before this check
|
||||
// existed (see git log on those files) — both already guard every statement
|
||||
// with IF NOT EXISTS specifically because of this, so a skip is harmless.
|
||||
// Don't add new exceptions here; fix the timestamp instead.
|
||||
const KNOWN_NON_MONOTONIC_TAGS = new Set([
|
||||
"0008_payments_recurring_public_links",
|
||||
"0011_time_entry_invoice_id",
|
||||
]);
|
||||
const nonMonotonic = journal.entries.some(
|
||||
(entry, i) =>
|
||||
i > 0 &&
|
||||
entry.when <= journal.entries[i - 1]!.when &&
|
||||
!KNOWN_NON_MONOTONIC_TAGS.has(entry.tag),
|
||||
);
|
||||
|
||||
let failed = false;
|
||||
|
||||
if (missingFromJournal.length > 0) {
|
||||
@@ -45,6 +66,16 @@ if (badIdx) {
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if (nonMonotonic) {
|
||||
console.error(
|
||||
"[verify-drizzle-journal] Journal `when` timestamps are not strictly increasing. " +
|
||||
"drizzle-orm's migrator only compares against the single highest `when` already " +
|
||||
"applied in the target DB, so a lower or equal value here can cause migrations to " +
|
||||
"be silently skipped on databases that already ran a later timestamp.",
|
||||
);
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user