Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 152 additions & 16 deletions .cursor/hooks/state/continual-learning-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,172 @@
"version": 1,
"transcripts": {
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/002a2386-b47b-43a7-9bb6-d4d8a6298d1c/002a2386-b47b-43a7-9bb6-d4d8a6298d1c.jsonl": {
"mtimeMs": 1774147725000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774147725785.4514,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/00b15c83-33c0-4e9e-8f2a-3c17f962ee31.jsonl": {
"mtimeMs": 1774226238061.2812,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/subagents/03f5d34a-5482-4b78-b72a-b15487bc71a2.jsonl": {
"mtimeMs": 1774210664949.789,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/subagents/0afa7023-ec10-4e8a-a707-530ca996060b.jsonl": {
"mtimeMs": 1774223568131.516,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/subagents/33098994-b8e7-4354-adfb-0d73b393ddbe.jsonl": {
"mtimeMs": 1774210667359.2795,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/subagents/dd06132a-a9aa-43ff-88f0-2ffe99957a2c.jsonl": {
"mtimeMs": 1774223577243.7368,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/subagents/e9a0be7c-edb6-43bf-9487-fa5044329f13.jsonl": {
"mtimeMs": 1774210668557.631,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/00b15c83-33c0-4e9e-8f2a-3c17f962ee31/subagents/ebafe595-23b2-4f64-9f09-8b736010ea9c.jsonl": {
"mtimeMs": 1774223581186.5146,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/17d40776-be56-4ea6-825f-eefa95f4c2f3/17d40776-be56-4ea6-825f-eefa95f4c2f3.jsonl": {
"mtimeMs": 1774152428000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774152428835.4429,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/21b55e6e-d718-45aa-86db-451b69f1cdde/21b55e6e-d718-45aa-86db-451b69f1cdde.jsonl": {
"mtimeMs": 1774363680053.065,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/40b689da-069d-4673-9390-aaf557f316c8/40b689da-069d-4673-9390-aaf557f316c8.jsonl": {
"mtimeMs": 1774327126562.536,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/41fe7e85-46cb-422a-8c88-0ae7a0c8f370/41fe7e85-46cb-422a-8c88-0ae7a0c8f370.jsonl": {
"mtimeMs": 1774320336000.9146,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/45b9e640-cbcd-45f8-a380-8a78e5af79f0/45b9e640-cbcd-45f8-a380-8a78e5af79f0.jsonl": {
"mtimeMs": 1774226932241.085,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/4955feb7-bf87-4db0-a931-c2c4653e2f30/4955feb7-bf87-4db0-a931-c2c4653e2f30.jsonl": {
"mtimeMs": 1774380025014.791,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/49906c8d-f022-477b-9126-46ecb440a843/49906c8d-f022-477b-9126-46ecb440a843.jsonl": {
"mtimeMs": 1774377088076.403,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/581aa5fb-3033-4853-8582-a14dc0b20fe4/581aa5fb-3033-4853-8582-a14dc0b20fe4.jsonl": {
"mtimeMs": 1774377594876.5688,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/5dd5e71e-38d9-4b89-80b2-83af608fd7af/5dd5e71e-38d9-4b89-80b2-83af608fd7af.jsonl": {
"mtimeMs": 1774205388000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774206132975.22,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/60816355-d298-4b22-ac3e-086d47cb5a66/60816355-d298-4b22-ac3e-086d47cb5a66.jsonl": {
"mtimeMs": 1774325530960.87,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/75bfdfd7-040d-4cb2-bcf1-6bf77cdbe883/75bfdfd7-040d-4cb2-bcf1-6bf77cdbe883.jsonl": {
"mtimeMs": 1774372396045.1204,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/764844f8-85e9-4438-bcb8-ccb623d8e58f/764844f8-85e9-4438-bcb8-ccb623d8e58f.jsonl": {
"mtimeMs": 1774374048928.922,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/7789530a-c2e6-405b-81e3-3151c665b97d/7789530a-c2e6-405b-81e3-3151c665b97d.jsonl": {
"mtimeMs": 1774155771000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774155771647.1985,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/7b0b1a3f-2dab-4a53-bc19-8d06ec7af9d8/7b0b1a3f-2dab-4a53-bc19-8d06ec7af9d8.jsonl": {
"mtimeMs": 1774320715719.3796,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/7b57ee5d-b37a-461c-bb62-ad5aa48e3096/7b57ee5d-b37a-461c-bb62-ad5aa48e3096.jsonl": {
"mtimeMs": 1774229477325.7961,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/80e5047f-5b5b-499b-9879-30684de9e4ce/80e5047f-5b5b-499b-9879-30684de9e4ce.jsonl": {
"mtimeMs": 1774209051569.5986,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/861cf074-067e-4500-85f2-a3182cd5592f/861cf074-067e-4500-85f2-a3182cd5592f.jsonl": {
"mtimeMs": 1774324098170.2104,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/9cef602b-12c8-4212-9a1e-7ad42ef38709/9cef602b-12c8-4212-9a1e-7ad42ef38709.jsonl": {
"mtimeMs": 1774378989286.0786,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/a9d70bbe-5901-4f43-87a3-e4b64277c831/a9d70bbe-5901-4f43-87a3-e4b64277c831.jsonl": {
"mtimeMs": 1774233203202.6758,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/adb7eac6-bc72-4072-ae22-9ecf7ed5096a/adb7eac6-bc72-4072-ae22-9ecf7ed5096a.jsonl": {
"mtimeMs": 1774274625791.6033,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/b118bb57-9ea3-42c6-ad34-a0bb0c62162b/b118bb57-9ea3-42c6-ad34-a0bb0c62162b.jsonl": {
"mtimeMs": 1774324587147.1196,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/b180dc0e-90a9-4397-9ec9-1065c76bd37e/b180dc0e-90a9-4397-9ec9-1065c76bd37e.jsonl": {
"mtimeMs": 1774364991972.5874,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/b28cb09c-17a2-46ad-a35b-3b31168f904e/b28cb09c-17a2-46ad-a35b-3b31168f904e.jsonl": {
"mtimeMs": 1774159223000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774159223104.927,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/b6ce4f82-eb35-43d1-a778-d60f039408c9/b6ce4f82-eb35-43d1-a778-d60f039408c9.jsonl": {
"mtimeMs": 1774157413000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774157413805.4668,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/d48a85be-dcf2-4d65-92e6-6f67069eed6d/d48a85be-dcf2-4d65-92e6-6f67069eed6d.jsonl": {
"mtimeMs": 1774322125607.0754,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/d4e1af69-1244-4b96-a5cc-5b8a18e8e4ec/d4e1af69-1244-4b96-a5cc-5b8a18e8e4ec.jsonl": {
"mtimeMs": 1774156949000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774156949227.7864,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/d7adc668-cf73-4b66-bc55-c992f740faf2/d7adc668-cf73-4b66-bc55-c992f740faf2.jsonl": {
"mtimeMs": 1774324482637.3472,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/ddd0de67-4ba3-4361-a2f0-6cde56e1ff01/ddd0de67-4ba3-4361-a2f0-6cde56e1ff01.jsonl": {
"mtimeMs": 1774149233000,
"lastProcessedAt": "2026-03-22T18:50:20.000Z"
"mtimeMs": 1774149233117.0437,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/e45dc4d4-9e75-46fc-b001-f5958e0d7a81/e45dc4d4-9e75-46fc-b001-f5958e0d7a81.jsonl": {
"mtimeMs": 1774364811692.5452,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/e45dc4d4-9e75-46fc-b001-f5958e0d7a81/subagents/1387934c-4122-436b-8e0a-ccda6df53230.jsonl": {
"mtimeMs": 1774364186872.2568,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/e45dc4d4-9e75-46fc-b001-f5958e0d7a81/subagents/4d1d8e90-da91-4999-9939-e635a08670bf.jsonl": {
"mtimeMs": 1774364224838.2573,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/e6ebc0d8-dead-4373-a8de-79d70eeba555/e6ebc0d8-dead-4373-a8de-79d70eeba555.jsonl": {
"mtimeMs": 1774323721882.5671,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/ea8de5df-7773-4b82-90e0-0f4e4cc2048b/ea8de5df-7773-4b82-90e0-0f4e4cc2048b.jsonl": {
"mtimeMs": 1774377304060.8044,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
},
"/Users/edahl/.cursor/projects/Users-edahl-Documents-GitHub-clawproxy/agent-transcripts/f23fd01c-5e78-4a28-b601-17ce7ee325ae/f23fd01c-5e78-4a28-b601-17ce7ee325ae.jsonl": {
"mtimeMs": 1774374944593.0713,
"lastProcessedAt": "2026-03-24T19:21:13.771Z"
}
}
}
8 changes: 4 additions & 4 deletions .cursor/hooks/state/continual-learning.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": 1,
"lastRunAtMs": 1774205384265,
"turnsSinceLastRun": 6,
"lastTranscriptMtimeMs": 1774205384073,
"lastProcessedGenerationId": "be5a8da6-6a66-4dd0-abdf-1d8ebc0d9762",
"lastRunAtMs": 1774380014755,
"turnsSinceLastRun": 1,
"lastTranscriptMtimeMs": 1774380014716,
"lastProcessedGenerationId": "2cceeb7e-0721-4f00-84d1-eb6ca0c7d720",
"trialStartedAtMs": null
}
77 changes: 40 additions & 37 deletions .github/workflows/neon_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ jobs:

