Skip to content

1366 Incorrect integer value: 'did_providers' for column 'auditable_id' #1020

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

Open
erimeilis opened this issue May 6, 2025 · 5 comments
Open

Comments

@erimeilis
Copy link

PHP Version

8.4

Laravel Version

12.10.2

Package Version

14.0.0

Description

Have string id, added everything needed to the model, but get error on save

Steps To Reproduce

public $incrementing = false;
protected $primaryKey = 'id';
protected $keyType = 'string';

protected function casts(): array
{
return [
'id' => 'string',
'auditable_id' => 'string'
];
}

Possible Solutions

No response

@erikn69
Copy link
Contributor

erikn69 commented May 6, 2025

Did you change the field on migration??

$table->morphs('auditable');

Read #992

you should have something like

$table->string('auditable_type');
$table->string('auditable_id');

@erimeilis
Copy link
Author

Did you change the field on migration??

laravel-auditing/database/migrations/audits.stub

Line 25 in f92602d

$table->morphs('auditable');

Read #992
you should have something like

$table->string('auditable_type');
$table->string('auditable_id');

Nope. But i'm already using it for other models, they have int id's

@erikn69
Copy link
Contributor

erikn69 commented May 6, 2025

Nope. But i'm already using it for other models, they have int id's

Check that, it shouldn't work for some models and not for others.

@erimeilis
Copy link
Author

Nope. But i'm already using it for other models, they have int id's

Check that, it shouldn't work for some models and not for others.

Well, have to make an experiment. Cos i can't lose what's already audited and can't let other models stop working

@parallels999
Copy link
Contributor

Maybe

protected $casts = [
'old_values' => 'json',
'new_values' => 'json',
// Note: Please do not add 'auditable_id' in here, as it will break non-integer PK models
];

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

No branches or pull requests

3 participants