Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * Contract for all database migrations.
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;
21
22use phpMyFAQ\Setup\Migration\Operations\OperationRecorder;
23
24interface MigrationInterface
25{
26    /**
27     * Returns the version string this migration upgrades to.
28     * Format: semantic version (e.g., "3.2.0-alpha", "4.0.0-alpha.2")
29     */
30    public function getVersion(): string;
31
32    /**
33     * Returns an array of version strings that must be applied before this migration.
34     *
35     * @return string[]
36     */
37    public function getDependencies(): array;
38
39    /**
40     * Returns a human-readable description of what this migration does.
41     */
42    public function getDescription(): string;
43
44    /**
45     * Applies the migration, recording all operations to the recorder.
46     * Operations are NOT executed immediately - they are collected for review or execution.
47     */
48    public function up(OperationRecorder $recorder): void;
49
50    /**
51     * Reverses the migration, recording all rollback operations to the recorder.
52     * Operations are NOT executed immediately - they are collected for review or execution.
53     */
54    public function down(OperationRecorder $recorder): void;
55
56    /**
57     * Returns true if this migration can be safely reversed.
58     */
59    public function isReversible(): bool;
60}