create_neon_branch:
name: Create Neon Branch
permissions:
contents: read
outputs:
db_url: ${{ steps.create_neon_branch.outputs.db_url }}
db_url_pooled: ${{ steps.create_neon_branch.outputs.db_url_pooled }}
needs: setup
if: |
github.event_name == 'pull_request' && (
github.event.action == 'synchronize'
|| github.event.action == 'opened'
|| github.event.action == 'reopened')
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -65,50 +63,55 @@ jobs:
- name: Install dependencies
run: yarn install --immutable

# The step above creates a new Neon branch.
# You may want to do something with the new branch, such as run migrations, run tests
# on it, or send the connection details to a hosting platform environment.
# The branch DATABASE_URL is available to you via:
# "${{ steps.create_neon_branch.outputs.db_url_pooled }}".
# It's important you don't log the DATABASE_URL as output as it contains a username and
# password for your database.
- name: Run Migrations
run: yarn db:push
# Apply committed migrations only (run `yarn db:generate` locally when schema changes).
- name: Run migrations on preview branch
run: yarn db:migrate
env:
# to use pooled connection
#DATABASE_URL: "${{ steps.create_neon_branch.outputs.db_url_pooled }}"
# OR to use unpooled connection
DATABASE_URL: "${{ steps.create_neon_branch.outputs.db_url }}"

