Skip to content

Conversation

@puzzledpolymath
Copy link
Contributor

@puzzledpolymath puzzledpolymath commented Jun 27, 2025

This pull request adds support for managing column position when altering a table and adding a column. Ticket #63 is what sparked interest for this feature.

🔍 What was changed

  • ColumnInterface now includes methods isFirst and getAfter.
  • ColumnInterface now defines getComment() explicitly rather than using annotations.
  • AbstractColumn implements isFirst and getAfter, as well as setter methods first() and after.
  • AbstractColumn returns sane values by default, leaving it up to driver implementations to store values.
  • MySQLColumn stores values for first() and after methods. Being the only driver supporting this feature.

🤔 Why?

  1. Precise control over column placement helps in maintaining a logical and organized schema.
  2. Certain applications or legacy systems may expect columns in a specific order, and these options facilitate schema adjustments without extensive data migration.

📝 Checklist

  • Closes #63
  • How was this tested:
    • Unit tests added

📃 Documentation

$table->string('identifier')->nullable(false)->first();

$table->string('identifier')->nullable(false)->after('email');

@puzzledpolymath
Copy link
Contributor Author

Feedback welcome. Once this gets finalized and merged, we can look at necessary changes for migration support.

@puzzledpolymath
Copy link
Contributor Author

Adjustments have been made based on feedback, should now be good to merge.

@roxblnfk roxblnfk added the type: feature New feature. label Jul 9, 2025
@roxblnfk roxblnfk added this to the 2.14.x milestone Jul 9, 2025
@roxblnfk roxblnfk merged commit 7ad2df1 into cycle:2.x Jul 9, 2025
27 of 29 checks passed
@puzzledpolymath puzzledpolymath deleted the feature/column-position branch July 10, 2025 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support ADD COLUMN PLACEMENT

2 participants