Skip to content

Instantly share code, notes, and snippets.

@ahmadrio
Created October 10, 2019 15:08
Show Gist options
  • Save ahmadrio/5cc6bad63c573c27294d82e0fbcc59d8 to your computer and use it in GitHub Desktop.
Save ahmadrio/5cc6bad63c573c27294d82e0fbcc59d8 to your computer and use it in GitHub Desktop.
<?php
use App\Helpers\Traits\SQLServerServices;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeColumnInUsersTable extends Migration
{
use SQLServerServices;
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if ($this->dropConstraints('sqlsrv', 'users', ['tanggal_daftar'])) {
DB::statement("ALTER TABLE users ALTER COLUMN tanggal_daftar nvarchar(191)");
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if ($this->dropConstraints('sqlsrv', 'users', ['tanggal_daftar'])) {
DB::statement("ALTER TABLE users ALTER COLUMN tanggal_daftar datetime");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment