Skip to content

[PGsql] Column default function value #113

Open
@yassinrais

Description

@yassinrais

It will be cool if we can add a default function value for the column

new Column(
      'id',
      [
          'type' => Column::TYPE_CHAR,
          'default' => "uuid_generate_v4()",
          'notNull' => true,
          'size' => 36,
          'first' => true
      ]
  ),

image

INSERT INTO dma.city (  country_id, name, lat, lng, population, status, title) 
            VALUES ( 'FR','france',1.0, 1.0, 100000000, 1 , 'France' );

image


Beautiful solution

  • SQL :
ALTER TABLE dma.city ALTER COLUMN id SET DEFAULT uuid_generate_v4()
  • PHP (expected) :
new Column(
      'id',
      [
          'type' => Column::TYPE_CHAR,
          'notNull' => true,
          'size' => 36,
          'first' => true,
          'function'=>  "uuid_generate_v4()"
      ]
  ),

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions