ISchemaWrapper.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\DB;
  7. use Doctrine\DBAL\Exception;
  8. use Doctrine\DBAL\Platforms\AbstractPlatform;
  9. /**
  10. * This interface allows to get information about the database schema.
  11. * This is particularly helpful for database migration scripts.
  12. *
  13. * This interface must not be implemented in your application but
  14. * instead can be obtained in your migration scripts with the
  15. * `$schemaClosure` Closure.
  16. *
  17. * @since 13.0.0
  18. */
  19. interface ISchemaWrapper {
  20. /**
  21. * @param string $tableName
  22. *
  23. * @return \Doctrine\DBAL\Schema\Table
  24. * @throws \Doctrine\DBAL\Schema\SchemaException
  25. * @since 13.0.0
  26. */
  27. public function getTable($tableName);
  28. /**
  29. * Does this schema have a table with the given name?
  30. *
  31. * @param string $tableName Prefix is automatically prepended
  32. *
  33. * @return boolean
  34. * @since 13.0.0
  35. */
  36. public function hasTable($tableName);
  37. /**
  38. * Creates a new table.
  39. *
  40. * @param string $tableName Prefix is automatically prepended
  41. * @return \Doctrine\DBAL\Schema\Table
  42. * @since 13.0.0
  43. */
  44. public function createTable($tableName);
  45. /**
  46. * Drops a table from the schema.
  47. *
  48. * @param string $tableName Prefix is automatically prepended
  49. * @return \Doctrine\DBAL\Schema\Schema
  50. * @since 13.0.0
  51. */
  52. public function dropTable($tableName);
  53. /**
  54. * Gets all tables of this schema.
  55. *
  56. * @return \Doctrine\DBAL\Schema\Table[]
  57. * @since 13.0.0
  58. */
  59. public function getTables();
  60. /**
  61. * Gets all table names, prefixed with table prefix
  62. *
  63. * @return array
  64. * @since 13.0.0
  65. */
  66. public function getTableNames();
  67. /**
  68. * Gets all table names
  69. *
  70. * @return array
  71. * @since 13.0.0
  72. */
  73. public function getTableNamesWithoutPrefix();
  74. /**
  75. * Gets the DatabasePlatform for the database.
  76. *
  77. * @return AbstractPlatform
  78. *
  79. * @throws Exception
  80. * @since 23.0.0
  81. */
  82. public function getDatabasePlatform();
  83. }