blob: 3169ec4ca3293b00df8001db3347ec7e1befb04e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Migrate1xTo2xLinks extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Rename users table from "auth" to "users"
Schema::rename('redirinfo', 'links');
Schema::table('links', function (Blueprint $table) {
// Rename needed columns
$table->renameColumn('rurl', 'long_url');
$table->renameColumn('baseval', 'short_url');
$table->renameColumn('iscustom', 'is_custom');
$table->renameColumn('user', 'creator');
$table->renameColumn('rurl', 'long_url');
$table->renameColumn('rid', 'id');
$table->renameColumn('date', 'CREATED_AT');
$table->renameColumn('lkey', 'secret_key');
// Drop unused columns
$table->dropColumn('pw');
$table->dropColumn('etc');
$table->dropColumn('etc2');
$table->dropColumn('country');
// Create new columns
$table->boolean('is_disabled')->default(0);
$table->boolean('is_api')->default(0);
// Modify needed columns
$table->string('clicks')->default(0)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('links', function (Blueprint $table) {
//
});
}
}
|