Issues (590)

src/Schema/Manager/DatabaseManagerInterface.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Bdf\Prime\Schema\Manager;
4
5
use Bdf\Prime\Connection\ConnectionInterface;
6
use Bdf\Prime\Exception\PrimeException;
7
use Bdf\Prime\Schema\TableInterface;
8
9
/**
10
 * Handle database operations, like load schema, check table existence,
11
 * manage database...
12
 *
13
 * The operations will be done one the remote connection (or simulate), so it will result to database queries
14
 *
15
 * @template C as ConnectionInterface
16
 */
17
interface DatabaseManagerInterface
18
{
19
    /**
20
     * Get the database connection instance.
21
     *
22
     * @return C
0 ignored issues
show
The type Bdf\Prime\Schema\Manager\C was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
     */
24
    public function getConnection(): ConnectionInterface;
25
26
    /**
27
     * Determine if the given database exists.
28
     *
29
     * @param string $database
30
     *
31
     * @return bool
32
     * @throws PrimeException When list databases fail
33
     */
34
    public function hasDatabase(string $database): bool;
35
36
    /**
37
     * Get the databases listing.
38
     *
39
     * @return list<string>
0 ignored issues
show
The type Bdf\Prime\Schema\Manager\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
     * @throws PrimeException When list databases fail
41
     */
42
    public function getDatabases(): array;
43
44
    /**
45
     * Creates a new database.
46
     *
47
     * @param string $database The name of the database to create.
48
     *
49
     * @return $this
50
     * @throws PrimeException When query fail
51
     */
52
    public function createDatabase(string $database);
53
54
    /**
55
     * Drops a database.
56
     *
57
     * NOTE: You can not drop the database this connection is currently connected to.
58
     *
59
     * @param string $database The name of the database to drop.
60
     *
61
     * @return $this
62
     * @throws PrimeException When query fail
63
     */
64
    public function dropDatabase(string $database);
65
66
    /**
67
     * Determine if the given table exists.
68
     *
69
     * @param string $tableName
70
     *
71
     * @return bool
72
     * @throws PrimeException When query fail
73
     */
74
    public function has(string $tableName): bool;
75
76
    /**
77
     * Determine if the given table exists.
78
     *
79
     * @param string $tableName
80
     *
81
     * @return bool
82
     * @throws PrimeException When query fail
83
     * @deprecated Since 2.0. Use DatabaseManagerInterface#has() instead
84
     */
85
    public function hasTable($tableName);
86
87
    /**
88
     * Determine load the table structure
89
     *
90
     * @param string $tableName
91
     *
92
     * @return TableInterface
93
     * @throws PrimeException When query fail
94
     * @deprecated Since 2.0. Use DatabaseStructureManagerInterface::load() instead
95
     */
96
    public function loadTable($tableName);
97
98
    /**
99
     * Drop a table from the schema.
100
     *
101
     * @param string $tableName
102
     *
103
     * @return $this
104
     * @throws PrimeException When query fail
105
     */
106
    public function drop(string $tableName);
107
108
    /**
109
     * Truncate a table
110
     *
111
     * @param string $tableName
112
     * @param bool $cascade
113
     *
114
     * @return $this
115
     * @throws PrimeException When query fail
116
     */
117
    public function truncate(string $tableName, bool $cascade = false);
118
119
    /**
120
     * Rename a table on the schema.
121
     *
122
     * @param string $from
123
     * @param string $to
124
     *
125
     * @return $this
126
     * @throws PrimeException When query fail
127
     */
128
    public function rename(string $from, string $to);
129
}
130