SchemaSynchronizer.php 1.5 KB
Newer Older
1 2
<?php

Michael Moravec's avatar
Michael Moravec committed
3 4
declare(strict_types=1);

5 6 7 8 9 10 11 12 13 14 15
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
16 17
     * Gets the SQL statements that can be executed to create the schema.
     *
18
     * @return array<int, string>
19
     */
20
    public function getCreateSchema(Schema $createSchema) : array;
21 22

    /**
Benjamin Morel's avatar
Benjamin Morel committed
23 24
     * Gets the SQL Statements to update given schema with the underlying db.
     *
25
     * @return array<int, string>
26
     */
27
    public function getUpdateSchema(Schema $toSchema, bool $noDrops = false) : array;
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) : array;
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 array<int, string>
40
     */
41
    public function getDropAllSchema() : array;
42 43

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

    /**
Benjamin Morel's avatar
Benjamin Morel committed
49
     * Updates the Schema to new schema version.
50
     */
51
    public function updateSchema(Schema $toSchema, bool $noDrops = false) : void;
52 53

    /**
Benjamin Morel's avatar
Benjamin Morel committed
54
     * Drops the given database schema from the underlying db.
55
     */
56
    public function dropSchema(Schema $dropSchema) : void;
57 58

    /**
Benjamin Morel's avatar
Benjamin Morel committed
59
     * Drops all assets from the underlying db.
60
     */
61
    public function dropAllSchema() : void;
62
}