1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * For full copyright and license information, please see the LICENSE.txt
8: * Redistributions of files must retain the above copyright notice.
9: *
10: * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11: * @link http://cakephp.org CakePHP(tm) Project
12: * @since 3.5.0
13: * @license http://www.opensource.org/licenses/mit-license.php MIT License
14: */
15: namespace Cake\Database\Schema;
16:
17: use Cake\Datasource\SchemaInterface;
18:
19: /**
20: * An interface used by database TableSchema objects.
21: *
22: * Deprecated 3.5.0: Use Cake\Database\TableSchemaAwareInterface instead.
23: */
24: interface TableSchemaInterface extends SchemaInterface
25: {
26:
27: /**
28: * Binary column type
29: *
30: * @var string
31: */
32: const TYPE_BINARY = 'binary';
33:
34: /**
35: * Binary UUID column type
36: *
37: * @var string
38: */
39: const TYPE_BINARY_UUID = 'binaryuuid';
40:
41: /**
42: * Date column type
43: *
44: * @var string
45: */
46: const TYPE_DATE = 'date';
47:
48: /**
49: * Datetime column type
50: *
51: * @var string
52: */
53: const TYPE_DATETIME = 'datetime';
54:
55: /**
56: * Time column type
57: *
58: * @var string
59: */
60: const TYPE_TIME = 'time';
61:
62: /**
63: * Timestamp column type
64: *
65: * @var string
66: */
67: const TYPE_TIMESTAMP = 'timestamp';
68:
69: /**
70: * JSON column type
71: *
72: * @var string
73: */
74: const TYPE_JSON = 'json';
75:
76: /**
77: * String column type
78: *
79: * @var string
80: */
81: const TYPE_STRING = 'string';
82:
83: /**
84: * Text column type
85: *
86: * @var string
87: */
88: const TYPE_TEXT = 'text';
89:
90: /**
91: * Tiny Integer column type
92: *
93: * @var string
94: */
95: const TYPE_TINYINTEGER = 'tinyinteger';
96:
97: /**
98: * Small Integer column type
99: *
100: * @var string
101: */
102: const TYPE_SMALLINTEGER = 'smallinteger';
103:
104: /**
105: * Integer column type
106: *
107: * @var string
108: */
109: const TYPE_INTEGER = 'integer';
110:
111: /**
112: * Big Integer column type
113: *
114: * @var string
115: */
116: const TYPE_BIGINTEGER = 'biginteger';
117:
118: /**
119: * Float column type
120: *
121: * @var string
122: */
123: const TYPE_FLOAT = 'float';
124:
125: /**
126: * Decimal column type
127: *
128: * @var string
129: */
130: const TYPE_DECIMAL = 'decimal';
131:
132: /**
133: * Boolean column type
134: *
135: * @var string
136: */
137: const TYPE_BOOLEAN = 'boolean';
138:
139: /**
140: * UUID column type
141: *
142: * @var string
143: */
144: const TYPE_UUID = 'uuid';
145:
146: /**
147: * Check whether or not a table has an autoIncrement column defined.
148: *
149: * @return bool
150: */
151: public function hasAutoincrement();
152:
153: /**
154: * Sets whether the table is temporary in the database.
155: *
156: * @param bool $temporary Whether or not the table is to be temporary.
157: * @return $this
158: */
159: public function setTemporary($temporary);
160:
161: /**
162: * Gets whether the table is temporary in the database.
163: *
164: * @return bool The current temporary setting.
165: */
166: public function isTemporary();
167:
168: /**
169: * Get the column(s) used for the primary key.
170: *
171: * @return array Column name(s) for the primary key. An
172: * empty list will be returned when the table has no primary key.
173: */
174: public function primaryKey();
175:
176: /**
177: * Add an index.
178: *
179: * Used to add indexes, and full text indexes in platforms that support
180: * them.
181: *
182: * ### Attributes
183: *
184: * - `type` The type of index being added.
185: * - `columns` The columns in the index.
186: *
187: * @param string $name The name of the index.
188: * @param array $attrs The attributes for the index.
189: * @return $this
190: */
191: public function addIndex($name, $attrs);
192:
193: /**
194: * Read information about an index based on name.
195: *
196: * @param string $name The name of the index.
197: * @return array|null Array of index data, or null
198: */
199: public function getIndex($name);
200:
201: /**
202: * Get the names of all the indexes in the table.
203: *
204: * @return string[]
205: */
206: public function indexes();
207:
208: /**
209: * Add a constraint.
210: *
211: * Used to add constraints to a table. For example primary keys, unique
212: * keys and foreign keys.
213: *
214: * ### Attributes
215: *
216: * - `type` The type of constraint being added.
217: * - `columns` The columns in the index.
218: * - `references` The table, column a foreign key references.
219: * - `update` The behavior on update. Options are 'restrict', 'setNull', 'cascade', 'noAction'.
220: * - `delete` The behavior on delete. Options are 'restrict', 'setNull', 'cascade', 'noAction'.
221: *
222: * The default for 'update' & 'delete' is 'cascade'.
223: *
224: * @param string $name The name of the constraint.
225: * @param array $attrs The attributes for the constraint.
226: * @return $this
227: */
228: public function addConstraint($name, $attrs);
229:
230: /**
231: * Read information about a constraint based on name.
232: *
233: * @param string $name The name of the constraint.
234: * @return array|null Array of constraint data, or null
235: */
236: public function getConstraint($name);
237:
238: /**
239: * Remove a constraint.
240: *
241: * @param string $name Name of the constraint to remove
242: * @return $this
243: */
244: public function dropConstraint($name);
245:
246: /**
247: * Get the names of all the constraints in the table.
248: *
249: * @return string[]
250: */
251: public function constraints();
252: }
253: