mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
fix:修复子任务可见性字段为null的数据
This commit is contained in:
parent
0e12a08076
commit
e2a0b7a033
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class repairProjectTasksIsAllVisible extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
// 修复子任务可见性字段为null的数据
|
||||||
|
if (!Schema::hasTable('project_tasks')) {
|
||||||
|
$prefix = DB::getConfig('prefix');
|
||||||
|
DB::select(DB::raw(`
|
||||||
|
UPDATE {$prefix}project_tasks
|
||||||
|
SET is_all_visible = 1
|
||||||
|
WHERE is_all_visible is null AND parent_id = 0
|
||||||
|
`));
|
||||||
|
DB::select(DB::raw(`
|
||||||
|
UPDATE {$prefix}project_tasks t1
|
||||||
|
JOIN {$prefix}project_tasks t2 ON t1.parent_id = t2.id
|
||||||
|
SET t1.is_all_visible = t2.is_all_visible
|
||||||
|
WHERE t1.is_all_visible is null AND t1.parent_id > 0
|
||||||
|
`));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user