eloquent-versioning
eloquent-versioning copied to clipboard
Multiple primary key
Syntax error or access violation: 1068 Multiple prima ry key defined (SQL: alter table mytable_version add primary key mytable_version_version_primary(version ))
with code:
Schema::create('mytable_version', function(Blueprint $table) {
$table->integer('ref_id')->primary();
$table->integer('version')->primary();
//add versionable columns
$table->timestamps();
$table->softDeletes();
});
Hello @AceWT,
This should fix your issue:
Schema::create('mytable_version', function(Blueprint $table) {
$table->integer('ref_id');
$table->integer('version');
//add versionable columns
$table->timestamps();
$table->softDeletes();
$table->primary(['ref_id', 'version']);
});
The README is updated accordingly in #20...