Libraries
    Preparing search index...

    Function entitySchemaToTableState

    • Derive a DatabaseTableState from a code-first ObjectSchemaBuilder without connecting to the database.

      The result mirrors what introspectDatabase would return after the schema has been fully applied, so it can be fed directly into diffSchema as the dbState argument. This is the foundation of snapshot-based migration generation.

      Parameters

      • schema: ObjectSchemaBuilder<any, any, any, any, any, any, any>

        An ObjectSchemaBuilder with DDL extensions.

      Returns DatabaseTableState

      A DatabaseTableState representing the schema's ideal DB shape.

      const state = entitySchemaToTableState(UserSchema);
      // state.columns, state.foreignKeys, state.indexes …