SchemaSynchronizer.php 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
<?php

namespace Doctrine\DBAL\Schema\Synchronizer;

use Doctrine\DBAL\Schema\Schema;

/**
 * The synchronizer knows how to synchronize a schema with the configured
 * database.
 */
interface SchemaSynchronizer
{
    /**
Benjamin Morel's avatar
Benjamin Morel committed
14 15
     * Gets the SQL statements that can be executed to create the schema.
     *
16
     * @return string[]
17
     */
18
    public function getCreateSchema(Schema $createSchema);
19 20

    /**
Benjamin Morel's avatar
Benjamin Morel committed
21 22
     * Gets the SQL Statements to update given schema with the underlying db.
     *
23
     * @param bool $noDrops
24
     *
25
     * @return string[]
26
     */
27
    public function getUpdateSchema(Schema $toSchema, $noDrops = false);
28 29

    /**
Benjamin Morel's avatar
Benjamin Morel committed
30 31
     * Gets the SQL Statements to drop the given schema from underlying db.
     *
32
     * @return string[]
33
     */
34
    public function getDropSchema(Schema $dropSchema);
35 36

    /**
Benjamin Morel's avatar
Benjamin Morel committed
37
     * Gets the SQL statements to drop all schema assets from underlying db.
38
     *
39
     * @return string[]
40
     */
41
    public function getDropAllSchema();
42 43

    /**
Benjamin Morel's avatar
Benjamin Morel committed
44 45
     * Creates the Schema.
     *
46 47
     * @return void
     */
48
    public function createSchema(Schema $createSchema);
49 50

    /**
Benjamin Morel's avatar
Benjamin Morel committed
51 52
     * Updates the Schema to new schema version.
     *
53
     * @param bool $noDrops
54 55 56
     *
     * @return void
     */
57
    public function updateSchema(Schema $toSchema, $noDrops = false);
58 59

    /**
Benjamin Morel's avatar
Benjamin Morel committed
60 61
     * Drops the given database schema from the underlying db.
     *
62 63
     * @return void
     */
64
    public function dropSchema(Schema $dropSchema);
65 66

    /**
Benjamin Morel's avatar
Benjamin Morel committed
67
     * Drops all assets from the underlying db.
68 69 70
     *
     * @return void
     */
71
    public function dropAllSchema();
72
}