@@ -30,6 +30,10 @@ seamless integration into both legacy and modern Laravel projects (Laravel 5–1
30
30
- 🧱 Extensible design via modular definition/mapping architecture
31
31
- 🧩 Supports Laravel 5 to 12 (EOL versions maintained in read‑only mode)
32
32
- 🛠 Clean, testable and maintainable codebase
33
+ - 🧠 Optional schema normalization (via ` --normalizer= ` ), including:
34
+ - Synthetic primary keys for legacy tables with composite keys
35
+ - Automatic preservation of uniqueness constraints
36
+ - Better Eloquent compatibility for complex schemas
33
37
34
38
## 🔍 Feature Comparison
35
39
@@ -155,6 +159,33 @@ Laravel and can be reused, extended, or mapped differently.
155
159
These classes transform the internal representation into ** valid Laravel migration code** (PHP). You can override them
156
160
to adjust formatting, naming conventions, or structure.
157
161
162
+ ## 🧰 Schema Normalizers
163
+
164
+ Schema Normalizers are optional pre-processing steps that transform your database schema before migration generation.
165
+ They can help adapt legacy structures for better Laravel compatibility.
166
+
167
+ ### Available Normalizers
168
+
169
+ | Normalizer | Description |
170
+ | ------------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
171
+ | ` pivot ` | Replaces composite primary keys with a synthetic auto-incrementing ` id() ` column and converts the original composite key into a named ` unique() ` constraint. Useful for legacy tables incompatible with Eloquent. |
172
+
173
+ ### Usage
174
+
175
+ Enable a normalizer via CLI:
176
+
177
+ ``` bash
178
+ php artisan migrate:regenerate --normalizer=synthetic_pk
179
+ ```
180
+
181
+ Or configure it in ` config/migration-generator.php ` :
182
+
183
+ ``` php
184
+ 'normalizer' => [
185
+ 'enabled' => ['pivot'],
186
+ ],
187
+ ```
188
+
158
189
## 🧪 Testing
159
190
160
191
To run the tests:
0 commit comments