ORM
  • Introduction
  • Basics of Usage
    • Connecting to the Database
    • Creating a Model
    • Simple Queries
  • Configuration
  • Core Features
    • Models
    • CRUD Operations (Create, Read, Update, Delete): examples
    • Relationships
    • Transactions
  • Advanced Usage
    • Data Definition Language
    • Indexes
    • Triggers
    • Caching
  • Examples and templates
  • Security
    • Query parameterization and protection against SQL injections
    • Logging
    • Monitoring
    • Sanitization
  • ORM-CLI
    • Installing
    • Commands and usage
  • System architecture and implementation
    • Support of various databases
      • Implementation using a pattern strategy
      • Implementation using generics
      • Implementation using metaprogramming
    • Decorators
    • Migrations
      • Assignment of id in Tables and Columns
      • Assigning IDs to indexes and triggers
      • Working with migrations in ORM-CLI
        • Implementation of a pattern command for migration
    • QueryBuilder
    • Caching
    • File structure
  • API
    • Decorators
      • Column
      • ComputedColumn
      • Index
      • ForeignKey
      • PrimaryGeneratedColumn
      • Relations
      • Table
      • Trigger
      • Types decorators
        • Integer
        • Numeric
        • Float
        • Boolean
        • String
    • DDL
    • QueryBuilder
    • Additional API
Powered by GitBook
On this page
  1. API
  2. Decorators

PrimaryGeneratedColumn

PrimaryGeneratedColumn Decorator

The PrimaryGeneratedColumn decorator is used to create a primary key with automatic value incrementing. It takes a PrimaryGeneratedColumnDecoratorInterface object as a parameter.

Parameters of PrimaryGeneratedColumnDecoratorInterface

  • type:

    • Type: AutoIncrementColumnTypesPostgresType | AutoIncrementColumnTypesMysqlType

    • Description: The type of automatic increment value, depending on the database type.

  • startWith:

    • Type: number

    • Description: The starting value for auto-increment.

  • incrementBy:

    • Type: number

    • Description: The value by which the field increments for each new record.

  • minValue:

    • Type: number

    • Description: The minimum value for the field.

  • maxValue:

    • Type: number

    • Description: The maximum value for the field.

  • isCycle:

    • Type: boolean

    • Description: Indicates whether the value will restart after reaching the maximum value.

  • cache:

    • Type: number

    • Description: Defines the number of values cached for faster auto-incrementing.

  • ownedBy:

    • Type: string

    • Description: Specifies which column owns the auto-increment.

  • restartWith:

    • Type: number

    • Description: The value at which auto-increment will restart (PostgreSQL only).

  • noOrder:

    • Type: boolean

    • Description: Disables ordering of auto-increment values (PostgreSQL only).

PreviousForeignKeyNextRelations

Last updated 9 months ago