URL Shortener 1.0
A Laravel-based URL shortener application
Chargement...
Recherche...
Aucune correspondance
2026_01_30_100328_create_short_urls_table.php
Aller à la documentation de ce fichier.
1<?php
2
3use Illuminate\Database\Migrations\Migration;
4use Illuminate\Database\Schema\Blueprint;
5use Illuminate\Support\Facades\Schema;
6
7return new class extends Migration
8{
14 public function up(): void
15 {
16 Schema::create('short_urls', function (Blueprint $table) {
17 $table->id();
18 $table->foreignId('user_id')->constrained()->onDelete('cascade');
19 $table->string('code', 16)->unique();
20 $table->text('original_url');
21 $table->timestamps();
22 });
23 }
24
30 public function down(): void
31 {
32 Schema::dropIfExists('short_urls');
33 }
34};