generateMigrationSurql
generateMigrationSurql(
changes,schema?):string
Defined in: schema/ast/generator.ts:287
Generates only the DEFINE/REMOVE statements needed for specific changes. This is used for generating migrations from schema diffs.
Parameters
Section titled “Parameters”changes
Section titled “changes”Array of schema changes from compareSchemas
schema?
Section titled “schema?”Optional source schema for full table definitions
Returns
Section titled “Returns”string
SurrealQL migration statements
Example
Section titled “Example”const changes = compareSchemas(codeSchema, dbSchema, true);const migration = generateMigrationSurql(changes, codeSchema);await db.query(migration);