3 namespace wcf\system\database\table\column
;
6 * Represents a column of a database table.
8 * @author Matthias Schmidt
9 * @copyright 2001-2019 WoltLab GmbH
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package WoltLabSuite\Core\System\Database\Table\Column
14 interface IDatabaseTableColumn
17 * Sets the default value of the column and returns the column.
19 * @param mixed $defaultValue
22 public function defaultValue($defaultValue);
25 * Marks the column to be dropped and returns the column.
29 public function drop();
32 * Returns the data used by `DatabaseEditor` to add the column to a table.
36 public function getData();
39 * Returns the default value of the column.
43 public function getDefaultValue();
46 * Returns the name of the column.
50 public function getName();
53 * Returns the new name of the column or `null` if the column's name is unchanged.
57 public function getNewName(): ?
string;
60 * Returns the type of the column.
64 public function getType();
67 * Returns `true` if the values of the column cannot be `null`.
71 public function isNotNull();
74 * Sets the name of the column and returns the column.
79 public function name($name);
82 * Sets if the values of the column cannot be `null`.
84 * @param bool $notNull
87 public function notNull($notNull = true);
90 * Sets the new name of the column and returns the column.
94 public function renameTo(string $newName): self
;
97 * Returns `true` if the column will be dropped.
101 public function willBeDropped();
104 * Returns a `DatabaseTableColumn` object with the given name.
106 * @param string $name
109 public static function create($name);
112 * Returns a `DatabaseTableColumn` object with the given name and data.
114 * @param string $name
115 * @param array $data data returned by `DatabaseEditor::getColumns()`
118 public static function createFromData($name, array $data);