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

[10.x] Truncate sqlite table name with prefix #50251

Merged
merged 1 commit into from Feb 26, 2024

Conversation

kitloong
Copy link
Contributor

When truncating an SQLite table, it should reset the auto-increment value.

This PR fixes the failure to delete from sqlite_sequence when a table name is prefixed.

Step to reproduce

Config::set('database.connections.sqlite.prefix', 'prefix_');

DB::table('users')->insert(
    [
        'name' => 'John Doe',
    ]
);

DB::table('users')->truncate();

DB::table('users')->insert(
    [
        'name' => 'John Doe',
    ]
);

$user = DB::table('users')->first();

Expected behaviour

$user->id === 1

Actual behaviour

$user->id === 2

@taylorotwell taylorotwell merged commit fa1be10 into laravel:10.x Feb 26, 2024
26 checks passed
@kitloong kitloong deleted the feature/fix branch February 26, 2024 16:51
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.

None yet

2 participants