Skip to content

Commit 44eb50a

Browse files
committed
add migrations
1 parent 961c6af commit 44eb50a

File tree

35 files changed

+1114
-2
lines changed

35 files changed

+1114
-2
lines changed

database/migrations/2014_10_12_000000_create_users_table.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ public function up(): void
1515
$table->id();
1616
$table->string('name');
1717
$table->string('email')->unique();
18-
$table->timestamp('email_verified_at')->nullable();
1918
$table->string('password');
20-
$table->rememberToken();
2119
$table->timestamps();
2220
});
2321
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('categories', function (Blueprint $table) {
15+
$table->id();
16+
$table->string("name");
17+
$table->text("description");
18+
$table->timestamps();
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*/
25+
public function down(): void
26+
{
27+
Schema::dropIfExists('categories');
28+
}
29+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('cars', function (Blueprint $table) {
15+
$table->id();
16+
$table->string("make");
17+
$table->string("model");
18+
$table->integer("year");
19+
$table->decimal("price");
20+
$table->unsignedBigInteger("category_id");
21+
$table->timestamps();
22+
23+
$table->foreign("category_id")->references("id")->on("categories")->cascadeOnDelete()->cascadeOnUpdate();
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*/
30+
public function down(): void
31+
{
32+
Schema::dropIfExists('cars');
33+
}
34+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('bookings', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("user_id");
17+
$table->unsignedBigInteger("car_id");
18+
$table->date("pickup_date");
19+
$table->date("return_date");
20+
$table->enum("status", ["pending", "confirmed", "canceled"]);
21+
$table->timestamps();
22+
23+
$table->foreign("user_id")->references("id")->on("users")->cascadeOnDelete()->cascadeOnUpdate();
24+
$table->foreign("car_id")->references("id")->on("cars")->cascadeOnDelete()->cascadeOnUpdate();
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*/
31+
public function down(): void
32+
{
33+
Schema::dropIfExists('bookings');
34+
}
35+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('reviews', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("user_id");
17+
$table->unsignedBigInteger("car_id");
18+
$table->integer("rating")->default(100);
19+
$table->text("review_text");
20+
$table->timestamps();
21+
22+
$table->foreign("user_id")->references("id")->on("users")->cascadeOnDelete()->cascadeOnUpdate();
23+
$table->foreign("car_id")->references("id")->on("cars")->cascadeOnDelete()->cascadeOnUpdate();
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*/
30+
public function down(): void
31+
{
32+
Schema::dropIfExists('reviews');
33+
}
34+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('images', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("car_id");
17+
$table->string("url");
18+
$table->timestamps();
19+
20+
$table->foreign("car_id")->references("id")->on("cars")->cascadeOnDelete()->cascadeOnUpdate();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('images');
30+
}
31+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('payments', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("booking_id");
17+
$table->decimal("amount");
18+
$table->date("payment_date");
19+
$table->timestamps();
20+
21+
$table->foreign("booking_id")->references("id")->on("bookings")->cascadeOnDelete()->cascadeOnUpdate();
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*/
28+
public function down(): void
29+
{
30+
Schema::dropIfExists('payments');
31+
}
32+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('promotions', function (Blueprint $table) {
15+
$table->id();
16+
$table->string("code");
17+
$table->integer("discount_percentage");
18+
$table->date("expiry_date");
19+
$table->timestamps();
20+
});
21+
}
22+
23+
/**
24+
* Reverse the migrations.
25+
*/
26+
public function down(): void
27+
{
28+
Schema::dropIfExists('promotions');
29+
}
30+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('addresses', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("user_id");
17+
$table->string("street");
18+
$table->string("city");
19+
$table->string("state");
20+
$table->string("country");
21+
$table->string("postal_code");
22+
$table->timestamps();
23+
24+
$table->foreign("user_id")->references("id")->on("users")->cascadeOnDelete()->cascadeOnUpdate();
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*/
31+
public function down(): void
32+
{
33+
Schema::dropIfExists('addresses');
34+
}
35+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('histories', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("user_id");
17+
$table->unsignedBigInteger("car_id");
18+
$table->date("pickup_date");
19+
$table->date("return_date");
20+
$table->timestamps();
21+
22+
$table->foreign("user_id")->references("id")->on("users")->cascadeOnDelete()->cascadeOnUpdate();
23+
$table->foreign("car_id")->references("id")->on("cars")->cascadeOnDelete()->cascadeOnUpdate();
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*/
30+
public function down(): void
31+
{
32+
Schema::dropIfExists('histories');
33+
}
34+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('features', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("car_id");
17+
$table->string("feature");
18+
$table->timestamps();
19+
20+
$table->foreign("car_id")->references("id")->on("cars")->cascadeOnDelete()->cascadeOnUpdate();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('features');
30+
}
31+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('notifications', function (Blueprint $table) {
15+
$table->id();
16+
$table->unsignedBigInteger("user_id");
17+
$table->text("message");
18+
$table->boolean("isRead")->default(false);
19+
$table->timestamps();
20+
21+
$table->foreign("user_id")->references("id")->on("users")->cascadeOnDelete()->cascadeOnUpdate();
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*/
28+
public function down(): void
29+
{
30+
Schema::dropIfExists('notifications');
31+
}
32+
};

0 commit comments

Comments
 (0)