Differential D1102 Diff 3412 src/database/migrations/2020_05_21_080131_create_transactions_table.php
Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2020_05_21_080131_create_transactions_table.php
- This file was added.
<?php | |||||
use Illuminate\Database\Migrations\Migration; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Support\Facades\Schema; | |||||
// phpcs:ignore | |||||
class CreateTransactionsTable extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create( | |||||
'transactions', | |||||
function (Blueprint $table) { | |||||
$table->string('id', 36)->primary(); | |||||
$table->string('user_email')->nullable(); | |||||
$table->string('object_id', 36)->index(); | |||||
$table->string('object_type', 36)->index(); | |||||
$table->string('type', 8); | |||||
$table->integer('amount')->nullable(); | |||||
$table->string('description')->nullable(); | |||||
$table->string('transaction_id', 36)->nullable()->index(); | |||||
$table->timestamps(); | |||||
$table->index(['object_id', 'object_type']); | |||||
machniak: Some indexes will be needed here. ONe on object_id+object_type, second on transaction_id. | |||||
Done Inline ActionsSounds fair enough. vanmeeuwen: Sounds fair enough. | |||||
} | |||||
); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('transactions'); | |||||
} | |||||
} |
Some indexes will be needed here. ONe on object_id+object_type, second on transaction_id.