Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #16

Merged
merged 4 commits into from
May 3, 2023
Merged

Dev #16

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added Database Relation
  • Loading branch information
GaneshKandu committed May 3, 2023
commit 785f66d4bdd1041d97142ad328777a77fb3e9cc3
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.0.2",
"doctrine/dbal": "^3.6",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up()
$table->string('status')->nullable();
$table->timestamps();
$table->integer('seen')->unsigned()->default(0);
$table->unique(['user_id','conversation_id']);
//$table->unique(['user_id','conversation_id'], 'user_id_conversation_id_unique_key');
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('notifications', function(Blueprint $table){
$table->bigInteger('uid')->unsigned()->change();
$table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('notifications', function(Blueprint $table){
$table->dropForeign('notifications_uid_foreign');
$table->dropIndex('notifications_uid_foreign');
});
}
};
34 changes: 34 additions & 0 deletions database/migrations/2023_05_03_153445_alter_activities_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('activities', function(Blueprint $table){
$table->bigInteger('uid')->unsigned()->change();
$table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('activities', function(Blueprint $table){
$table->dropForeign('activities_uid_foreign');
$table->dropIndex('activities_uid_foreign');
});
}
};
34 changes: 34 additions & 0 deletions database/migrations/2023_05_03_153739_alter_status_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('status', function(Blueprint $table){
$table->bigInteger('uid')->unsigned()->change();
$table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('status', function(Blueprint $table){
$table->dropForeign('status_uid_foreign');
$table->dropIndex('status_uid_foreign');
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//Schema::table('conversations', function(Blueprint $table){
// $table->bigInteger('message_id')->unsigned()->change();
// $table->foreign('message_id')->references('id')->on('messages')->onDelete('cascade');
//});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//Schema::table('conversations', function(Blueprint $table){
// $table->dropForeign('conversations_message_id_foreign');
// $table->dropIndex('conversations_message_id_foreign');
//});
}
};
38 changes: 38 additions & 0 deletions database/migrations/2023_05_03_154158_alter_messages_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('messages', function(Blueprint $table){
$table->bigInteger('user_id')->unsigned()->change();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->bigInteger('conversation_id')->unsigned()->change();
$table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('messages', function(Blueprint $table){
$table->dropForeign('messages_user_id_foreign');
$table->dropIndex('messages_user_id_foreign');
$table->dropForeign('messages_conversation_id_foreign');
$table->dropIndex('messages_conversation_id_foreign');
});
}
};
39 changes: 39 additions & 0 deletions database/migrations/2023_05_03_154539_alter_participants_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('participants', function(Blueprint $table){
$table->bigInteger('user_id')->unsigned()->change();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->bigInteger('conversation_id')->unsigned()->change();
$table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('participants', function(Blueprint $table){
$table->dropForeign('participants_conversation_id_foreign');
$table->dropIndex('participants_conversation_id_foreign');
$table->dropForeign('participants_user_id_foreign');
$table->dropIndex('participants_user_id_foreign');
//$table->dropUnique('user_id_conversation_id_unique_key');
});
}
};
34 changes: 34 additions & 0 deletions database/migrations/2023_05_03_163529_alter_files_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('files', function(Blueprint $table){
$table->bigInteger('conversation_id')->unsigned()->change();
$table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('files', function(Blueprint $table){
$table->dropForeign('files_conversation_id_foreign');
$table->dropIndex('files_conversation_id_foreign');
});
}
};