Skip to content

CURRENT_TIMESTAMP not quoted even for non-datetime columns #1891

@MasterOdin

Description

@MasterOdin

The following code will throw an error:

        $this->table('test')
            ->addColumn('test_col', 'string', ['default' => 'CURRENT_TIMESTAMP'])
            ->create();

This is because the default value will not be quoted. We can probably update the if check for CURRENT_TIMESTAMP either apply if the column type is a datetime/timestamp, or not if the column is a string. I would probably lean towards doing the former, and then for custom types, the user will just be expected to use a Literal, as the latter does not really leave a good way for a user to handle custom types satisfactorily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions