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

Laravel 9.x Compatibility #36

Closed

Conversation

laravel-shift
Copy link

This is an automated pull request from Shift to update your package code and dependencies to be compatible with Laravel 9.x.

Before merging, you need to:

  • Checkout the l9-compatibility branch
  • Review all comments for additional changes
  • Thoroughly test your package

If you do find an issue, please report it by commenting on this PR to help improve future automation.

@laravel-shift
Copy link
Author

⚠️ Shift detected GitHub Actions which run jobs using a version matrix. Shift attempted to update your configuration for Laravel 9. However, you should review these changes to ensure the desired combination of versions are built for your package.

@laravel-shift
Copy link
Author

⚗️ Using this package? If you would like to help test these changes or believe them to be compatible, you may update your project to reference this branch.

To do so, temporarily add Shift's fork to the repositories property of your composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/laravel-shift/laravel-upsert.git"
        }
    ]
}

Then update your dependency constraint to reference this branch:

{
    "require": {
        "staudenmeir/laravel-upsert": "dev-l9-compatibility",
    }
}

Finally, run: composer update

@staudenmeir
Copy link
Owner

The package doesn't work with Laravel 9: #26 (comment)

@staudenmeir staudenmeir closed this Feb 2, 2022
@jasonmccreary
Copy link

@staudenmeir, gotcha. Thanks. I'll make a note on Shift's side.

@deevus
Copy link

deevus commented Oct 18, 2022

@staudenmeir Just wanted to make a note here.

It seems that starting with Laravel 9, if you're using MySQL, the in-built upsert method does not really work as it should. It doesn't really say why that is the case other than the following warning (emphasis mine):

All databases except SQL Server require the columns in the second argument of the upsert method to have a "primary" or "unique" index. In addition, the MySQL database driver ignores the second argument of the upsert method and always uses the "primary" and "unique" indexes of the table to detect existing records.

I am wondering that is an opportunity for this package to work with Laravel 9.

Source

@staudenmeir
Copy link
Owner

Hi @deevus,
This is actually not an issue with the Laravel implementation – that's how MySQL's (only) upsert feature works. There's no workaround for that.

@deevus
Copy link

deevus commented Oct 18, 2022

Right. The part that's confusing me then is that our codebase is using upsert with Laravel 8 and MySQL and it works fine. Upgrading to Laravel 9 and now upsert doesn't work.

@staudenmeir
Copy link
Owner

Maybe it's related to this change? laravel/framework#42053

@deevus
Copy link

deevus commented Oct 18, 2022

Don't think so. As far as I can tell that's an opt-in change where you need to set use_upsert_alias to true in the mysql config.

@staudenmeir
Copy link
Owner

In any case: If there's an issue with the Laravel 9 implementation, it needs to be fixed there. The package can't take care of that.

@deevus
Copy link

deevus commented Oct 18, 2022

No worries thanks for your help

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.

4 participants