prorm API Reference
    Preparing search index...

    Interface SyncOptions

    Options for sync(). force drops and recreates; alter tries to migrate an existing table in place.

    interface SyncOptions {
        force?: boolean;
        alter?: boolean;
        match?: RegExp;
        logging?: boolean | ((sql: string, timing?: number) => void);
        hooks?: boolean;
        indexes?: boolean;
        constraints?: boolean;
    }
    Index
    force?: boolean

    If true, drop all tables first before recreating them. WARNING: This will destroy all data in the tables!

    false
    
    alter?: boolean

    If true, alter tables to match model definitions. This will add new columns, remove extra columns, and change column types as needed. Preserves existing data in the table.

    false
    
    match?: RegExp

    Regular expression to match the database name. Sync will only proceed if the database name matches this pattern. Useful for development vs production environments. Example: /test/ - only syncs if database name contains "test"

    logging?: boolean | ((sql: string, timing?: number) => void)

    Custom logging function

    hooks?: boolean

    If true, run sync hooks (beforeSync, afterSync, etc.)

    true
    
    indexes?: boolean

    If true, also sync indexes

    true
    
    constraints?: boolean

    If true, also sync foreign key constraints

    true