# Migrations

database / migrations /

# Users

Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');

            $table->string('employee_id')->nullable();
            $table->string('phone')->unique()->nullable();
            $table->string('nrc_number')->nullable();
            $table->date('birthday')->nullable();
            $table->date('date_of_join')->nullable();
            $table->enum('gender',['male', 'female'])->nullable();
            $table->text('address')->nullable();
            $table->bigInteger('department_id')->nullable();
            $table->boolean('is_present')->default(true);

            $table->rememberToken();
            $table->timestamps();
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Add Profile Image Column To Users Table

Schema::table('users', function (Blueprint $table) {
            $table-> string('profile_image')->nullable();
});
1
2
3

သတိပြုရန်

Table တွေကို Column တိုးတိုင်း down()မှာ dropColumn() လုပ်ပေးရပါမယ်။

Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('profile_image');
});
1
2
3

# Add Pin Code Column To Users Table

Schema::table('users', function (Blueprint $table) {
            $table->string('pin_code')->nullable();
});
1
2
3

သတိပြုရန်

Table တွေကို Column တိုးတိုင်း down()မှာ dropColumn() လုပ်ပေးရပါမယ်။

Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('pin_code');
});
1
2
3

# Departments

Schema::create('departments', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->timestamps();
});
1
2
3
4
5

# Projects

Schema::create('projects', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->text('description')->nullable();
            $table->text('images')->nullable();
            $table->text('files')->nullable();
            $table->date('start_time')->nullable();
            $table->date('deadLine')->nullable();
            $table->enum('priority',['high', 'middle', 'low']);
            $table->enum('status',['pending', 'in_progress', 'complete']);
            $table->timestamps();
});
1
2
3
4
5
6
7
8
9
10
11
12

# Relationship With Projects Table

  • # Project Leaders

    Schema::create('project_leaders', function (Blueprint $table) {
            $table->id();
            $table->foreignId('project_id')->constrained()->cascadeOnDelete();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->timestamps();
    });
    
    1
    2
    3
    4
    5
    6
  • # Project Members

    Schema::create('project_leaders', function (Blueprint $table) {
            $table->id();
            $table->foreignId('project_id')->constrained()->cascadeOnDelete();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->timestamps();
    });
    
    1
    2
    3
    4
    5
    6

# Check In & Check Out

Schema::create('check_in_check_outs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->timestamp('checkIn_time')->nullable();
            $table->timestamp('checkOut_time')->nullable();
            $table->timestamps();
});
1
2
3
4
5
6
7

# Add Date Column To check_in_check_outs Table

Schema::table('check_in_check_outs', function (Blueprint $table) {
            $table->date('Indate')->nullable()->after('user_id');
});
1
2
3

သတိပြုရန်

Table တွေကို Column တိုးတိုင်း down()မှာ dropColumn() လုပ်ပေးရပါမယ်။

Schema::table('check_in_check_outs', function (Blueprint $table) {
            $table->dropColumn('Indate');
});
1
2
3

# Company Setting

Schema::create('company_settings', function (Blueprint $table) {
            $table->id();
            $table->string('company_name')->nullable();
            $table->string('company_phone')->nullable();
            $table->string('company_email')->nullable();
            $table->string('company_address')->nullable();
            $table->string('office_start_time')->nullable();
            $table->string('office_end_time')->nullable();
            $table->string('break_start_time')->nullable();
            $table->string('break_end_time')->nullable();
            $table->timestamps();
});
1
2
3
4
5
6
7
8
9
10
11
12

# Salaries

Schema::create('salaries', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->string('month');
            $table->string('year');
            $table->integer('amount')->default('0');
            $table->timestamps();
});
1
2
3
4
5
6
7
8

# Tasks

Schema::create('tasks', function (Blueprint $table) {
            $table->id();
            $table->foreignId('project_id')->constrained()->cascadeOnDelete();
            $table->string('title')->nullable();
            $table->text('description')->nullable();
            $table->date('start_date')->nullable();
            $table->date('deadLine')->nullable();
            $table->enum('priority',['high', 'middle', 'low']);
            $table->enum('status',['pending', 'in_progress', 'complete']);
            $table->timestamps();
});
1
2
3
4
5
6
7
8
9
10
11

# Add Sort Number Column To Tasks Table

Schema::table('tasks', function (Blueprint $table) {
            $table->integer('sort_number')->default(0)->after('id');
});
1
2
3

သတိပြုရန်

Table တွေကို Column တိုးတိုင်း down()မှာ dropColumn() လုပ်ပေးရပါမယ်။

Schema::table('tasks', function (Blueprint $table) {
            $table->dropColumn('sort_number');
});
1
2
3

# Relationship With Tasks Table

  • # Task Members

    Schema::create('task_members', function (Blueprint $table) {
            $table->id();
            $table->foreignId('task_id')->constrained()->cascadeOnDelete();
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
            $table->timestamps();
        });
    
    1
    2
    3
    4
    5
    6
Last Updated: 6/1/2022, 12:13:18 AM