Skip to content

Commit 149fcf6

Browse files
authored
Merge pull request #16 from php-kchat/dev
Dev
2 parents f04f3d7 + 785f66d commit 149fcf6

28 files changed

+287
-225
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"license": "MIT",
77
"require": {
88
"php": "^8.0.2",
9+
"doctrine/dbal": "^3.6",
910
"guzzlehttp/guzzle": "^7.2",
1011
"laravel/framework": "^9.19",
1112
"laravel/sanctum": "^3.0",

database/migrations/2023_03_27_154202_create_participants_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function up()
2020
$table->string('status')->nullable();
2121
$table->timestamps();
2222
$table->integer('seen')->unsigned()->default(0);
23-
$table->unique(['user_id','conversation_id']);
23+
//$table->unique(['user_id','conversation_id'], 'user_id_conversation_id_unique_key');
2424
});
2525
}
2626

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('notifications', function(Blueprint $table){
17+
$table->bigInteger('uid')->unsigned()->change();
18+
$table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
Schema::table('notifications', function(Blueprint $table){
30+
$table->dropForeign('notifications_uid_foreign');
31+
$table->dropIndex('notifications_uid_foreign');
32+
});
33+
}
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('activities', function(Blueprint $table){
17+
$table->bigInteger('uid')->unsigned()->change();
18+
$table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
Schema::table('activities', function(Blueprint $table){
30+
$table->dropForeign('activities_uid_foreign');
31+
$table->dropIndex('activities_uid_foreign');
32+
});
33+
}
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('status', function(Blueprint $table){
17+
$table->bigInteger('uid')->unsigned()->change();
18+
$table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
Schema::table('status', function(Blueprint $table){
30+
$table->dropForeign('status_uid_foreign');
31+
$table->dropIndex('status_uid_foreign');
32+
});
33+
}
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
//Schema::table('conversations', function(Blueprint $table){
17+
// $table->bigInteger('message_id')->unsigned()->change();
18+
// $table->foreign('message_id')->references('id')->on('messages')->onDelete('cascade');
19+
//});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
//Schema::table('conversations', function(Blueprint $table){
30+
// $table->dropForeign('conversations_message_id_foreign');
31+
// $table->dropIndex('conversations_message_id_foreign');
32+
//});
33+
}
34+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('messages', function(Blueprint $table){
17+
$table->bigInteger('user_id')->unsigned()->change();
18+
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
19+
$table->bigInteger('conversation_id')->unsigned()->change();
20+
$table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade');
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*
27+
* @return void
28+
*/
29+
public function down()
30+
{
31+
Schema::table('messages', function(Blueprint $table){
32+
$table->dropForeign('messages_user_id_foreign');
33+
$table->dropIndex('messages_user_id_foreign');
34+
$table->dropForeign('messages_conversation_id_foreign');
35+
$table->dropIndex('messages_conversation_id_foreign');
36+
});
37+
}
38+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('participants', function(Blueprint $table){
17+
$table->bigInteger('user_id')->unsigned()->change();
18+
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
19+
$table->bigInteger('conversation_id')->unsigned()->change();
20+
$table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade');
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*
27+
* @return void
28+
*/
29+
public function down()
30+
{
31+
Schema::table('participants', function(Blueprint $table){
32+
$table->dropForeign('participants_conversation_id_foreign');
33+
$table->dropIndex('participants_conversation_id_foreign');
34+
$table->dropForeign('participants_user_id_foreign');
35+
$table->dropIndex('participants_user_id_foreign');
36+
//$table->dropUnique('user_id_conversation_id_unique_key');
37+
});
38+
}
39+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('files', function(Blueprint $table){
17+
$table->bigInteger('conversation_id')->unsigned()->change();
18+
$table->foreign('conversation_id')->references('id')->on('conversations')->onDelete('cascade');
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
Schema::table('files', function(Blueprint $table){
30+
$table->dropForeign('files_conversation_id_foreign');
31+
$table->dropIndex('files_conversation_id_foreign');
32+
});
33+
}
34+
};

0 commit comments

Comments
 (0)