Skip to content

Commit 05cd729

Browse files
committed
Improve documentation
1 parent fb7d17c commit 05cd729

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

README.md

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,48 @@ Each rule below applies to migration files, regardless of framework, unless stat
2222
### Rule: `EnforceCollationRule`
2323

2424
| Field | Description |
25-
|---|---|
26-
| Purpose | Enforces that table definitions explicitly define a collation |
27-
| Why | Prevents relying on database defaults, which may differ between environments |
28-
| Framework support | Phinx, Laravel |
29-
| Default behavior | Requires a collation to be specified |
30-
| Configuration | `requiredCollation` (string) |
25+
Purpose | Enforces that table definitions explicitly define a collation.
26+
> Prevents relying on database defaults, which may differ between environments.
3127
3228
#### Configuration
3329

3430
```yaml
3531
parameters:
3632
phpstanMigrationRules:
37-
requiredCollation: utf8mb4
33+
requiredCollation: utf8mb4 # Default is utf8
3834
```
3935
40-
#### Detection details
36+
#### Support
4137
4238
| Framework | How collation is detected |
4339
|---|---|
44-
| Phinx | `table('name', ['collation' => '…'])` |
45-
| Laravel | `$table->collation('…')` or `$table->collation = '…'` inside the Blueprint callback |
40+
| [Phinx](./src/Rules/Phinx/EnforceCollationRule.php) | `table('name', ['collation' => '…'])` | [Phinx/EnforceCollationRule](./src/Rules/Phinx/EnforceCollationRule.php) |
41+
| [Laravel]((./src/Rules/Laravel/EnforceCollationRule.php)) | `$table->collation('…')` or `$table->collation = '…'` inside the Blueprint callback |
4642

4743
---
4844

4945
### Rule: `ForbidAfterRule`
46+
Forbids column positioning via `after`.
47+
> May trigger full table rewrites or long locks, unsafe for large or production tables.
5048

51-
| Field | Description |
52-
|---|---|
53-
| Purpose | Forbids column positioning via `after()` |
54-
| Why | May trigger full table rewrites or long locks, unsafe for large or production tables |
55-
| Framework support | Phinx, Laravel |
56-
| Configuration | None |
57-
58-
#### Detection details
49+
#### Support
5950

6051
| Framework | Forbidden usage |
6152
|---|---|
62-
| Phinx | `addColumn(..., ['after' => 'column'])` |
63-
| Laravel | `$table->string('x')->after('y')` |
53+
| [Phinx](./src/Rules/Phinx/ForbidAfterRule.php) | `addColumn(..., ['after' => 'column'])` |
54+
| [Laravel](./src/Rules/Laravel/ForbidAfterRule.php) | `$table->string('x')->after('y')` |
6455

6556
---
6657

6758
### Rule: `ForbidMultipleTableCreationsRule`
68-
69-
| Field | Description |
70-
|---|---|
71-
| Purpose | Ensures each migration creates at most one table |
72-
| Why | Improves rollback safety and migration clarity |
73-
| Framework support | Phinx, Laravel |
74-
| Configuration | None |
59+
Ensures each migration creates at most one table.
60+
> Improves rollback safety and migration clarity
7561

7662
---
7763

78-
#### Detection details
64+
#### Support
7965

8066
| Framework | What counts as a table creation |
8167
|---|---|
82-
| Phinx | Multiple calls to `create()` on table instances |
83-
| Laravel | Multiple `Schema::create()` calls in the same migration |
68+
| [Phinx](./src/Rules/Phinx/ForbidMultipleTableCreationsRule.php) | Multiple calls to `create()` on table instances |
69+
| [Laravel](./src/Rules/Laravel/ForbidMultipleTableCreationsRule.php) | Multiple `Schema::create()` calls in the same migration |

0 commit comments

Comments
 (0)