1 | <?php |
||
9 | class CreateLinksTable extends Migration |
||
10 | { |
||
11 | /** |
||
12 | * Run the migrations. |
||
13 | * |
||
14 | * @return void |
||
15 | */ |
||
16 | public function up() |
||
17 | { |
||
18 | Schema::create(config('shortener.table'), function (Blueprint $table) { |
||
19 | $table->increments('id'); |
||
20 | $table->string('original_url')->unique(); |
||
21 | $table->string('code')->nullable()->unique(); |
||
22 | $table->integer('requested_count')->default(0); |
||
23 | $table->integer('used_count')->default(0); |
||
24 | $table->timestamp('last_requested')->nullable(); |
||
25 | $table->timestamp('last_used')->nullable(); |
||
26 | $table->timestamps(); |
||
27 | }); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Reverse the migrations. |
||
32 | * |
||
33 | * @return void |
||
34 | */ |
||
35 | public function down() |
||
36 | { |
||
37 | Schema::dropIfExists(config('shortener.table')); |
||
38 | } |
||
39 | } |
||
40 |