add uid starts when install

This commit is contained in:
xiaomlove
2022-08-20 23:46:14 +08:00
parent b434214508
commit 29c4a969f4
3 changed files with 9 additions and 2 deletions
+2
View File
@@ -79,3 +79,5 @@ SFTP_USERNAME=
SFTP_PASSWORD= SFTP_PASSWORD=
SFTP_PORT= SFTP_PORT=
SFTP_ROOT=/tmp SFTP_ROOT=/tmp
UID_STARTS=10001
@@ -16,8 +16,12 @@ class CreateUsersTable extends Migration
if (Schema::hasTable('users')) { if (Schema::hasTable('users')) {
return; return;
} }
Schema::create('users', function (Blueprint $table) { $uidStarts = env('UID_STARTS');
$table->id('id')->startingValue(10001); if (!is_numeric($uidStarts) || $uidStarts < 1) {
$uidStarts = 10001;
}
Schema::create('users', function (Blueprint $table) use ($uidStarts) {
$table->id('id')->startingValue($uidStarts);
$table->string('username', 40)->default('')->unique('username'); $table->string('username', 40)->default('')->unique('username');
$table->string('passhash', 32)->default(''); $table->string('passhash', 32)->default('');
$table->binary('secret'); $table->binary('secret');
+1
View File
@@ -28,6 +28,7 @@ class Install
'TIMEZONE', 'TIMEZONE',
'DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE', 'DB_HOST', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD', 'DB_DATABASE',
'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB', 'REDIS_PASSWORD', 'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB', 'REDIS_PASSWORD',
'UID_STARTS',
]; ];
protected array $requiredExtensions = ['ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'gmp']; protected array $requiredExtensions = ['ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'gmp'];