mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-09 08:38:49 +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) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name')->unique();
|
$table->string('name');
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
|
@ -146,27 +146,10 @@ use Illuminate\Support\Facades\File;
|
|||||||
} catch (exception $e) {}
|
} catch (exception $e) {}
|
||||||
|
|
||||||
// Remove unique constrain from user names
|
// Remove unique constrain from user names
|
||||||
class UpdateNameColumnInUsersTable extends Migration
|
try {
|
||||||
{
|
$affected_rows = DB::delete(DB::raw("DELETE FROM users WHERE id NOT IN (SELECT MIN(id) FROM users GROUP BY name)"));
|
||||||
public function up()
|
$message = "Duplicate rows removed successfully. $affected_rows rows were affected.";
|
||||||
{
|
} catch (\Exception $e) {}
|
||||||
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) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes saved profile images from littlelink_name to IDs.
|
// Changes saved profile images from littlelink_name to IDs.
|
||||||
// This runs every time the updater runs.
|
// This runs every time the updater runs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user