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 support for insertOrIgnore() #1815

Open
darksworm opened this issue Aug 24, 2019 · 2 comments
Open

Add support for insertOrIgnore() #1815

darksworm opened this issue Aug 24, 2019 · 2 comments
Labels

Comments

@darksworm
Copy link

The recently released laravel version 5.8.33 has a new feature - insertOrIgnore.

I think that this is a very useful feature and would love to see it implemented in this project.

v5.8.33 release notes

@Smolevich
Copy link
Contributor

@darksworm, join into slack channel. Link here

@divine divine added the feature label Feb 18, 2020
@MightyPork
Copy link

Still an issue and Laravel now uses this method internally, so there is a crash with MongoDB

RuntimeException: This database engine does not support inserting while ignoring errors.
    at Illuminate\Database\Query\Grammars\Grammar->compileInsertOrIgnore(Grammar.php:1197)
    at Illuminate\Database\Query\Builder->insertOrIgnore(Builder.php:3778)
    at Illuminate\Cache\DatabaseStore->add(DatabaseStore.php:209)
    at Illuminate\Cache\Repository->add(Repository.php:343)
    at Illuminate\Cache\RateLimiter->increment(RateLimiter.php:163)
    at Illuminate\Cache\RateLimiter->hit(RateLimiter.php:148)
    at FlowBox\Http\Controllers\Auth\LoginController->incrementLoginAttempts(ThrottlesLogins.php:35)
    at FlowBox\Http\Controllers\Auth\LoginController->login(AuthenticatesUsers.php:57)
    at Illuminate\Routing\Controller->callAction(Controller.php:54)
    at FlowBox\Http\Controllers\Controller->callAction(Controller.php:157)
    at Illuminate\Routing\ControllerDispatcher->dispatch(ControllerDispatcher.php:43)
    ... 63 more

MongoDB Grammar just extends the framework Grammar without any changes, so this method remains unimplemented

    /**
     * Compile an insert ignore statement into SQL.
     *
     * @param  \Illuminate\Database\Query\Builder  $query
     * @param  array  $values
     * @return string
     *
     * @throws \RuntimeException
     */
    public function compileInsertOrIgnore(Builder $query, array $values)
    {
        throw new RuntimeException('This database engine does not support inserting while ignoring errors.');
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants