mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-03 12:37:39 +01:00
$table->string('name')->unique();
This commit is contained in:
parent
19c6097a1c
commit
1abcf14b5a
@ -15,7 +15,7 @@ class CreateUsersTable extends Migration
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
|
@ -146,27 +146,10 @@ use Illuminate\Support\Facades\File;
|
||||
} catch (exception $e) {}
|
||||
|
||||
// Remove unique constrain from user names
|
||||
class UpdateNameColumnInUsersTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
try {
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropUnique('users_name_unique');
|
||||
$table->string('name')->unique(false)->change();
|
||||
});
|
||||
} catch (\Throwable $th) {}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
try {
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('name')->unique()->change();
|
||||
});
|
||||
} catch (\Throwable $th) {}
|
||||
}
|
||||
}
|
||||
try {
|
||||
$affected_rows = DB::delete(DB::raw("DELETE FROM users WHERE id NOT IN (SELECT MIN(id) FROM users GROUP BY name)"));
|
||||
$message = "Duplicate rows removed successfully. $affected_rows rows were affected.";
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
// Changes saved profile images from littlelink_name to IDs.
|
||||
// This runs every time the updater runs.
|
||||
|
Loading…
x
Reference in New Issue
Block a user