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 JSON column generates a migration for equal values #13

@cebe

Description

@cebe

Schema in OpenAPI:

  customFields:
    type: array
    x-db-type: json
    default: '[]'
    items:
      type: object

generated migration:

class m200803_210001_change_table_projects extends \yii\db\Migration
{
    public function safeUp()
    {
        $this->alterColumn('{{%projects}}', 'customFields', "SET DEFAULT '[]'");
    }

    public function safeDown()
    {
        $this->alterColumn('{{%projects}}', 'customFields', "SET DEFAULT '[]'");
    }
}

There is no change in up and down.

This happens on PostgreSQL

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