2016_11_22_093148_create_test_tables.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. class CreateTestTables extends Migration
  5. {
  6. /**
  7. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create('test_images', function (Blueprint $table) {
  14. $table->increments('id');
  15. $table->string('image1');
  16. $table->string('image2');
  17. $table->string('image3');
  18. $table->string('image4');
  19. $table->string('image5');
  20. $table->string('image6');
  21. $table->timestamps();
  22. });
  23. Schema::create('test_multiple_images', function (Blueprint $table) {
  24. $table->increments('id');
  25. $table->text('pictures');
  26. $table->timestamps();
  27. });
  28. Schema::create('test_files', function (Blueprint $table) {
  29. $table->increments('id');
  30. $table->string('file1');
  31. $table->string('file2');
  32. $table->string('file3');
  33. $table->string('file4');
  34. $table->string('file5');
  35. $table->string('file6');
  36. $table->timestamps();
  37. });
  38. Schema::create('test_users', function (Blueprint $table) {
  39. $table->increments('id');
  40. $table->string('username');
  41. $table->string('email');
  42. $table->string('mobile')->nullable();
  43. $table->string('avatar')->nullable();
  44. $table->string('password');
  45. $table->timestamps();
  46. });
  47. Schema::create('test_user_profiles', function (Blueprint $table) {
  48. $table->increments('id');
  49. $table->string('user_id');
  50. $table->string('first_name')->nullable();
  51. $table->string('last_name')->nullable();
  52. $table->string('postcode')->nullable();
  53. $table->string('address')->nullable();
  54. $table->string('latitude')->nullable();
  55. $table->string('longitude')->nullable();
  56. $table->string('color')->nullable();
  57. $table->timestamp('start_at')->nullable();
  58. $table->timestamp('end_at')->nullable();
  59. $table->timestamps();
  60. });
  61. Schema::create('test_tags', function (Blueprint $table) {
  62. $table->increments('id');
  63. $table->string('name');
  64. $table->timestamps();
  65. });
  66. Schema::create('test_user_tags', function (Blueprint $table) {
  67. $table->integer('user_id');
  68. $table->integer('tag_id');
  69. $table->index(['user_id', 'tag_id']);
  70. $table->timestamps();
  71. });
  72. }
  73. /**
  74. * Reverse the migrations.
  75. *
  76. * @return void
  77. */
  78. public function down()
  79. {
  80. Schema::dropIfExists('test_images');
  81. Schema::dropIfExists('test_multiple_images');
  82. Schema::dropIfExists('test_files');
  83. Schema::dropIfExists('test_users');
  84. Schema::dropIfExists('test_user_profiles');
  85. Schema::dropIfExists('test_tags');
  86. Schema::dropIfExists('test_user_tags');
  87. }
  88. }