laravel-shift / blueprint

A code generation tool for Laravel developers.
MIT License
2.82k stars 270 forks source link

Add Support for ULID column type #657

Closed rcrosbourne closed 9 months ago

rcrosbourne commented 9 months ago

List of changes:

  1. Refactor foreign key generation in migrations
  2. Refactored the foreign key generation code in migration files into a method.
  3. Supports generation of primary keys with 'ulid' and 'uuid' data types for pivot tables.
  4. Added support for ULID and UUID in pivot tables migration
  5. Expanded the migration generation function to support ULID and UUID primary keys.
  6. Add ULID support in Model and ModelGenerator classes
  7. Function to check if ULIDs are used in the Model class.
  8. Expand 'ModelGenerator' class to act accordingly if ULIDs are used.
  9. Add support for nullableUlidMorphs and ulidMorphs column types
  10. The column types have been added to the all-column-types test fixtures and model generator.
  11. Update Foreign Key Constraints and Migration Generator
  12. Foreign key constraints updated in model test fixtures and new foreign keys customer_id and tran_id added.
    1. ulidMorphs added to the test fixtures in all-column-types for drafts, models, and factories.
  13. Add test for ULID without relationship scenario
  14. A new test for the case of a ULID without a relationship was added in MigrationGeneratorTest.php file.
  15. Add ULID support to FactoryGenerator and tests
  16. Add support for ULID shorthand in migrations
  17. Add ulid type to ModelLexer.php.
  18. Update regular expression in Blueprint.php to match ulid and uuid.
jasonmccreary commented 9 months ago

Sorry, this commit is way too large with too many commits and changes for me to consider. If you want a new feature added, I recommend separating your PR into multiple. First making the feature, then additional for refactors.

rcrosbourne commented 9 months ago

Thanks for your feedback. This feature involved addingulid support for models, migrations and factories. So there would be a lot of files changes. I can take a phased approach by adding support for migrations only and slowly add the rest.

jasonmccreary commented 9 months ago

Please resolve any open conversation and I'll give this a final review.

jasonmccreary commented 9 months ago

Looks like there's still a bit of lint. Run composer update locally and then vendor/bin/pint. It's probably a new rule in Pint that's not being applied.

rcrosbourne commented 9 months ago

Looks like there's still a bit of lint. Run composer update locally and then vendor/bin/pint. It's probably a new rule in Pint that's not being applied.

Yes that worked. Thanks.