Advertisement
guiiruiz

Untitled

Nov 26th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. <?php
  2.  
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5.  
  6. class CreateUsersTable extends Migration {
  7.  
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create('users', function($table)
  16. {
  17. $table->increments('id');
  18. $table->string('email')->unique();
  19. $table->string('name');
  20. $table->string('password', 64);
  21. $table->timestamps();
  22. });
  23.  
  24. Schema::create('notifications', function($table)
  25. {
  26. $table->increments('id');
  27. $table->foreign('user_id')->references('id')->on('users');
  28. $table->text('description');
  29. $table->boolean('read')->default(false);
  30. $table->timestamps();
  31. });
  32.  
  33. Schema::create('types', function($table) {
  34. $table->increments('id');
  35. $table->string('name');
  36. $table->timestamps();
  37. });
  38.  
  39. Schema::create('pets', function($table) {
  40. $table->increments('id');
  41. $table->foreign('user_id')->references('id')->on('users');
  42. $table->foreign('type_id')->references('id')->on('types');
  43. $table->string('name');
  44. $table->text('about');
  45. $table->string('gender', 1);
  46. $table->date('birthdate');
  47. $table->timestamps();
  48. });
  49.  
  50. Schema::create('followers', function($table) {
  51. $table->increments('id');
  52. $table->foreign('follower_id')->references('id')->on('users');
  53. $table->foreign('following_id')->references('id')->on('users');
  54. $table->timestamps();
  55. });
  56. }
  57.  
  58. /**
  59. * Reverse the migrations.
  60. *
  61. * @return void
  62. */
  63. public function down()
  64. {
  65. Schema::drop('users');
  66. Schema::drop('notifications');
  67. Schema::drop('types');
  68. Schema::drop('pets');
  69. Schema::drop('followers');
  70. }
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement