Payload
{
"action": "created",
"issue": {
"url": "https://api.github.com/repos/voytravel/voy/issues/1076",
"repository_url": "https://api.github.com/repos/voytravel/voy",
"labels_url": "https://api.github.com/repos/voytravel/voy/issues/1076/labels{/name}",
"comments_url": "https://api.github.com/repos/voytravel/voy/issues/1076/comments",
"events_url": "https://api.github.com/repos/voytravel/voy/issues/1076/events",
"html_url": "https://github.com/voytravel/voy/issues/1076",
"id": 4781943859,
"node_id": "I_kwDOPLnB3s8AAAABHQasMw",
"number": 1076,
"title": "where a migration is added to the",
"user": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"user_view_type": "public",
"site_admin": false
},
"labels": [],
"state": "open",
"locked": false,
"assignees": [],
"milestone": null,
"comments": 2,
"created_at": "2026-07-01T02:44:55Z",
"updated_at": "2026-07-04T14:02:38Z",
"closed_at": null,
"assignee": null,
"author_association": "NONE",
"issue_field_values": [],
"type": null,
"active_lock_reason": null,
"sub_issues_summary": {
"total": 0,
"completed": 0,
"percent_completed": 0
},
"issue_dependencies_summary": {
"blocked_by": 0,
"total_blocked_by": 0,
"blocking": 0,
"total_blocking": 0
},
"body": "Drizzle journal \\*behind\\* migrations that deployed environments have already\n\napplied\\. drizzle\\-kit migrate only runs migrations whose \\`when\\` is newer than\n\nthe last\\-applied one, so a back\\-dated / mid\\-inserted migration is silently\n\nskipped forever on staging and prod \\(it only ever appears via \\`drizzle\\-kit\n\npush\\` in dev\\)\\. This check enforces that migrations are append\\-only: any\n\nmigration added in this branch must have a higher idx AND a newer \\`when\\`\n\nthan everything already on the base branch\\.\n\nhttps://github.com/voytravel/voy/blob/f9da6d7f9854565f46c2462d1309cd07ec8ae1fe/scripts/ci/check-drizzle-journal.mjs#L1-L8\n\n```javascript\n\n// Guards against the class of migration bug where a migration is added to the\n// Drizzle journal *behind* migrations that deployed environments have already\n// applied. drizzle-kit migrate only runs migrations whose `when` is newer than\n// the last-applied one, so a back-dated / mid-inserted migration is silently\n// skipped forever on staging and prod (it only ever appears via `drizzle-kit\n// push` in dev). This check enforces that migrations are append-only: any\n// migration added in this branch must have a higher idx AND a newer `when`\n// than everything already on the base branch.\nimport { execFileSync } from \"node:child_process\";\nimport { readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst repoRoot = path.resolve(\n path.dirname(fileURLToPath(import.meta.url)),\n \"../..\",\n);\nconst journalRelPath = \"packages/db/drizzle/meta/_journal.json\";\nconst migrationsDir = path.join(repoRoot, \"packages/db/drizzle\");\n\nconst errors = [];\n\nfunction readJournal(json) {\n const parsed = JSON.parse(json);\n const entries = [...parsed.entries].sort((a, b) => a.idx - b.idx);\n return entries;\n}\n\nconst headEntries = readJournal(\n readFileSync(path.join(repoRoot, journalRelPath), \"utf8\"),\n);\n\n// --- Self-contained invariants -------------------------------------------\nconst seenIdx = new Set();\nfor (const entry of headEntries) {\n if (seenIdx.has(entry.idx)) {\n errors.push(`duplicate journal idx ${entry.idx} (tag ${entry.tag})`);\n }\n seenIdx.add(entry.idx);\n}\n\nfor (let i = 1; i < headEntries.length; i += 1) {\n const prev = headEntries[i - 1];\n const cur = headEntries[i];\n if (cur.when <= prev.when) {\n errors.push(\n `journal is not monotonic: ${cur.tag} (idx ${cur.idx}, when ${cur.when}) ` +\n `is not newer than ${prev.tag} (idx ${prev.idx}, when ${prev.when})`,\n );\n }\n}\n\n// Every journal entry must have its .sql file, and vice versa.\nconst sqlFiles = new Set(\n readdirSync(migrationsDir).filter((name) => name.endsWith(\".sql\")),\n);\nconst journalTags = new Set(headEntries.map((e) => `${e.tag}.sql`));\nfor (const entry of headEntries) {\n if (!sqlFiles.has(`${entry.tag}.sql`)) {\n errors.push(`journal entry ${entry.tag} has no matching ${entry.tag}.sql`);\n }\n}\nfor (const file of sqlFiles) {\n if (!journalTags.has(file)) {\n errors.push(`migration file ${file} is not registered in the journal`);\n }\n}\n\n// --- Append-only vs base branch ------------------------------------------\n// Only safe ref characters; also rejects leading \"-\" so a ref can never be\n// interpreted as a git flag (execFileSync already avoids shell injection).\nconst safeRef = (ref) => /^[A-Za-z0-9._/-]+$/.test(ref) && !ref.startsWith(\"-\");\n\nfunction gitShowJournal(ref) {\n return execFileSync(\"git\", [\"show\", `${ref}:${journalRelPath}`], {\n cwd: repoRoot,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n}\n\nfunction loadBaseEntries() {\n // biome-ignore lint/style/noProcessEnv: CI script reads GITHUB_BASE_REF directly\n const baseRef = process.env.GITHUB_BASE_REF || \"develop\";\n const candidates = [\n `origin/${baseRef}`,\n baseRef,\n \"origin/develop\",\n \"develop\",\n ].filter(safeRef);\n for (const ref of candidates) {\n try {\n return { ref, entries: readJournal(gitShowJournal(ref)) };\n } catch {\n // try next candidate\n }\n }\n // Shallow CI checkouts may not have the base yet — fetch it, then retry.\n if (safeRef(baseRef)) {\n try {\n execFileSync(\"git\", [\"fetch\", \"--depth=1\", \"origin\", baseRef], {\n cwd: repoRoot,\n stdio: \"ignore\",\n });\n return {\n ref: `origin/${baseRef}`,\n entries: readJournal(gitShowJournal(`origin/${baseRef}`)),\n };\n } catch {\n // fall through\n }\n }\n return null;\n}\n\nconst base = loadBaseEntries();\nif (!base) {\n // biome-ignore lint/style/noProcessEnv: detect CI to decide fail-vs-skip\n const inCI = Boolean(process.env.CI || process.env.GITHUB_ACTIONS);\n if (inCI) {\n // Never silently skip the append-only check in CI — that's the whole point.\n errors.push(\n \"could not resolve the base branch journal for the append-only check; \" +\n \"ensure the base ref is available (checkout with fetch-depth: 0)\",\n );\n } else {\n process.stdout.write(\n \"[check:drizzle-journal] base journal not resolvable locally; skipping append-only check (self-contained checks still ran)\\n\",\n );\n }\n} else {\n const baseTags = new Set(base.entries.map((e) => e.tag));\n const baseMaxIdx = Math.max(...base.entries.map((e) => e.idx));\n const baseMaxWhen = Math.max(...base.entries.map((e) => e.when));\n const newEntries = headEntries.filter((e) => !baseTags.has(e.tag));\n\n for (const entry of newEntries) {\n if (entry.idx <= baseMaxIdx || entry.when <= baseMaxWhen) {\n errors.push(\n `migration ${entry.tag} is not append-only vs ${base.ref}: ` +\n `idx ${entry.idx} / when ${entry.when} must both exceed the base head ` +\n `(idx ${baseMaxIdx} / when ${baseMaxWhen}). ` +\n \"A migration behind the base head is silently skipped on deployed databases. \" +\n \"Regenerate it with `drizzle-kit generate` so it appends at the head.\",\n );\n }\n }\n}\n\nif (errors.length > 0) {\n process.stderr.write(\"Drizzle journal check failed:\\n\");\n for (const error of errors) {\n process.stderr.write(` - ${error}\\n`);\n }\n process.exit(1);\n}\n\nprocess.stdout.write(\n `[check:drizzle-journal] OK — ${headEntries.length} migrations, journal monotonic and append-only\\n`,\n);\n\n```",
"reactions": {
"url": "https://api.github.com/repos/voytravel/voy/issues/1076/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"timeline_url": "https://api.github.com/repos/voytravel/voy/issues/1076/timeline",
"performed_via_github_app": null,
"state_reason": null,
"pinned_comment": null
},
"comment": {
"url": "https://api.github.com/repos/voytravel/voy/issues/comments/4882316650",
"html_url": "https://github.com/voytravel/voy/issues/1076#issuecomment-4882316650",
"issue_url": "https://api.github.com/repos/voytravel/voy/issues/1076",
"id": 4882316650,
"node_id": "IC_kwDOPLnB3s8AAAABIwI9ag",
"user": {
"login": "czxtm",
"id": 1325802,
"node_id": "MDQ6VXNlcjEzMjU4MDI=",
"avatar_url": "https://avatars.githubusercontent.com/u/1325802?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/czxtm",
"html_url": "https://github.com/czxtm",
"followers_url": "https://api.github.com/users/czxtm/followers",
"following_url": "https://api.github.com/users/czxtm/following{/other_user}",
"gists_url": "https://api.github.com/users/czxtm/gists{/gist_id}",
"starred_url": "https://api.github.com/users/czxtm/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/czxtm/subscriptions",
"organizations_url": "https://api.github.com/users/czxtm/orgs",
"repos_url": "https://api.github.com/users/czxtm/repos",
"events_url": "https://api.github.com/users/czxtm/events{/privacy}",
"received_events_url": "https://api.github.com/users/czxtm/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"created_at": "2026-07-04T14:02:38Z",
"updated_at": "2026-07-04T14:02:38Z",
"body": "/bot ping",
"author_association": "MEMBER",
"pin": null,
"reactions": {
"url": "https://api.github.com/repos/voytravel/voy/issues/comments/4882316650/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"performed_via_github_app": null
},
"repository": {
"id": 1018806750,
"node_id": "R_kgDOPLnB3g",
"name": "voy",
"full_name": "voytravel/voy",
"private": true,
"owner": {
"login": "voytravel",
"id": 213144510,
"node_id": "O_kgDODLRTvg",
"avatar_url": "https://avatars.githubusercontent.com/u/213144510?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/voytravel",
"html_url": "https://github.com/voytravel",
"followers_url": "https://api.github.com/users/voytravel/followers",
"following_url": "https://api.github.com/users/voytravel/following{/other_user}",
"gists_url": "https://api.github.com/users/voytravel/gists{/gist_id}",
"starred_url": "https://api.github.com/users/voytravel/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/voytravel/subscriptions",
"organizations_url": "https://api.github.com/users/voytravel/orgs",
"repos_url": "https://api.github.com/users/voytravel/repos",
"events_url": "https://api.github.com/users/voytravel/events{/privacy}",
"received_events_url": "https://api.github.com/users/voytravel/received_events",
"type": "Organization",
"user_view_type": "public",
"site_admin": false
},
"html_url": "https://github.com/voytravel/voy",
"description": "Voy Monorepo",
"fork": false,
"url": "https://api.github.com/repos/voytravel/voy",
"forks_url": "https://api.github.com/repos/voytravel/voy/forks",
"keys_url": "https://api.github.com/repos/voytravel/voy/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/voytravel/voy/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/voytravel/voy/teams",
"hooks_url": "https://api.github.com/repos/voytravel/voy/hooks",
"issue_events_url": "https://api.github.com/repos/voytravel/voy/issues/events{/number}",
"events_url": "https://api.github.com/repos/voytravel/voy/events",
"assignees_url": "https://api.github.com/repos/voytravel/voy/assignees{/user}",
"branches_url": "https://api.github.com/repos/voytravel/voy/branches{/branch}",
"tags_url": "https://api.github.com/repos/voytravel/voy/tags",
"blobs_url": "https://api.github.com/repos/voytravel/voy/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/voytravel/voy/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/voytravel/voy/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/voytravel/voy/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/voytravel/voy/statuses/{sha}",
"languages_url": "https://api.github.com/repos/voytravel/voy/languages",
"stargazers_url": "https://api.github.com/repos/voytravel/voy/stargazers",
"contributors_url": "https://api.github.com/repos/voytravel/voy/contributors",
"subscribers_url": "https://api.github.com/repos/voytravel/voy/subscribers",
"subscription_url": "https://api.github.com/repos/voytravel/voy/subscription",
"commits_url": "https://api.github.com/repos/voytravel/voy/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/voytravel/voy/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/voytravel/voy/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/voytravel/voy/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/voytravel/voy/contents/{+path}",
"compare_url": "https://api.github.com/repos/voytravel/voy/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/voytravel/voy/merges",
"archive_url": "https://api.github.com/repos/voytravel/voy/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/voytravel/voy/downloads",
"issues_url": "https://api.github.com/repos/voytravel/voy/issues{/number}",
"pulls_url": "https://api.github.com/repos/voytravel/voy/pulls{/number}",
"milestones_url": "https://api.github.com/repos/voytravel/voy/milestones{/number}",
"notifications_url": "https://api.github.com/repos/voytravel/voy/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/voytravel/voy/labels{/name}",
"releases_url": "https://api.github.com/repos/voytravel/voy/releases{/id}",
"deployments_url": "https://api.github.com/repos/voytravel/voy/deployments",
"created_at": "2025-07-13T04:51:01Z",
"updated_at": "2026-07-04T05:45:38Z",
"pushed_at": "2026-07-04T13:31:26Z",
"git_url": "git://github.com/voytravel/voy.git",
"ssh_url": "org-213144510@github.com:voytravel/voy.git",
"clone_url": "https://github.com/voytravel/voy.git",
"svn_url": "https://github.com/voytravel/voy",
"homepage": null,
"size": 68281,
"stargazers_count": 1,
"watchers_count": 1,
"language": "TypeScript",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": false,
"has_pages": false,
"has_discussions": true,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 39,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"allow_forking": false,
"is_template": false,
"web_commit_signoff_required": false,
"has_pull_requests": true,
"pull_request_creation_policy": "all",
"topics": [],
"visibility": "private",
"forks": 0,
"open_issues": 39,
"watchers": 1,
"default_branch": "develop",
"custom_properties": {}
},
"organization": {
"login": "voytravel",
"id": 213144510,
"node_id": "O_kgDODLRTvg",
"url": "https://api.github.com/orgs/voytravel",
"repos_url": "https://api.github.com/orgs/voytravel/repos",
"events_url": "https://api.github.com/orgs/voytravel/events",
"hooks_url": "https://api.github.com/orgs/voytravel/hooks",
"issues_url": "https://api.github.com/orgs/voytravel/issues",
"members_url": "https://api.github.com/orgs/voytravel/members{/member}",
"public_members_url": "https://api.github.com/orgs/voytravel/public_members{/member}",
"avatar_url": "https://avatars.githubusercontent.com/u/213144510?v=4",
"description": ""
},
"enterprise": {
"id": 469843,
"slug": "darkmatter",
"name": "darkmatter",
"node_id": "E_kgDOAAcrUw",
"avatar_url": "https://avatars.githubusercontent.com/b/469843?v=4",
"description": "",
"website_url": "darkmatter.io",
"html_url": "https://github.com/enterprises/darkmatter",
"created_at": "2025-09-07T16:01:00Z",
"updated_at": "2026-07-02T14:01:25Z"
},
"sender": {
"login": "czxtm",
"id": 1325802,
"node_id": "MDQ6VXNlcjEzMjU4MDI=",
"avatar_url": "https://avatars.githubusercontent.com/u/1325802?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/czxtm",
"html_url": "https://github.com/czxtm",
"followers_url": "https://api.github.com/users/czxtm/followers",
"following_url": "https://api.github.com/users/czxtm/following{/other_user}",
"gists_url": "https://api.github.com/users/czxtm/gists{/gist_id}",
"starred_url": "https://api.github.com/users/czxtm/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/czxtm/subscriptions",
"organizations_url": "https://api.github.com/users/czxtm/orgs",
"repos_url": "https://api.github.com/users/czxtm/repos",
"events_url": "https://api.github.com/users/czxtm/events{/privacy}",
"received_events_url": "https://api.github.com/users/czxtm/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"installation": {
"id": 143976268,
"node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMTQzOTc2MjY4"
}
}