-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStructureUpgraderInterface.php
More file actions
61 lines (54 loc) · 1.48 KB
/
StructureUpgraderInterface.php
File metadata and controls
61 lines (54 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Bdf\Prime\Schema;
use Bdf\Prime\Exception\PrimeException;
/**
* Perform schema operation like migration, deletion...
*/
interface StructureUpgraderInterface
{
/**
* Migrate table structure changes to database
*
* @param bool $listDrop
*
* @throws PrimeException When migration fail
*/
public function migrate(bool $listDrop = true): void;
/**
* List table structure changes
*
* @param bool $listDrop
*
* @return array Array of queries
* @throws PrimeException When diff fail
*/
public function diff(bool $listDrop = true): array;
/**
* List migration queries, indexed by connection name
*
* The result is an array with two keys:
* - up: the queries to execute to migrate the schema
* - down: the queries to execute to rollback the migration
*
* @param bool $listDrop Whether to list drop queries
*
* @return array{up: array<string, list<string>>, down: array<string, list<string>>}
*/
public function queries(bool $listDrop = true): array;
/**
* Truncate table
*
* @param bool $cascade
*
* @return bool true on success
* @throws PrimeException When truncate fail
*/
public function truncate(bool $cascade = false): bool;
/**
* Drop table and its sequence if exists
*
* @return bool true on success
* @throws PrimeException When drop fail
*/
public function drop(): bool;
}