Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
21.43% covered (danger)
21.43%
3 / 14
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
Migration400Beta2
21.43% covered (danger)
21.43%
3 / 14
75.00% covered (warning)
75.00%
3 / 4
23.46
0.00% covered (danger)
0.00%
0 / 1
 getVersion
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDependencies
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDescription
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 up
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3/**
4 * Migration for phpMyFAQ 4.0.0-beta.2.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License,
7 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
8 * obtain one at https://mozilla.org/MPL/2.0/.
9 *
10 * @package   phpMyFAQ
11 * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
12 * @copyright 2023-2026 phpMyFAQ Team
13 * @license   https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
14 * @link      https://www.phpmyfaq.de
15 * @since     2026-01-25
16 */
17
18declare(strict_types=1);
19
20namespace phpMyFAQ\Setup\Migration\Versions;
21
22use phpMyFAQ\Setup\Migration\AbstractMigration;
23use phpMyFAQ\Setup\Migration\Operations\OperationRecorder;
24
25readonly class Migration400Beta2 extends AbstractMigration
26{
27    public function getVersion(): string
28    {
29        return '4.0.0-beta.2';
30    }
31
32    public function getDependencies(): array
33    {
34        return ['4.0.0-alpha.3'];
35    }
36
37    public function getDescription(): string
38    {
39        return 'WebAuthn support';
40    }
41
42    public function up(OperationRecorder $recorder): void
43    {
44        // WebAuthn support
45        $recorder->addConfig('security.enableWebAuthnSupport', false);
46
47        if ($this->isSqlite()) {
48            $recorder->addSql(
49                sprintf('ALTER TABLE %sfaquser ADD COLUMN webauthnkeys TEXT NULL DEFAULT NULL', $this->tablePrefix),
50                'Add WebAuthn keys column to faquser (SQLite)',
51            );
52        }
53
54        if (!$this->isSqlite()) {
55            $recorder->addSql(
56                sprintf('ALTER TABLE %sfaquser ADD webauthnkeys TEXT NULL DEFAULT NULL', $this->tablePrefix),
57                'Add WebAuthn keys column to faquser',
58            );
59        }
60    }
61}