Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit a83e30a

Browse files
committed
Update database schema
1 parent eb75973 commit a83e30a

5 files changed

+204
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
7+
class CreateEventsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('events', function(Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('title')->unique();
19+
$table->string('slug')->unique();
20+
$table->date('date');
21+
$table->time('start_time');
22+
$table->time('end_time');
23+
$table->string('location');
24+
$table->text('description');
25+
$table->string('price', 20)->default('0');
26+
$table->smallInteger('number_of_places');
27+
$table->string('image');
28+
$table->boolean('is_approved')->default(false);
29+
$table->boolean('subscribe')->default(false);
30+
$table->string('link')->nullable();
31+
$table->timestamps();
32+
});
33+
34+
Schema::create('event_user', function (Blueprint $table) {
35+
$table->unsignedInteger('event_id');
36+
$table->unsignedInteger('user_id');
37+
38+
$table->foreign('user_id')
39+
->references('id')->on('users')
40+
->onDelete('cascade');
41+
$table->foreign('event_id')
42+
->references('id')->on('events')
43+
->onDelete('cascade');
44+
});
45+
}
46+
47+
/**
48+
* Reverse the migrations.
49+
*
50+
* @return void
51+
*/
52+
public function down()
53+
{
54+
Schema::drop('event_user');
55+
Schema::drop('events');
56+
}
57+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
7+
class CreateJobsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('jobs', function(Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('company_name');
19+
$table->string('logo')->nullable();
20+
$table->string('title');
21+
$table->text('description');
22+
$table->string('location');
23+
$table->boolean('is_published')->default(false);
24+
$table->boolean('is_visible')->default(false);
25+
$table->integer('user_id')->unsigned();
26+
$table->timestamps();
27+
});
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*
33+
* @return void
34+
*/
35+
public function down()
36+
{
37+
Schema::drop('jobs');
38+
}
39+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
7+
class CreatePackagesTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('packages', function(Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('title')->unique();
19+
$table->string('slug')->unique();
20+
$table->text('content');
21+
$table->boolean('is_approved')->default(false);
22+
$table->string('image');
23+
$table->integer('category_id')->unsigned();
24+
$table->integer('user_id')->unsigned();
25+
$table->timestamps();
26+
});
27+
}
28+
29+
/**
30+
* Reverse the migrations.
31+
*
32+
* @return void
33+
*/
34+
public function down()
35+
{
36+
Schema::drop('packages');
37+
}
38+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
7+
class CreateTutorialsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('tutorials', function(Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('title')->unique();
19+
$table->string('slug')->unique();
20+
$table->text('content');
21+
$table->boolean('is_published')->default(false);
22+
$table->string('image')->nullable();
23+
$table->integer('user_id')->unsigned();
24+
$table->integer('category_id')->unsigned();
25+
$table->timestamps();
26+
});
27+
}
28+
29+
/**
30+
* Reverse the migrations.
31+
*
32+
* @return void
33+
*/
34+
public function down()
35+
{
36+
Schema::drop('tutorials');
37+
}
38+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class AddTypeCollumnToCategoriesTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('categories', function (Blueprint $table) {
17+
$table->enum('type', ['POST', 'TUTORIAL', 'PACKAGES'])->default('POST');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('categories', function (Blueprint $table) {
29+
$table->dropColumn('type');
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)