Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
SetupVersion_0006 | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
migrateIOSystem | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
migrateDatabase | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models\Setup\Versions; |
6 | |
7 | use PeServer\App\Models\Setup\DatabaseSetupArgument; |
8 | use PeServer\App\Models\Setup\IOSetupArgument; |
9 | |
10 | /** |
11 | * @SuppressWarnings(PHPMD.CamelCaseClassName) |
12 | */ |
13 | #[Version(6)] |
14 | class SetupVersion_0006 extends SetupVersionBase //phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps |
15 | { |
16 | #region SetupVersionBase |
17 | |
18 | protected function migrateIOSystem(IOSetupArgument $argument): void |
19 | { |
20 | //NOP |
21 | } |
22 | |
23 | protected function migrateDatabase(DatabaseSetupArgument $argument): void |
24 | { |
25 | $statements = <<<SQL |
26 | |
27 | create table |
28 | [access_logs] -- ユーザー認証情報 |
29 | ( |
30 | [timestamp] text not null, -- タイムスタンプ |
31 | [client_ip] text not null, -- クライアントIP |
32 | [client_host] text not null, -- クライアントホスト |
33 | [request_id] text not null, -- リクエストID |
34 | [session] text not null, -- セッションID |
35 | [ua] text not null, -- UA |
36 | [method] text not null, -- メソッド |
37 | [path] text not null, -- パス |
38 | [query] text not null, -- クエリ |
39 | [fragment] text not null, -- フラグメント |
40 | [referer] text not null, -- リファラ |
41 | [running_time] read not null -- 実行時間(ミリ秒) |
42 | ) |
43 | ; |
44 | |
45 | create index |
46 | [access_logs_idx_timestamp] on [access_logs] |
47 | ( |
48 | [timestamp] |
49 | ) |
50 | ; |
51 | |
52 | create index |
53 | [access_logs_idx_ua] on [access_logs] |
54 | ( |
55 | [ua] |
56 | ) |
57 | ; |
58 | |
59 | create index |
60 | [access_logs_idx_path] on [access_logs] |
61 | ( |
62 | [path] |
63 | ) |
64 | ; |
65 | |
66 | create index |
67 | [access_logs_idx_search_1] on [access_logs] |
68 | ( |
69 | [timestamp], |
70 | [path] |
71 | ) |
72 | ; |
73 | |
74 | SQL; |
75 | |
76 | foreach ($this->splitStatements($statements) as $statement) { |
77 | $argument->default->execute($statement); |
78 | } |
79 | } |
80 | |
81 | #endregion |
82 | } |