SchemaSynchronizer.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\DBAL\Schema\Synchronizer;
  20. use Doctrine\DBAL\Schema\Schema;
  21. /**
  22. * The synchronizer knows how to synchronize a schema with the configured
  23. * database.
  24. *
  25. * @author Benjamin Eberlei <kontakt@beberlei.de>
  26. */
  27. interface SchemaSynchronizer
  28. {
  29. /**
  30. * Gets the SQL statements that can be executed to create the schema.
  31. *
  32. * @param \Doctrine\DBAL\Schema\Schema $createSchema
  33. *
  34. * @return array
  35. */
  36. function getCreateSchema(Schema $createSchema);
  37. /**
  38. * Gets the SQL Statements to update given schema with the underlying db.
  39. *
  40. * @param \Doctrine\DBAL\Schema\Schema $toSchema
  41. * @param boolean $noDrops
  42. *
  43. * @return array
  44. */
  45. function getUpdateSchema(Schema $toSchema, $noDrops = false);
  46. /**
  47. * Gets the SQL Statements to drop the given schema from underlying db.
  48. *
  49. * @param \Doctrine\DBAL\Schema\Schema $dropSchema
  50. *
  51. * @return array
  52. */
  53. function getDropSchema(Schema $dropSchema);
  54. /**
  55. * Gets the SQL statements to drop all schema assets from underlying db.
  56. *
  57. * @return array
  58. */
  59. function getDropAllSchema();
  60. /**
  61. * Creates the Schema.
  62. *
  63. * @param \Doctrine\DBAL\Schema\Schema $createSchema
  64. *
  65. * @return void
  66. */
  67. function createSchema(Schema $createSchema);
  68. /**
  69. * Updates the Schema to new schema version.
  70. *
  71. * @param \Doctrine\DBAL\Schema\Schema $toSchema
  72. * @param boolean $noDrops
  73. *
  74. * @return void
  75. */
  76. function updateSchema(Schema $toSchema, $noDrops = false);
  77. /**
  78. * Drops the given database schema from the underlying db.
  79. *
  80. * @param \Doctrine\DBAL\Schema\Schema $dropSchema
  81. *
  82. * @return void
  83. */
  84. function dropSchema(Schema $dropSchema);
  85. /**
  86. * Drops all assets from the underlying db.
  87. *
  88. * @return void
  89. */
  90. function dropAllSchema();
  91. }