Database: add primary key to device_graphs (#11331)

* Database: add primary key to device_graphs

Percona Xtradb refused to INSERT IGNORE into a table
without a primary key.

* Update 2020_03_24_0844_add_primary_key_to_device_graphs.php

* Update db_schema.yaml

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Richard Kojedzinszky
2020-03-24 18:07:10 +01:00
committed by GitHub
parent a70313f3ee
commit 676a120510
2 changed files with 41 additions and 0 deletions
@@ -0,0 +1,39 @@
<?php
/*
This migration adds primary key for device_graphs
Percona Xtradb refused to INSERT IGNORE into a table
without a primary key.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddPrimaryKeyToDeviceGraphs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('device_graphs', function (Blueprint $table) {
$table->bigIncrements('id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('device_graphs', function (Blueprint $table) {
$table->dropColumn('id');
});
}
}
+2
View File
@@ -545,7 +545,9 @@ device_graphs:
Columns:
- { Field: device_id, Type: 'int(10) unsigned', 'Null': false, Extra: '' }
- { Field: graph, Type: varchar(255), 'Null': true, Extra: '' }
- { Field: id, Type: 'bigint(20) unsigned', 'Null': false, Extra: auto_increment }
Indexes:
PRIMARY: { Name: PRIMARY, Columns: [id], Unique: true, Type: BTREE }
device_id: { Name: device_id, Columns: [device_id], Unique: false, Type: BTREE }
device_groups:
Columns: