Просмотр файла vendor/robmorgan/phinx/src/Phinx/Db/Adapter/DirectActionInterface.php

Размер файла: 4.03Kb
  1. <?php
  2.  
  3. /**
  4. * MIT License
  5. * For full license information, please view the LICENSE file that was distributed with this source code.
  6. */
  7.  
  8. namespace Phinx\Db\Adapter;
  9.  
  10. use Phinx\Db\Table\Column;
  11. use Phinx\Db\Table\ForeignKey;
  12. use Phinx\Db\Table\Index;
  13. use Phinx\Db\Table\Table;
  14.  
  15. /**
  16. * Represents an adapter that is capable of directly executing alter
  17. * instructions, without having to plan them first.
  18. */
  19. interface DirectActionInterface
  20. {
  21. /**
  22. * Renames the specified database table.
  23. *
  24. * @param string $tableName Table name
  25. * @param string $newName New Name
  26. *
  27. * @return void
  28. */
  29. public function renameTable($tableName, $newName);
  30.  
  31. /**
  32. * Drops the specified database table.
  33. *
  34. * @param string $tableName Table name
  35. *
  36. * @return void
  37. */
  38. public function dropTable($tableName);
  39.  
  40. /**
  41. * Changes the primary key of the specified database table.
  42. *
  43. * @param \Phinx\Db\Table\Table $table Table
  44. * @param string|string[]|null $newColumns Column name(s) to belong to the primary key, or null to drop the key
  45. *
  46. * @return void
  47. */
  48. public function changePrimaryKey(Table $table, $newColumns);
  49.  
  50. /**
  51. * Changes the comment of the specified database table.
  52. *
  53. * @param \Phinx\Db\Table\Table $table Table
  54. * @param string|null $newComment New comment string, or null to drop the comment
  55. *
  56. * @return void
  57. */
  58. public function changeComment(Table $table, $newComment);
  59.  
  60. /**
  61. * Adds the specified column to a database table.
  62. *
  63. * @param \Phinx\Db\Table\Table $table Table
  64. * @param \Phinx\Db\Table\Column $column Column
  65. *
  66. * @return void
  67. */
  68. public function addColumn(Table $table, Column $column);
  69.  
  70. /**
  71. * Renames the specified column.
  72. *
  73. * @param string $tableName Table name
  74. * @param string $columnName Column Name
  75. * @param string $newColumnName New Column Name
  76. *
  77. * @return void
  78. */
  79. public function renameColumn($tableName, $columnName, $newColumnName);
  80.  
  81. /**
  82. * Change a table column type.
  83. *
  84. * @param string $tableName Table name
  85. * @param string $columnName Column Name
  86. * @param \Phinx\Db\Table\Column $newColumn New Column
  87. *
  88. * @return void
  89. */
  90. public function changeColumn($tableName, $columnName, Column $newColumn);
  91.  
  92. /**
  93. * Drops the specified column.
  94. *
  95. * @param string $tableName Table name
  96. * @param string $columnName Column Name
  97. *
  98. * @return void
  99. */
  100. public function dropColumn($tableName, $columnName);
  101.  
  102. /**
  103. * Adds the specified index to a database table.
  104. *
  105. * @param \Phinx\Db\Table\Table $table Table
  106. * @param \Phinx\Db\Table\Index $index Index
  107. *
  108. * @return void
  109. */
  110. public function addIndex(Table $table, Index $index);
  111.  
  112. /**
  113. * Drops the specified index from a database table.
  114. *
  115. * @param string $tableName the name of the table
  116. * @param mixed $columns Column(s)
  117. *
  118. * @return void
  119. */
  120. public function dropIndex($tableName, $columns);
  121.  
  122. /**
  123. * Drops the index specified by name from a database table.
  124. *
  125. * @param string $tableName The table name where the index is
  126. * @param string $indexName The name of the index
  127. *
  128. * @return void
  129. */
  130. public function dropIndexByName($tableName, $indexName);
  131.  
  132. /**
  133. * Adds the specified foreign key to a database table.
  134. *
  135. * @param \Phinx\Db\Table\Table $table The table to add the foreign key to
  136. * @param \Phinx\Db\Table\ForeignKey $foreignKey The foreign key to add
  137. *
  138. * @return void
  139. */
  140. public function addForeignKey(Table $table, ForeignKey $foreignKey);
  141.  
  142. /**
  143. * Drops the specified foreign key from a database table.
  144. *
  145. * @param string $tableName The table to drop the foreign key from
  146. * @param string[] $columns Column(s)
  147. * @param string|null $constraint Constraint name
  148. *
  149. * @return void
  150. */
  151. public function dropForeignKey($tableName, $columns, $constraint = null);
  152. }