1 回答
TA贡献2041条经验 获得超4个赞
if (config('database.default') == 'pgsql') {
$database_name = 'laravel';
$tables = DB::select("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'");
foreach ($tables as $table) {
$tablename = $table->table_name;
if ($tablename == 'model_has_permissions' || $tablename == 'password_resets'|| $tablename == 'model_has_roles'
|| $tablename == 'model_has_permissions'|| $tablename == 'role_has_permissions') {
continue;
}
DB::select("
SELECT setval(pg_get_serial_sequence('$table->table_name' , 'id'), coalesce(max(id)+1, 1), false)
FROM ".$tablename.";
");
}
}
TA贡献1936条经验 获得超6个赞
- 1 回答
- 0 关注
- 133 浏览
添加回答
举报