the browser-facing portion of osu!
1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6use Illuminate\Database\Migrations\Migration;
7use Illuminate\Database\Schema\Blueprint;
8use Illuminate\Support\Facades\Schema;
9
10class CreatePaymentsTable extends Migration
11{
12 /**
13 * Run the migrations.
14 *
15 * @return void
16 */
17 public function up()
18 {
19 Schema::connection('mysql-store')->create('payments', function (Blueprint $table) {
20 $table->increments('id'); // Set a PK so that InnoDB won't use order_id as a clustered index.
21 $table->unsignedInteger('order_id');
22 $table->boolean('cancelled')->default(false); // TODO: should probably record more detailed status of what happened to the transaction?
23 $table->string('transaction_id', 255);
24 $table->string('provider', 50);
25 $table->dateTime('paid_at');
26
27 $table->timestamps();
28
29 $table->unique(['order_id', 'cancelled']);
30 });
31 }
32
33 /**
34 * Reverse the migrations.
35 *
36 * @return void
37 */
38 public function down()
39 {
40 Schema::connection('mysql-store')->drop('payments');
41 }
42}