Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Migration Generator: Default value for integer should not be considered string #11

Closed
@cebe

Description

@cebe

Having the following OpenAPI schema:

  flags:
    type: integer
    default: 0

and a column in the database: flags INT DEFAULT 0

The following migration is generated:

/**
 * Table for User
 */
class m200803_210000_change_table_users extends \yii\db\Migration
{
    public function safeUp()
    {
        $this->alterColumn('{{%users}}', 'flags', "SET DEFAULT 0");
    }

    public function safeDown()
    {
        $this->alterColumn('{{%users}}', 'flags', "SET DEFAULT '0'");
    }
}

Changing yaml to:

  flags:
    type: integer
    default: "0"

making the 0 a string value does not generate a migration.

This happens on Postgres.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions