-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
2023_06_22_000000_core_v3016.php
64 lines (55 loc) · 2 KB
/
2023_06_22_000000_core_v3016.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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()
{
// Settings
Schema::table('settings', function (Blueprint $table) {
$connection = Schema::getConnection();
$d_table = $connection->getDoctrineSchemaManager()->listTableDetails($connection->getTablePrefix() . 'settings');
if ($d_table->hasIndex('settings_company_id_key_unique')) {
$table->dropUnique('settings_company_id_key_unique');
} else {
$table->dropUnique(['company_id', 'key']);
}
$table->unique(['company_id', 'key', 'deleted_at']);
});
// User Invitations
Schema::table('user_invitations', function (Blueprint $table) {
$table->unsignedInteger('created_by')->nullable()->after('token');
$table->string('created_from', 100)->nullable()->after('token');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// Settings
Schema::table('settings', function (Blueprint $table) {
$connection = Schema::getConnection();
$d_table = $connection->getDoctrineSchemaManager()->listTableDetails($connection->getTablePrefix() . 'settings');
if ($d_table->hasIndex('settings_company_id_key_deleted_at_unique')) {
$table->dropUnique('settings_company_id_key_deleted_at_unique');
} else {
$table->dropUnique(['company_id', 'key', 'deleted_at']);
}
$table->unique(['company_id', 'key']);
});
// User Invitations
Schema::table('user_invitations', function (Blueprint $table) {
$table->dropColumn('created_by');
$table->dropColumn('created_from');
});
}
};