Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hpakdaman authored Apr 8, 2017
1 parent 2f54ad4 commit 30c4340
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function up()
{
Schema::create($this->getTable(), function (Blueprint $table) {
$table->engine = "innoDB";
$table->increments('id');
$table->unsignedBigInteger('id', true);
$table->enum('port', [
Enum::MELLAT,
Enum::JAHANPAY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function up()
Schema::create($this->getLogTable(), function (Blueprint $table) {
$table->engine="innoDB";
$table->increments('id');
$table->unsignedInteger('transaction_id');
$table->unsignedBigInteger('transaction_id');
$table->string('result_code', 10)->nullable();
$table->string('result_message', 255)->nullable();
$table->timestamp('log_date')->nullable();
Expand Down
16 changes: 10 additions & 6 deletions migrations/2017_04_05_103357_alter_id_in_transactions_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ function getLogTable()
*/
public function up()
{
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` drop foreign key transactions_logs_transaction_id_foreign;");
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` DROP INDEX transactions_logs_transaction_id_foreign;");
DB::statement("update `" . $this->getTable() . "` set `payment_date`=null WHERE `payment_date`=0;");
DB::statement("ALTER TABLE `" . $this->getTable() . "` CHANGE `id` `id` BIGINT UNSIGNED NOT NULL;");
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` CHANGE `transaction_id` `transaction_id` BIGINT UNSIGNED NOT NULL;");
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` ADD INDEX `transactions_logs_transaction_id_foreign` (`transaction_id`);");
try {
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` drop foreign key transactions_logs_transaction_id_foreign;");
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` DROP INDEX transactions_logs_transaction_id_foreign;");
DB::statement("update `" . $this->getTable() . "` set `payment_date`=null WHERE `payment_date`=0;");
DB::statement("ALTER TABLE `" . $this->getTable() . "` CHANGE `id` `id` BIGINT UNSIGNED NOT NULL;");
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` CHANGE `transaction_id` `transaction_id` BIGINT UNSIGNED NOT NULL;");
DB::statement("ALTER TABLE `" . $this->getLogTable() . "` ADD INDEX `transactions_logs_transaction_id_foreign` (`transaction_id`);");
} catch (Exception $e) {

}
}

/**
Expand Down

0 comments on commit 30c4340

Please sign in to comment.