123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- // Copyright 2019 Hackware SpA <human@hackware.cl>
- // This file is part of "Hackware Web Services Wallet" and licensed under
- // the terms of the GNU Affero General Public License version 3, or (at your
- // option) a later version. You should have received a copy of this license
- // along with the software. If not, see <https://www.gnu.org/licenses/>.
- use Illuminate\Support\Facades\Schema;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
- class CreateTransactionsTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('transactions', function (Blueprint $table) {
- $table->increments('id');
- $table->string('wallet_uid', 100);
- $table->foreign('wallet_uid')
- ->references('uid')
- ->on('wallets')
- ->onUpdate('cascade')
- ->onDelete('restrict');
- $table->unsignedInteger('currency_id');
- $table->foreign('currency_id')
- ->references('id')
- ->on('currencies')
- ->onUpdate('restrict')
- ->onDelete('restrict');
- $table->decimal('amount', 16, 8);
- $table->string('comment', 255)->nullable();
- $table->timestamp('created_at')->nullable()->index();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('transactions');
- }
- }
|