SchemaSynchronizer.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. * Get the SQL statements that can be executed to create the schema.
  31. *
  32. * @param Schema $createSchema
  33. * @return array
  34. */
  35. function getCreateSchema(Schema $createSchema);
  36. /**
  37. * Get the SQL Statements to update given schema with the underlying db.
  38. *
  39. * @param Schema $toSchema
  40. * @param bool $noDrops
  41. * @return array
  42. */
  43. function getUpdateSchema(Schema $toSchema, $noDrops = false);
  44. /**
  45. * Get the SQL Statements to drop the given schema from underlying db.
  46. *
  47. * @param Schema $dropSchema
  48. * @return array
  49. */
  50. function getDropSchema(Schema $dropSchema);
  51. /**
  52. * Get the SQL statements to drop all schema assets from underlying db.
  53. *
  54. * @return array
  55. */
  56. function getDropAllSchema();
  57. /**
  58. * Create the Schema
  59. *
  60. * @param Schema $createSchema
  61. * @return void
  62. */
  63. function createSchema(Schema $createSchema);
  64. /**
  65. * Update the Schema to new schema version.
  66. *
  67. * @param Schema $toSchema
  68. * @param bool $noDrops
  69. * @return void
  70. */
  71. function updateSchema(Schema $toSchema, $noDrops = false);
  72. /**
  73. * Drop the given database schema from the underlying db.
  74. *
  75. * @param Schema $dropSchema
  76. * @return void
  77. */
  78. function dropSchema(Schema $dropSchema);
  79. /**
  80. * Drop all assets from the underyling db.
  81. *
  82. * @return void
  83. */
  84. function dropAllSchema();
  85. }