Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
- class CreateUsersTable extends Migration {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('users', function($table)
- {
- $table->increments('id');
- $table->string('email')->unique();
- $table->string('name');
- $table->string('password', 64);
- $table->timestamps();
- });
- Schema::create('notifications', function($table)
- {
- $table->increments('id');
- $table->foreign('user_id')->references('id')->on('users');
- $table->text('description');
- $table->boolean('read')->default(false);
- $table->timestamps();
- });
- Schema::create('types', function($table) {
- $table->increments('id');
- $table->string('name');
- $table->timestamps();
- });
- Schema::create('pets', function($table) {
- $table->increments('id');
- $table->foreign('user_id')->references('id')->on('users');
- $table->foreign('type_id')->references('id')->on('types');
- $table->string('name');
- $table->text('about');
- $table->string('gender', 1);
- $table->date('birthdate');
- $table->timestamps();
- });
- Schema::create('followers', function($table) {
- $table->increments('id');
- $table->foreign('follower_id')->references('id')->on('users');
- $table->foreign('following_id')->references('id')->on('users');
- $table->timestamps();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::drop('users');
- Schema::drop('notifications');
- Schema::drop('types');
- Schema::drop('pets');
- Schema::drop('followers');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement