prorm API Reference
    Preparing search index...

    Base class for all data types

    Hierarchy (View Summary)

    Index
    • Create an ENUM data type

      Parameters

      • ...values: (string | string[])[]

        Either an array of values or individual string values

      Returns ENUM

      // Array of values
      DataTypes.ENUM(['active', 'inactive', 'pending'])
      // Individual values
      DataTypes.ENUM('active', 'inactive', 'pending')
    key: "ENUM" = ...
    values: string[]
    name?: string

    Optional name for the enum type (useful for PostgreSQL/MySQL)

    • Serialize a value for storage based on this DataType

      Parameters

      • value: unknown

        The value to serialize

      Returns unknown

      The serialized value

    • Set a name for the enum type (useful for PostgreSQL/MySQL)

      Parameters

      • name: string

      Returns this

    • Validate if a value is valid for this ENUM

      Parameters

      • value: string

      Returns boolean

    • Generate an ALTER TABLE statement to add/modify ENUM column Note: MySQL uses MODIFY COLUMN, PostgreSQL needs type recreation

      Parameters

      • dialect: string
      • tableName: string
      • columnName: string
      • Optional_columnDefinition: string

      Returns string