# Following the step above, which runs database migrations, you may want to check
# for schema changes in your database. We recommend using the following action to
# post a comment to your pull request with the schema diff. For this action to work,
# you also need to give permissions to the workflow job to be able to post comments
# and read your repository contents. Add the following permissions to the workflow job:
#
# permissions:
# contents: read
# pull-requests: write
#
# You can also check out https://github.com/neondatabase/schema-diff-action for more
# information on how to use the schema diff action.
# You can uncomment the lines below to enable the schema diff action.
# - name: Post Schema Diff Comment to PR
# uses: neondatabase/schema-diff-action@v1
# with:
# project_id: ${{ vars.NEON_PROJECT_ID }}
# compare_branch: preview/pr-${{ github.event.number }}-${{ needs.setup.outputs.branch }}
# api_key: ${{ secrets.NEON_API_KEY }}
- name: Post schema diff comment to PR
uses: neondatabase/schema-diff-action@v1
with:
project_id: ${{ vars.NEON_PROJECT_ID }}
compare_branch: preview/pr-${{ github.event.number }}-${{ needs.setup.outputs.branch }}
api_key: ${{ secrets.NEON_API_KEY }}

delete_neon_branch:
name: Delete Neon Branch
name: Delete Neon Branch and apply production migrations
needs: setup
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v3
with:
project_id: ${{ vars.NEON_PROJECT_ID }}
branch: preview/pr-${{ github.event.number }}-${{ needs.setup.outputs.branch }}
api_key: ${{ secrets.NEON_API_KEY }}
Comment on lines 87 to 92

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this job, the preview branch is deleted before production migrations run. If the delete-branch action fails (e.g., branch already deleted/expired or transient Neon API error), subsequent steps will be skipped (default if: success()), so production migrations won’t run on merge. Consider running production migrations before deleting the preview branch, and/or make the delete step non-blocking (continue-on-error: true) and use if: always() for the migration steps so they still execute when merged.

