add proper migration for currentfiles view
This commit is contained in:
parent
dbc4a84d3f
commit
8a3b51a1ed
1 changed files with 36 additions and 0 deletions
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCurrentfilesView extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
DB::statement('create view currentfiles as
|
||||
select `f`.`iid` AS `iid`, `f`.`hash` AS `hash`
|
||||
from `files` `f`
|
||||
where `f`.`created_at` = (select max(`files`.`created_at`)
|
||||
from `files`
|
||||
group by `files`.`iid`
|
||||
having `files`.`iid` = `f`.`iid`);');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue