Skip to content

Commit

Permalink
Improve help for bake migrations command
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 19, 2022
1 parent a51e7d2 commit d5feb0c
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/Command/BakeMigrationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,29 @@ public function getOptionParser(): ConsoleOptionParser
* The types are the abstract database column types in CakePHP.
* The <warning>?</warning> value indicates if a column is nullable.
e.x. `role:string?`.
* Length option must be enclosed in `[]` e.x. `name:string[100]`
* The `index` attribute can define the column as having a unique
key with `unique` or a primary key with `primary`.
e.x. <warning>role:string?</warning>.
* Length option must be enclosed in <warning>[]</warning> e.x. <warning>name:string[100]</warning>
* The <warning>index</warning> attribute can define the column as having a unique
key with <warning>unique</warning> or a primary key with <warning>primary</warning>.
<info>Examples</info>
<warning>bin/cake bake migration AddOrgIdToProjects org_id:int</warning>
Create a migration that adds a column (<warning>org_id INT</warning>) to the <warning>projects</warning>
table.
<warning>bin/cake bake migration AddOrgIdToProjects org_id:int?</warning>
Create a migration that adds a nullable column (<warning>org_id INT NULL</warning>) to the <warning>projects</warning>
table.
<warning>bin/cake bake migration AddNameToProjects name:string[128]</warning>
Create a migration that adds (<warning>name VARCHAR(128)</warning>) to the <warning>projects</warning>
table.
<warning>bin/cake bake migration AddSlugToProjects name:string[128]:unique</warning>
Create a migration that adds (<warning>name VARCHAR(128)</warning> and a <warning>UNIQUE<.warning index)
to the <warning>projects</warning> table.

TEXT;

$parser->setDescription($text);
Expand Down

0 comments on commit d5feb0c

Please sign in to comment.