yii2-openapi icon indicating copy to clipboard operation
yii2-openapi copied to clipboard

`default` in OpenAPI schema does not generate migration with `default()` in MariaDB

Open SOHELAHMED7 opened this issue 3 years ago • 0 comments

OpenAPI schema

properties:
        id:
          type: integer
        list_owner:
          $ref: '#/components/schemas/ListOwner'
        price:
          description: price in EUR
          type: number
          x-db-type: decimal(10,2)
          default: 0

Generated Migration:

public function up()
    {
        $this->createTable('{{%table}}', [
            'id' => $this->primaryKey(),
            'list_owner_id' => $this->integer()->null()->defaultValue(null),
            'price' => 'decimal(10,2) NOT NULL', // <-- default is not set here

SOHELAHMED7 avatar Oct 12 '22 07:10 SOHELAHMED7