-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableManagerInterface.php
More file actions
80 lines (73 loc) · 2.01 KB
/
Copy pathTableManagerInterface.php
File metadata and controls
80 lines (73 loc) · 2.01 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
namespace Bdf\Prime\Schema\Manager;
use Bdf\Prime\Exception\PrimeException;
use Bdf\Prime\Schema\TableInterface;
/**
* Handle table management in interactive way
*
* - The operations are done only on tables
* - All operations will results to a diff, an changes will be applied (or simulated)
*
* @extends DatabaseStructureManagerInterface<TableInterface>
*/
interface TableManagerInterface extends DatabaseStructureManagerInterface
{
/**
* Set the use drop flag
*
* @param bool $flag
*
* @return $this
*/
public function useDrop(bool $flag = true);
/**
* Get the use drop flag
*
* @return bool
*/
public function getUseDrop(): bool;
/**
* Create table or extract alteration on existing table.
*
* <code>
* $schemaManager->table('person', function (TypesHelperTableBuilder $table) {
* $table
* ->string('first_name')
* ->string('last_name')
* ->integer('age')
* ;
* });
* </code>
*
* @param string $tableName The name of the table
* @param callable(\Bdf\Prime\Schema\Builder\TypesHelperTableBuilder):void $callback The table build method
*
* @return $this
*
* @see \Bdf\Prime\Schema\Builder\TypesHelperTableBuilder
* @throws PrimeException
*/
public function table(string $tableName, callable $callback);
/**
* Add a table to the schema.
* - If the table do not exists, it'll be created
* - If the table exists, but differs, change the table
* - Else, do nothing
*
* @param TableInterface $structure
*
* @return $this
* @throws PrimeException
*/
public function add($structure);
/**
* Change table.
*
* @param string $tableName
* @param callable(\Bdf\Prime\Schema\Builder\TypesHelperTableBuilder):void $callback
*
* @return $this
* @throws PrimeException
*/
public function change(string $tableName, callable $callback);
}