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.

Migrations are generated with syntax error and wrong data type in MySQL  #107

Closed
SOHELAHMED7/yii2-openapi
#7
@SOHELAHMED7

Description

@SOHELAHMED7

When running $ yii gii/api migrations files are generated with syntax error.

Consider a property/field

test_emails:
          type: array
          x-db-type: JSON
          nullable: false
          default: '[]'

create table are generated fine with no issues.

public function up()
    {
        $this->createTable('{{%table}}', [
            'test_emails' => 'json NOT NULL DEFAULT \'[]\'',

but in case of alter or later modification or adding a property to schema

$this->alterColumn('{{%table}}', 'test_emails', 'longtext NOT NULL DEFAULT '{}''); // quote should be escaped

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions