8000 Update Option is not allowed and Docs suggestion · Issue #264 · lulco/phoenix · GitHub
[go: up one dir, main page]

Skip to content

Update Option is not allowed and Docs suggestion #264

@Declan-Watts

Description

@Declan-Watts

Hi,
I am new to using Phoenix, and have implemented it for some of our systems. We have a field called "updated_at" with a default field of "CURRENT_TIMESTAMP" and an "ON UPDATE" of "CURRENT_TIMESTAMP" aswell. I am getting an error "Setting 'update' is not allowed.".

The code I used was this

$this->table("awards")
      ->addColumn('id', 'integer', ['autoincrement' => true])
      ->addColumn('name', 'longtext', ['null' => true])
      ->addColumn('shortName', 'string', ['null' => true, 'length' => 50])
      ->addColumn('typeExpiry', 'integer', ['default' => 0])
      ->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
      ->addColumn('updated_at', 'timestamp', ['default' => "CURRENT_TIMESTAMP", 'update' => "CURRENT_TIMESTAMP"])
      ->addColumn('hidden_at', 'timestamp', ['null' => true])
      ->create();

I also struggled to find out what the option for this even was. I could not find any documentation around the different options that are available for fields. I did however see that this was following Phinx quite closely and assumed that those docs might work. I think if this is supposed to replace phinx, it either should have the docs of what options are supported, or support all of phinx's options and just have a link to their documentation so people don't get lost/confused to what the syntax is etc.

Appreciate any help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0