forked from cebe/yii2-openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from SOHELAHMED7/121-implement-default-by-lite…
…ral-expression-using-new-field-x-db-default-expression Draft: Implement default by literal expression using new field 'x-db-default-expression'
- Loading branch information
Showing
36 changed files
with
861 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ services: | |
- maria | ||
tty: true | ||
mysql: | ||
image: mysql:5.7 | ||
image: mysql:8 | ||
ports: | ||
- '13306:3306' | ||
volumes: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/specs/issue_fix/create_table_in_down_code/create_table_in_down_code.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
return [ | ||
'openApiPath' => '@specs/issue_fix/create_table_in_down_code/create_table_in_down_code.yaml', | ||
'generateUrls' => false, | ||
'generateModels' => false, | ||
'excludeModels' => [ | ||
'Error', | ||
], | ||
'generateControllers' => false, | ||
'generateMigrations' => true, | ||
'generateModelFaker' => false, | ||
]; |
24 changes: 24 additions & 0 deletions
24
tests/specs/issue_fix/create_table_in_down_code/create_table_in_down_code.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Create table in down code | ||
paths: | ||
/: | ||
get: | ||
summary: List | ||
operationId: list | ||
responses: | ||
'200': | ||
description: The information | ||
|
||
components: | ||
schemas: | ||
Fruit: | ||
type: object | ||
description: Create table in down code | ||
properties: | ||
id: | ||
type: integer | ||
colourName: | ||
type: string | ||
maxLength: 255 |
35 changes: 35 additions & 0 deletions
35
...ault_expression/maria/edit/app/migrations_maria_db/m200000_000000_change_table_fruits.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/** | ||
* Table for Fruit | ||
*/ | ||
class m200000_000000_change_table_fruits extends \yii\db\Migration | ||
{ | ||
public function up() | ||
{ | ||
$this->alterColumn('{{%fruits}}', 'ts', $this->datetime()->null()->defaultExpression("(CURRENT_TIMESTAMP)")); | ||
$this->alterColumn('{{%fruits}}', 'ts2', $this->datetime()->null()->defaultValue("2011-11-11 00:00:00")); | ||
$this->alterColumn('{{%fruits}}', 'ts3', $this->datetime()->null()->defaultValue("2022-11-11 00:00:00")); | ||
$this->alterColumn('{{%fruits}}', 'ts4', $this->timestamp()->null()->defaultValue("2022-11-11 00:00:00")); | ||
$this->alterColumn('{{%fruits}}', 'ts5', $this->timestamp()->null()->defaultExpression("(CURRENT_TIMESTAMP)")); | ||
$this->alterColumn('{{%fruits}}', 'ts6', $this->timestamp()->null()->defaultValue("2000-11-11 00:00:00")); | ||
$this->alterColumn('{{%fruits}}', 'd', $this->date()->null()->defaultExpression("(CURRENT_DATE + INTERVAL 1 YEAR)")); | ||
$this->alterColumn('{{%fruits}}', 'd2', $this->text()->null()->defaultExpression("(CURRENT_DATE + INTERVAL 1 YEAR)")); | ||
$this->alterColumn('{{%fruits}}', 'd3', $this->text()->null()->defaultValue("text default")); | ||
$this->alterColumn('{{%fruits}}', 'ts7', $this->date()->null()->defaultExpression("(CURRENT_DATE + INTERVAL 1 YEAR)")); | ||
} | ||
|
||
public function down() | ||
{ | ||
$this->alterColumn('{{%fruits}}', 'ts7', $this->date()->null()->defaultValue(null)); | ||
$this->alterColumn('{{%fruits}}', 'd3', $this->text()->null()->defaultValue(null)); | ||
$this->alterColumn('{{%fruits}}', 'd2', $this->text()->null()->defaultValue(null)); | ||
$this->alterColumn('{{%fruits}}', 'd', $this->date()->null()->defaultValue(null)); | ||
$this->alterColumn('{{%fruits}}', 'ts6', $this->timestamp()->notNull()->defaultValue("0000-00-00 00:00:00")); | ||
$this->alterColumn('{{%fruits}}', 'ts5', $this->timestamp()->notNull()->defaultValue("0000-00-00 00:00:00")); | ||
$this->alterColumn('{{%fruits}}', 'ts4', $this->timestamp()->notNull()->defaultExpression("current_timestamp()")); | ||
$this->alterColumn('{{%fruits}}', 'ts3', $this->datetime()->null()->defaultValue(null)); | ||
$this->alterColumn('{{%fruits}}', 'ts2', $this->datetime()->null()->defaultValue(null)); | ||
$this->alterColumn('{{%fruits}}', 'ts', $this->datetime()->null()->defaultValue(null)); | ||
} | ||
} |
Oops, something went wrong.