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

Fix error when trying to create a page without extras #141

Merged
merged 1 commit into from
Sep 27, 2024
Merged

Conversation

tabacitu
Copy link
Member

WHY

BEFORE - What was wrong? What was happening before this PR?

I installed PageManager and tried to create a simple "terms and conditions" page using this template:

    private function document(): void
    {
        $this->crud->addField([
            'name' => 'content',
            'label' => trans('backpack::pagemanager.content'),
            'type' => 'summernote',
            'placeholder' => trans('backpack::pagemanager.content_placeholder'),
        ]);
    }

But I couldn't do that. As soon as I hit "save" in the create form, I was hit with a big fat DB error saying that the extras column doesn't have a default.

AFTER - What is happening after this PR?

It looks like we have two migrations for this package. The first one creates the table, the second one changes the length of the extras column. But when it does that... it no longer has nullable on it, so that's forgotten.

So I've just added nullable to it - and now it works.

HOW

How did you achieve that, in technical terms?

Added nullable in the second migration file.

Is it a breaking change or non-breaking change?

Non-breaking imho but @pxpm please think about it too.

How can we test the before & after?

Try to do the same thing I explained above, in a new project. You should get an error too.

@pxpm
Copy link
Contributor

pxpm commented Sep 27, 2024

This was due to recent Laravel v11 changes. When you alter a migration, you need to "re-set" the modifiers. https://laravel.com/docs/11.x/migrations#modifying-columns

@pxpm pxpm merged commit 0cdcbab into main Sep 27, 2024
4 checks passed
@pxpm pxpm deleted the tabacitu-fix-error branch September 27, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants