1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Schema; |
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
6
|
|
|
|
7
|
|
|
class PopulateFileTypes extends Migration |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Run the migrations. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function up() |
15
|
|
|
{ |
16
|
|
|
DB::table('file_types')->insert([ |
17
|
|
|
['id' => 1, 'name' => 'word'], |
18
|
|
|
['id' => 2, 'name' => 'powerpoint'], |
19
|
|
|
['id' => 3, 'name' => 'video'], |
20
|
|
|
['id' => 4, 'name' => 'publication'], |
21
|
|
|
['id' => 5, 'name' => 'other'], |
22
|
|
|
]); |
23
|
|
|
|
24
|
|
|
DB::table('file_type_translations')->insert([ |
25
|
|
|
['id' => 1, 'file_type_id' => 1, 'locale' => 'en', 'value' => 'Word Document'], |
26
|
|
|
['id' => 2, 'file_type_id' => 1, 'locale' => 'fr', 'value' => 'Document Word'], |
27
|
|
|
['id' => 3, 'file_type_id' => 2, 'locale' => 'en', 'value' => 'PowerPoint Presentation'], |
28
|
|
|
['id' => 4, 'file_type_id' => 2, 'locale' => 'fr', 'value' => 'Présentation PowerPoint'], |
29
|
|
|
['id' => 5, 'file_type_id' => 3, 'locale' => 'en', 'value' => 'Video'], |
30
|
|
|
['id' => 6, 'file_type_id' => 3, 'locale' => 'fr', 'value' => 'Vidéo'], |
31
|
|
|
['id' => 7, 'file_type_id' => 4, 'locale' => 'en', 'value' => 'Article Publication'], |
32
|
|
|
['id' => 8, 'file_type_id' => 4, 'locale' => 'fr', 'value' => 'Publication d\'Article'], |
33
|
|
|
['id' => 9, 'file_type_id' => 5, 'locale' => 'en', 'value' => 'Other'], |
34
|
|
|
['id' => 10, 'file_type_id' => 5, 'locale' => 'fr', 'value' => 'Autre'], |
35
|
|
|
]); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Reverse the migrations. |
40
|
|
|
* |
41
|
|
|
* @return void |
42
|
|
|
*/ |
43
|
|
|
public function down() |
44
|
|
|
{ |
45
|
|
|
DB::table('file_types')->whereIn('id', [1, 2, 3, 4, 5])->delete(); |
46
|
|
|
DB::table('file_type_translations')->whereIn('id', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])->delete(); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|