Skip to Content
Migrations

Migrations

Migrations are ESM modules using defineMigration:

import { defineMigration } from "cyphra"; // or: import { defineMigration } from "@cyphra/migrator"; export default defineMigration({ name: "001_init", async up({ db }) { await db.run`RETURN 1`; }, });

Applied migrations are stored as:

(:__CyphraMigration { name, appliedAt, checksum })

Use cyphra migrate deploy after setting NEO4J_* env vars.

cyphra push (and @cyphra/migrator’s constraintStatementsFromSchema / indexStatementsFromSchema) emits node uniqueness constraints and relationship property uniqueness for @unique on relationship { … } fields (Neo4j 5.7+).

For Neo4j 5+, db.runInTransactionBatches({ inner, batchSize, params }) wraps inner in CALL { … } IN TRANSACTIONS OF … ROWS so long-running writes commit in chunks (your inner query should typically batch rows with LIMIT / WITH).

Last updated on