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
3namespace Wikimedia\Rdbms;
4
5/**
6 * Interface SchemaBuilder that gets a definition and produces SQL based on RDBMS
7 *
8 * @experimental
9 * @unstable
10 */
11interface SchemaBuilder {
12
13    /**
14     * An example of $schema value:
15     * [
16     * 'name' => 'actor',
17     * 'columns' => [
18     *     [ 'actor_id', 'bigint', [ 'Unsigned' => true, 'Notnull' => true ] ],
19     *     [ 'actor_user', 'integer', [ 'Unsigned' => true ] ],
20     *     [ 'actor_name', 'string', [ 'Length' => 255, 'Notnull' => true ] ],
21     * ],
22     * 'indexes' => [
23     *     [ 'actor_user', [ 'actor_user' ], 'unique' => true ],
24     *     [ 'actor_name', [ 'actor_name' ], 'unique' => true ]
25     *  ],
26     * 'pk' => [ 'actor_id' ]
27     * ],
28     * @param array $schema
29     * @return void
30     */
31    public function addTable( array $schema );
32
33    /**
34     * @return string[] SQLs to run
35     */
36    public function getSql();
37}