Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgrade note for changed migration behaviour #9989

Draft
wants to merge 1 commit into
base: 11.x
Choose a base branch
from

Conversation

ghostal
Copy link
Contributor

@ghostal ghostal commented Oct 25, 2024

Adds a note describing a fairly typical scenario where existing migrations would fail after upgrade, without an obvious documented cause.

@hafezdivandari
Copy link
Contributor

hafezdivandari commented Oct 26, 2024

Both examples work perfectly fine on Laravel 11 as expected:

public function testAddingAndRenamingColumns()
{
    Schema::create('tests', function (Blueprint $table) {
        $table->integer('votes');
    });

    Schema::table('tests', function (Blueprint $table) {
        $table->string('description')->after('votes'); // alter table `tests` add `description` varchar(255) not null after `votes`
        $table->renameColumn('votes', 'vote_count');   // alter table `tests` rename column `votes` to `vote_count`
    });

    $this->assertSame(['vote_count', 'description'], Schema::getColumnListing('tests'));
}
public function testRenamingAndAddingColumns()
{
    Schema::create('tests', function (Blueprint $table) {
        $table->integer('votes');
    });

    Schema::table('tests', function (Blueprint $table) {
        $table->renameColumn('votes', 'vote_count');         // alter table `tests` rename column `votes` to `vote_count`
        $table->string('description')->after('vote_count');  // alter table `tests` add `description` varchar(255) not null after `vote_count`
    });

    $this->assertSame(['vote_count', 'description'], Schema::getColumnListing('tests'));
}

@taylorotwell taylorotwell marked this pull request as draft October 29, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants