2016_11_22_093148_create_test_tables.php 3.8 KB

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