Copilot uses AI. Check for mistakes.

- name: Checkout
if: github.event.pull_request.merged == true
uses: actions/checkout@v4

Comment on lines +94 to +97

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says production migrations should run against the merge commit, but this checkout doesn’t specify a ref. To ensure migrations run with exactly the merged migrations (and not an unexpected default ref), explicitly check out github.event.pull_request.merge_commit_sha (or github.sha if you’ve confirmed it matches the merge commit for pull_request.closed).

Copilot uses AI. Check for mistakes.
- name: Setup Node.js
if: github.event.pull_request.merged == true
uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn

- name: Enable Corepack (Yarn from packageManager)
if: github.event.pull_request.merged == true
run: corepack enable

- name: Install dependencies
if: github.event.pull_request.merged == true
run: yarn install --immutable

- name: Apply migrations to production
if: github.event.pull_request.merged == true
run: yarn db:migrate
env:
DATABASE_URL: "${{ secrets.DATABASE_URL }}"
29 changes: 29 additions & 0 deletions db/baseline-drizzle-migrations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- One-time fixes for drizzle-kit migrate + Neon branching:
-- 1) Empty __drizzle_migrations while tables already exist (e.g. after db:push).
-- 2) A row for 0002 with created_at lower than 0001’s (breaks Drizzle’s “max(created_at)” check).
--
-- Hashes are SHA-256 of each db/migrations/<tag>.sql file. created_at must match
-- db/migrations/meta/_journal.json "when" and increase with migration index.

UPDATE drizzle.__drizzle_migrations
SET created_at = 1774322729407::bigint
WHERE hash = 'e7e0da21bd642dd224ef85b89f8d4f29b349525901fdcad9cde454792ae26f8d'
AND created_at < 1774322729406::bigint;

INSERT INTO drizzle.__drizzle_migrations ("hash", "created_at")
SELECT 'd15f8da1594d56975cb8c0cac5d8d944f546ffe38fdedaa9d15a75e48826b348', 1774123011028::bigint
WHERE NOT EXISTS (
SELECT 1 FROM drizzle.__drizzle_migrations WHERE hash = 'd15f8da1594d56975cb8c0cac5d8d944f546ffe38fdedaa9d15a75e48826b348'
);

INSERT INTO drizzle.__drizzle_migrations ("hash", "created_at")
SELECT 'c2fbf77da07e7b8d5d0f53b8b2687a14f5d6d61fd300118f8eceb416d4d55973', 1774322729406::bigint
WHERE NOT EXISTS (
SELECT 1 FROM drizzle.__drizzle_migrations WHERE hash = 'c2fbf77da07e7b8d5d0f53b8b2687a14f5d6d61fd300118f8eceb416d4d55973'
);

INSERT INTO drizzle.__drizzle_migrations ("hash", "created_at")
SELECT 'e7e0da21bd642dd224ef85b89f8d4f29b349525901fdcad9cde454792ae26f8d', 1774322729407::bigint
WHERE NOT EXISTS (
SELECT 1 FROM drizzle.__drizzle_migrations WHERE hash = 'e7e0da21bd642dd224ef85b89f8d4f29b349525901fdcad9cde454792ae26f8d'
);
2 changes: 1 addition & 1 deletion db/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"idx": 2,
"version": "7",
"when": 1742814809483,
"when": 1774322729407,
"tag": "0002_routes_user_slug_namespace",
"breakpoints": true
}
Expand Down
17 changes: 17 additions & 0 deletions tests/db/drizzle-journal.monotonic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';

describe('Drizzle migration journal', () => {
it('keeps "when" monotonic in journal order (required by drizzle-kit migrate)', () => {
const raw = readFileSync(resolve(process.cwd(), 'db/migrations/meta/_journal.json'), 'utf8');
const journal = JSON.parse(raw) as { entries: { when: number }[] };
let prev = 0;
for (const e of journal.entries) {
expect(e.when, 'each entry.when must be > previous (PgDialect.migrate uses max(created_at))').toBeGreaterThan(
prev
);
prev = e.when;
}
});
});
Loading