forked from cebe/yii2-openapi
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #72 from php-openapi/63-just-column-name-rename
Resolve: Just column name rename #63
- Loading branch information
Showing
13 changed files
with
208 additions
and
26 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
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/63_just_column_name_rename/index.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/63_just_column_name_rename/index.yml', | ||
'generateUrls' => false, | ||
'generateModels' => false, | ||
'excludeModels' => [ | ||
'Error', | ||
], | ||
'generateControllers' => false, | ||
'generateMigrations' => true, | ||
'generateModelFaker' => false, // `generateModels` must be `true` in order to use `generateModelFaker` as `true` | ||
]; |
25 changes: 25 additions & 0 deletions
25
tests/specs/issue_fix/63_just_column_name_rename/index.yml
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,25 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: '63_just_column_name_rename' | ||
version: 1.0.0 | ||
|
||
components: | ||
schemas: | ||
Fruit: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name_2: | ||
type: string | ||
description_2: | ||
type: string | ||
colour: | ||
type: string | ||
|
||
paths: | ||
'/': | ||
get: | ||
responses: | ||
'200': | ||
description: OK |
19 changes: 19 additions & 0 deletions
19
..._just_column_name_rename/mysql/migrations_mysql_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,19 @@ | ||
<?php | ||
|
||
/** | ||
* Table for Fruit | ||
*/ | ||
class m200000_000000_change_table_fruits extends \yii\db\Migration | ||
{ | ||
public function up() | ||
{ | ||
$this->renameColumn('{{%fruits}}', 'name', 'name_2'); | ||
$this->renameColumn('{{%fruits}}', 'description', 'description_2'); | ||
} | ||
|
||
public function down() | ||
{ | ||
$this->renameColumn('{{%fruits}}', 'description_2', 'description'); | ||
$this->renameColumn('{{%fruits}}', 'name_2', 'name'); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
..._just_column_name_rename/pgsql/migrations_pgsql_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,19 @@ | ||
<?php | ||
|
||
/** | ||
* Table for Fruit | ||
*/ | ||
class m200000_000000_change_table_fruits extends \yii\db\Migration | ||
{ | ||
public function safeUp() | ||
{ | ||
$this->renameColumn('{{%fruits}}', 'name', 'name_2'); | ||
$this->renameColumn('{{%fruits}}', 'description', 'description_2'); | ||
} | ||
|
||
public function safeDown() | ||
{ | ||
$this->renameColumn('{{%fruits}}', 'description_2', 'description'); | ||
$this->renameColumn('{{%fruits}}', 'name_2', 'name'); | ||
} | ||
} |
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