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 database-specific SQL dialects. |
| 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 | |
| 18 | declare(strict_types=1); |
| 19 | |
| 20 | namespace phpMyFAQ\Setup\Migration\QueryBuilder; |
| 21 | |
| 22 | interface DialectInterface |
| 23 | { |
| 24 | /** |
| 25 | * Returns the database type identifier (e.g., 'mysqli', 'pgsql'). |
| 26 | */ |
| 27 | public function getType(): string; |
| 28 | |
| 29 | /** |
| 30 | * Returns the INTEGER column type. |
| 31 | */ |
| 32 | public function integer(): string; |
| 33 | |
| 34 | /** |
| 35 | * Returns the BIGINT column type. |
| 36 | */ |
| 37 | public function bigInteger(): string; |
| 38 | |
| 39 | /** |
| 40 | * Returns the SMALLINT column type. |
| 41 | */ |
| 42 | public function smallInteger(): string; |
| 43 | |
| 44 | /** |
| 45 | * Returns the VARCHAR column type with length. |
| 46 | */ |
| 47 | public function varchar(int $length): string; |
| 48 | |
| 49 | /** |
| 50 | * Returns the TEXT column type. |
| 51 | */ |
| 52 | public function text(): string; |
| 53 | |
| 54 | /** |
| 55 | * Returns the LONGTEXT column type (or equivalent). |
| 56 | */ |
| 57 | public function longText(): string; |
| 58 | |
| 59 | /** |
| 60 | * Returns the BLOB column type (or equivalent). |
| 61 | */ |
| 62 | public function blob(): string; |
| 63 | |
| 64 | /** |
| 65 | * Returns the BOOLEAN/TINYINT column type. |
| 66 | */ |
| 67 | public function boolean(): string; |
| 68 | |
| 69 | /** |
| 70 | * Returns the TIMESTAMP/DATETIME column type. |
| 71 | */ |
| 72 | public function timestamp(): string; |
| 73 | |
| 74 | /** |
| 75 | * Returns the DATE column type. |
| 76 | */ |
| 77 | public function date(): string; |
| 78 | |
| 79 | /** |
| 80 | * Returns the CHAR column type with length. |
| 81 | */ |
| 82 | public function char(int $length): string; |
| 83 | |
| 84 | /** |
| 85 | * Returns the current timestamp function/default. |
| 86 | */ |
| 87 | public function currentTimestamp(): string; |
| 88 | |
| 89 | /** |
| 90 | * Returns the current date function/default. |
| 91 | */ |
| 92 | public function currentDate(): string; |
| 93 | |
| 94 | /** |
| 95 | * Returns the auto-increment column definition. |
| 96 | */ |
| 97 | public function autoIncrement(string $columnName): string; |
| 98 | |
| 99 | /** |
| 100 | * Returns the CREATE TABLE prefix with options. |
| 101 | */ |
| 102 | public function createTablePrefix(string $tableName, bool $ifNotExists = false): string; |
| 103 | |
| 104 | /** |
| 105 | * Returns the CREATE TABLE suffix with engine/charset options. |
| 106 | */ |
| 107 | public function createTableSuffix(): string; |
| 108 | |
| 109 | /** |
| 110 | * Returns the ALTER TABLE ADD COLUMN syntax. |
| 111 | */ |
| 112 | public function addColumn(string $tableName, string $columnName, string $type, ?string $after = null): string; |
| 113 | |
| 114 | /** |
| 115 | * Returns the ALTER TABLE MODIFY/ALTER COLUMN syntax. |
| 116 | */ |
| 117 | public function modifyColumn(string $tableName, string $columnName, string $newType): string; |
| 118 | |
| 119 | /** |
| 120 | * Returns the CREATE INDEX syntax. |
| 121 | * |
| 122 | * @param string[] $columns |
| 123 | */ |
| 124 | public function createIndex( |
| 125 | string $indexName, |
| 126 | string $tableName, |
| 127 | array $columns, |
| 128 | bool $ifNotExists = false, |
| 129 | ): string; |
| 130 | |
| 131 | /** |
| 132 | * Returns the DROP INDEX syntax. |
| 133 | */ |
| 134 | public function dropIndex(string $indexName, string $tableName): string; |
| 135 | |
| 136 | /** |
| 137 | * Returns whether AFTER clause is supported in ALTER TABLE ADD COLUMN. |
| 138 | */ |
| 139 | public function supportsColumnPositioning(): bool; |
| 140 | |
| 141 | /** |
| 142 | * Returns whether combined ALTER TABLE statements (multiple clauses in one statement) are supported. |
| 143 | */ |
| 144 | public function supportsCombinedAlter(): bool; |
| 145 | |
| 146 | /** |
| 147 | * Quotes an identifier (table name, column name). |
| 148 | */ |
| 149 | public function quoteIdentifier(string $identifier): string; |
| 150 | } |