applySchema
applySchema(
db
,modelClasses
,method
):Promise
<void
>
Defined in: schemaGenerator.ts:202
Applies the generated SurrealQL schema to the database by executing DDL statements.
Parameters
Section titled “Parameters”Surreal
The SurrealDB client instance
modelClasses
Section titled “modelClasses”Array of model classes (output of Table.normal)
method
Section titled “method”SchemaApplicationMethod
= "IF NOT EXISTS"
How to apply the schema (e.g., ‘IF NOT EXISTS’)
Returns
Section titled “Returns”Promise
<void
>
Promise
Example
Section titled “Example”import { applySchema, Table, Field } from 'unreal-orm'; const User = Table.normal({ ... }); const Post = Table.normal({ ... }); await applySchema(db, [User, Post]);