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

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'versionable_id' cannot be null (SQL: insert into versionings (version, versionable_id, versionable_type, updated_at, created_at) values (1, , App\\Models\\ModelName, 2020-01-22 05:37:34, 2020-01-22 05:37:34)) #14

Closed
muhammedkamel opened this issue Jan 22, 2020 · 1 comment

Comments

@muhammedkamel
Copy link

muhammedkamel commented Jan 22, 2020

I am trying to use this package to apply optimistic locking but I face this problem when I trying to retrieve a model that uses Versionable trait.

ModelName::where('id', $value)->select('version_id', 'name')->first();

Note: this model has another column called "version_id" other than the "version" column

Trace:

{
    "file": "$PROJECT_NAME/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php",
    "line": 252,
    "function": "save",
    "class": "Illuminate\\Database\\Eloquent\\Model",
    "type": "->"
},
{
    "file": "$PROJECT_NAME/vendor/laravel-enso/versioning/src/app/Traits/Versionable.php",
    "line": 94,
    "function": "save",
    "class": "Illuminate\\Database\\Eloquent\\Relations\\HasOneOrMany",
    "type": "->"
},
{
    "file": "$PROJECT_NAME/vendor/laravel-enso/versioning/src/app/Traits/Versionable.php",
    "line": 22,
    "function": "startVersioning",
    "class": "App\\Models\\Listings",
    "type": "->"
}
@aocneanu
Copy link
Member

Why didn't you use the issue template?

Please recreate the issue an don't forget to fill the package version so we can investigate

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

2 participants