Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
SetupVersion_0005 | |
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(5)] |
14 | class SetupVersion_0005 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 | [BK_user_authentications] |
29 | as |
30 | select |
31 | * |
32 | from |
33 | [user_authentications] |
34 | ; |
35 | |
36 | drop table |
37 | [user_authentications] |
38 | ; |
39 | |
40 | create table |
41 | [user_authentications] -- ユーザー認証情報 |
42 | ( |
43 | [user_id] text not null, -- ユーザーID |
44 | [reminder_token] text not null, -- パスワードリマインダー トークン |
45 | [reminder_timestamp] datetime, -- パスワードリマインダー 作成日時 |
46 | [current_password] text not null, -- 現在パスワード(ハッシュ) |
47 | primary key([user_id]), |
48 | foreign key ([user_id]) references users([user_id]) |
49 | ) |
50 | ; |
51 | |
52 | insert into |
53 | [user_authentications] |
54 | ( |
55 | [user_id], |
56 | [reminder_token], |
57 | [reminder_timestamp], |
58 | [current_password] |
59 | ) |
60 | select |
61 | [BK_user_authentications].[user_id], |
62 | '', |
63 | NULL, |
64 | [BK_user_authentications].[current_password] |
65 | from |
66 | [BK_user_authentications] |
67 | ; |
68 | |
69 | drop table |
70 | [BK_user_authentications] |
71 | ; |
72 | |
73 | SQL; |
74 | |
75 | foreach ($this->splitStatements($statements) as $statement) { |
76 | $argument->default->execute($statement); |
77 | } |
78 | } |
79 | |
80 | #endregion |
81 | } |