You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

  1. <?php
  2. use Movim\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. class CreateBundlesTable extends Migration
  5. {
  6. public function up()
  7. {
  8. $this->schema->create('bundles', function (Blueprint $table) {
  9. $table->increments('id');
  10. $table->string('user_id', 64);
  11. $table->integer('bundle_id');
  12. $table->string('jid', 128);
  13. $table->integer('signedprekeyid');
  14. $table->text('signedprekeypublic');
  15. $table->text('signedprekeysignature');
  16. $table->text('identitykey');
  17. $table->text('prekeys');
  18. $table->timestamps();
  19. $table->unique(['user_id', 'bundle_id', 'jid']);
  20. $table->index('user_id');
  21. });
  22. $this->schema->create('bundle_sessions', function (Blueprint $table) {
  23. $table->increments('id');
  24. $table->integer('bundle_id')->unsigned();
  25. $table->string('device_id', 64);
  26. $table->foreign('bundle_id')
  27. ->references('id')->on('bundles')
  28. ->onDelete('cascade');
  29. $table->timestamps();
  30. });
  31. }
  32. public function down()
  33. {
  34. $this->schema->drop('bundle_sessions');
  35. $this->schema->drop('bundles');
  36. }
  37. }