Skip to content
Snippets Groups Projects
Commit 19431065 authored by Kurniandha Sukma Yunastrian's avatar Kurniandha Sukma Yunastrian
Browse files

add seed and edit migration

parent 76b3648e
Branches
2 merge requests!8Finalize,!2Home
......@@ -19,7 +19,7 @@ class CreateUsersTable extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('role');
$table->integer('role');
$table->rememberToken();
$table->timestamps();
});
......
......@@ -16,7 +16,7 @@ class CreateCoursesTable extends Migration
Schema::create('courses', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('description');
$table->longText('description');
});
}
......
......@@ -17,7 +17,7 @@ class CreateTopicsTable extends Migration
$table->bigIncrements('id');
$table->bigInteger('id_course')->unsigned();
$table->string('name');
$table->string('content');
$table->longText('content');
$table->string('id_spreadsheet');
$table->foreign('id_course')->references('id')->on('courses');
......
......@@ -17,7 +17,7 @@ class CreateSpreadsheetsTable extends Migration
$table->bigInteger('id')->unsigned();
$table->string('cell');
$table->string('value');
$table->string('type');
$table->integer('type');
$table->primary(['id', 'cell']);
$table->foreign('id')->references('id')->on('topics');
......
......@@ -16,7 +16,7 @@ class CreateUserCourseTable extends Migration
Schema::create('user_course', function (Blueprint $table) {
$table->bigInteger('id_user')->unsigned();
$table->bigInteger('id_course')->unsigned();
$table->string('role');
$table->integer('role');
$table->primary(['id_user', 'id_course']);
......
<?php
use Illuminate\Database\Seeder;
class CoursesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('courses')->insert([
'name' => 'Pengenalan Spreadsheet',
'description' => 'Belajar pengenalan terkait spreadsheet dari hal yang paling dasar. Cocok untuk anda yang ingin mendalami spreadsheet.'
]);
DB::table('courses')->insert([
'name' => 'Spreadsheet Expert',
'description' => 'Belajar spreadsheet untuk level menengah. Cocok untuk anda yang ingin mendalami spreadsheet.'
]);
DB::table('courses')->insert([
'name' => 'Data Analisis',
'description' => 'Belajar data analisis menggunakan spreadsheet. Cocok untuk anda pecinta data.'
]);
}
}
......@@ -11,6 +11,9 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
$this->call(UsersTableSeeder::class);
$this->call(CoursesTableSeeder::class);
$this->call(TopicsTableSeeder::class);
$this->call(SpreadsheetsTableSeeder::class);
}
}
<?php
use Illuminate\Database\Seeder;
class SpreadsheetsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('spreadsheets')->insert([
'id' => 1,
'cell' => 'A1',
'value' => '23',
'type' => 0
]);
}
}
<?php
use Illuminate\Database\Seeder;
class TopicsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('topics')->insert([
'id_course' => 1,
'name' => 'Baris dan Kolom',
'content' => 'Baris adalah blabalbalbalbalbala. Kolom adalah blabalbalblablala.',
'id_spreadsheet' => 'null'
]);
DB::table('topics')->insert([
'id_course' => 1,
'name' => 'Formula',
'content' => 'Formula adalah blabalbalblablala.',
'id_spreadsheet' => 'null'
]);
DB::table('topics')->insert([
'id_course' => 2,
'name' => 'Average',
'content' => 'Average adalah salah satu....',
'id_spreadsheet' => 'null'
]);
}
}
<?php
use Illuminate\Database\Seeder;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->insert([
'name' => 'Kurniandha Sukma',
'email' => 'kurnia@datalearn.com',
'password' => '$2y$10$20J2FUYhL22ovKKs2Kdfguo4oWEeBfkMxZipexw1BEtIxds3GnT9S',
'role' => 1
]);
DB::table('users')->insert([
'name' => 'Fanny Akbar',
'email' => 'fanny@datalearn.com',
'password' => '$2y$10$20J2FUYhL22ovKKs2Kdfguo4oWEeBfkMxZipexw1BEtIxds3GnT9S',
'role' => 1
]);
DB::table('users')->insert([
'name' => 'Irfan Sanemi',
'email' => 'irfan@datalearn.com',
'password' => '$2y$10$20J2FUYhL22ovKKs2Kdfguo4oWEeBfkMxZipexw1BEtIxds3GnT9S',
'role' => 0
]);
DB::table('users')->insert([
'name' => 'Jojo Andika',
'email' => 'jojo@datalearn.com',
'password' => '$2y$10$20J2FUYhL22ovKKs2Kdfguo4oWEeBfkMxZipexw1BEtIxds3GnT9S',
'role' => 0
]);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment