diff options
Diffstat (limited to 'database')
7 files changed, 151 insertions, 22 deletions
diff --git a/database/migrations/2018_08_23_231531_create_text_posts_table.php b/database/migrations/2018_08_23_231531_create_text_posts_table.php new file mode 100644 index 0000000..128cfc6 --- /dev/null +++ b/database/migrations/2018_08_23_231531_create_text_posts_table.php @@ -0,0 +1,31 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreatePostsTextTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('text_posts', function (Blueprint $table) { + $table->increments('id'); + $table->string('text', 8192); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('text_posts'); + } +} diff --git a/database/migrations/2018_08_23_232015_create_media_posts_table.php b/database/migrations/2018_08_23_232015_create_media_posts_table.php new file mode 100644 index 0000000..d652a50 --- /dev/null +++ b/database/migrations/2018_08_23_232015_create_media_posts_table.php @@ -0,0 +1,32 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreatePostsImageTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('media_posts', function (Blueprint $table) { + $table->increments('id'); + $table->string('description'); + $table->string('media_path'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('media_posts'); + } +} diff --git a/database/migrations/2018_08_24_102141_create_posts_table.php b/database/migrations/2018_08_24_102141_create_posts_table.php new file mode 100644 index 0000000..f841c69 --- /dev/null +++ b/database/migrations/2018_08_24_102141_create_posts_table.php @@ -0,0 +1,33 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreatePostsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('text_posts', function (Blueprint $table) { + $table->increments('id'); + $table->integer('post_types_id'); + $table->integer('user_id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('text_posts'); + } +} diff --git a/database/migrations/2018_08_24_102348_create_post_types_table.php b/database/migrations/2018_08_24_102348_create_post_types_table.php new file mode 100644 index 0000000..76f0370 --- /dev/null +++ b/database/migrations/2018_08_24_102348_create_post_types_table.php @@ -0,0 +1,31 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreatePostTypesTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('post_types', function (Blueprint $table) { + $table->increments('id'); + $table->string('type'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('post_types'); + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 2399bf1..927bf94 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder */ public function run() { - $this->call(UsersTableSeeder::class); + $this->call(PostTypesTableSeeder::class); } } diff --git a/database/seeds/PostTypesTableSeeder.php b/database/seeds/PostTypesTableSeeder.php new file mode 100644 index 0000000..d21770b --- /dev/null +++ b/database/seeds/PostTypesTableSeeder.php @@ -0,0 +1,23 @@ +<?php + +use Illuminate\Database\Seeder; +use Illuminate\Database\Eloquent\Model; + +class PostTypesTableSeeder extends Seeder +{ + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + DB::table('post_types')->insert([ + 'type' => 'Media' + ]); + + DB::table('post_types')->insert([ + 'type' => 'Text' + ]); + } +} diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php deleted file mode 100644 index 395fc13..0000000 --- a/database/seeds/UsersTableSeeder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -use Illuminate\Database\Seeder; -use Illuminate\Database\Eloquent\Model; - -class UsersTableSeeder extends Seeder -{ - /** - * Run the database seeds. - * - * @return void - */ - public function run() - { - DB::table('users')->insert([ - 'name' => str_random(10), - 'email' => str_random(10).'@gmail.com', - 'password' => bcrypt('secret'), - ]); - } -} |