|
|
@ -8,7 +8,10 @@ class ChangeMessagesPrimaryKey extends Migration |
|
|
public function up() |
|
|
public function up() |
|
|
{ |
|
|
{ |
|
|
$this->schema->table('messages', function(Blueprint $table) { |
|
|
$this->schema->table('messages', function(Blueprint $table) { |
|
|
$table->dropForeign(['user_id']); |
|
|
|
|
|
|
|
|
if ($this->schema->getConnection()->getDriverName() !== 'sqlite') { |
|
|
|
|
|
$table->dropForeign(['user_id']); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$table->dropPrimary('messages_pkey'); |
|
|
$table->dropPrimary('messages_pkey'); |
|
|
$table->primary(['user_id', 'jidfrom', 'id']); |
|
|
$table->primary(['user_id', 'jidfrom', 'id']); |
|
|
$table->foreign('user_id') |
|
|
$table->foreign('user_id') |
|
|
@ -20,7 +23,10 @@ class ChangeMessagesPrimaryKey extends Migration |
|
|
public function down() |
|
|
public function down() |
|
|
{ |
|
|
{ |
|
|
$this->schema->table('messages', function(Blueprint $table) { |
|
|
$this->schema->table('messages', function(Blueprint $table) { |
|
|
$table->dropForeign(['user_id']); |
|
|
|
|
|
|
|
|
if ($this->schema->getConnection()->getDriverName() !== 'sqlite') { |
|
|
|
|
|
$table->dropForeign(['user_id']); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$table->dropPrimary('messages_pkey'); |
|
|
$table->dropPrimary('messages_pkey'); |
|
|
$table->primary(['user_id', 'id']); |
|
|
$table->primary(['user_id', 'id']); |
|
|
$table->foreign('user_id') |
|
|
$table->foreign('user_id') |
|
|
|