1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/database/migrations/2015_03_03_140259_add_tokens.php

50 lines
1.3 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
<?php
use Illuminate\Database\Migrations\Migration;
2017-01-30 17:05:31 +01:00
class AddTokens extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('account_tokens', function ($table) {
2015-03-16 22:45:25 +01:00
$table->increments('id');
$table->unsignedInteger('account_id')->index();
$table->unsignedInteger('user_id');
$table->timestamps();
$table->softDeletes();
$table->string('name')->nullable();
$table->string('token')->unique();
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->unsignedInteger('public_id')->nullable();
$table->unique(['account_id', 'public_id']);
});
2017-01-30 17:05:31 +01:00
Schema::table('activities', function ($table) {
2015-03-16 22:45:25 +01:00
$table->unsignedInteger('token_id')->nullable();
});
2017-01-30 17:05:31 +01:00
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
2015-03-16 22:45:25 +01:00
Schema::drop('account_tokens');
2017-01-30 17:05:31 +01:00
Schema::table('activities', function ($table) {
2015-03-16 22:45:25 +01:00
$table->dropColumn('token_id');
});
2017-01-30 17:05:31 +01:00
}
2015-03-16 22:45:25 +01:00
}