TableSchema.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Database\Schema;
  16. use Cake\Database\Connection;
  17. use Cake\Database\Exception;
  18. use Cake\Database\Type;
  19. /**
  20. * Represents a single table in a database schema.
  21. *
  22. * Can either be populated using the reflection API's
  23. * or by incrementally building an instance using
  24. * methods.
  25. *
  26. * Once created TableSchema instances can be added to
  27. * Schema\Collection objects. They can also be converted into SQL using the
  28. * createSql(), dropSql() and truncateSql() methods.
  29. */
  30. class TableSchema implements TableSchemaInterface, SqlGeneratorInterface
  31. {
  32. /**
  33. * The name of the table
  34. *
  35. * @var string
  36. */
  37. protected $_table;
  38. /**
  39. * Columns in the table.
  40. *
  41. * @var array
  42. */
  43. protected $_columns = [];
  44. /**
  45. * A map with columns to types
  46. *
  47. * @var array
  48. */
  49. protected $_typeMap = [];
  50. /**
  51. * Indexes in the table.
  52. *
  53. * @var array
  54. */
  55. protected $_indexes = [];
  56. /**
  57. * Constraints in the table.
  58. *
  59. * @var array
  60. */
  61. protected $_constraints = [];
  62. /**
  63. * Options for the table.
  64. *
  65. * @var array
  66. */
  67. protected $_options = [];
  68. /**
  69. * Whether or not the table is temporary
  70. *
  71. * @var bool
  72. */
  73. protected $_temporary = false;
  74. /**
  75. * Column length when using a `tiny` column type
  76. *
  77. * @var int
  78. */
  79. const LENGTH_TINY = 255;
  80. /**
  81. * Column length when using a `medium` column type
  82. *
  83. * @var int
  84. */
  85. const LENGTH_MEDIUM = 16777215;
  86. /**
  87. * Column length when using a `long` column type
  88. *
  89. * @var int
  90. */
  91. const LENGTH_LONG = 4294967295;
  92. /**
  93. * Valid column length that can be used with text type columns
  94. *
  95. * @var array
  96. */
  97. public static $columnLengths = [
  98. 'tiny' => self::LENGTH_TINY,
  99. 'medium' => self::LENGTH_MEDIUM,
  100. 'long' => self::LENGTH_LONG
  101. ];
  102. /**
  103. * The valid keys that can be used in a column
  104. * definition.
  105. *
  106. * @var array
  107. */
  108. protected static $_columnKeys = [
  109. 'type' => null,
  110. 'baseType' => null,
  111. 'length' => null,
  112. 'precision' => null,
  113. 'null' => null,
  114. 'default' => null,
  115. 'comment' => null,
  116. ];
  117. /**
  118. * Additional type specific properties.
  119. *
  120. * @var array
  121. */
  122. protected static $_columnExtras = [
  123. 'string' => [
  124. 'fixed' => null,
  125. 'collate' => null,
  126. ],
  127. 'text' => [
  128. 'collate' => null,
  129. ],
  130. 'tinyinteger' => [
  131. 'unsigned' => null,
  132. ],
  133. 'smallinteger' => [
  134. 'unsigned' => null,
  135. ],
  136. 'integer' => [
  137. 'unsigned' => null,
  138. 'autoIncrement' => null,
  139. ],
  140. 'biginteger' => [
  141. 'unsigned' => null,
  142. 'autoIncrement' => null,
  143. ],
  144. 'decimal' => [
  145. 'unsigned' => null,
  146. ],
  147. 'float' => [
  148. 'unsigned' => null,
  149. ],
  150. ];
  151. /**
  152. * The valid keys that can be used in an index
  153. * definition.
  154. *
  155. * @var array
  156. */
  157. protected static $_indexKeys = [
  158. 'type' => null,
  159. 'columns' => [],
  160. 'length' => [],
  161. 'references' => [],
  162. 'update' => 'restrict',
  163. 'delete' => 'restrict',
  164. ];
  165. /**
  166. * Names of the valid index types.
  167. *
  168. * @var array
  169. */
  170. protected static $_validIndexTypes = [
  171. self::INDEX_INDEX,
  172. self::INDEX_FULLTEXT,
  173. ];
  174. /**
  175. * Names of the valid constraint types.
  176. *
  177. * @var array
  178. */
  179. protected static $_validConstraintTypes = [
  180. self::CONSTRAINT_PRIMARY,
  181. self::CONSTRAINT_UNIQUE,
  182. self::CONSTRAINT_FOREIGN,
  183. ];
  184. /**
  185. * Names of the valid foreign key actions.
  186. *
  187. * @var array
  188. */
  189. protected static $_validForeignKeyActions = [
  190. self::ACTION_CASCADE,
  191. self::ACTION_SET_NULL,
  192. self::ACTION_SET_DEFAULT,
  193. self::ACTION_NO_ACTION,
  194. self::ACTION_RESTRICT,
  195. ];
  196. /**
  197. * Primary constraint type
  198. *
  199. * @var string
  200. */
  201. const CONSTRAINT_PRIMARY = 'primary';
  202. /**
  203. * Unique constraint type
  204. *
  205. * @var string
  206. */
  207. const CONSTRAINT_UNIQUE = 'unique';
  208. /**
  209. * Foreign constraint type
  210. *
  211. * @var string
  212. */
  213. const CONSTRAINT_FOREIGN = 'foreign';
  214. /**
  215. * Index - index type
  216. *
  217. * @var string
  218. */
  219. const INDEX_INDEX = 'index';
  220. /**
  221. * Fulltext index type
  222. *
  223. * @var string
  224. */
  225. const INDEX_FULLTEXT = 'fulltext';
  226. /**
  227. * Foreign key cascade action
  228. *
  229. * @var string
  230. */
  231. const ACTION_CASCADE = 'cascade';
  232. /**
  233. * Foreign key set null action
  234. *
  235. * @var string
  236. */
  237. const ACTION_SET_NULL = 'setNull';
  238. /**
  239. * Foreign key no action
  240. *
  241. * @var string
  242. */
  243. const ACTION_NO_ACTION = 'noAction';
  244. /**
  245. * Foreign key restrict action
  246. *
  247. * @var string
  248. */
  249. const ACTION_RESTRICT = 'restrict';
  250. /**
  251. * Foreign key restrict default
  252. *
  253. * @var string
  254. */
  255. const ACTION_SET_DEFAULT = 'setDefault';
  256. /**
  257. * Constructor.
  258. *
  259. * @param string $table The table name.
  260. * @param array $columns The list of columns for the schema.
  261. */
  262. public function __construct($table, array $columns = [])
  263. {
  264. $this->_table = $table;
  265. foreach ($columns as $field => $definition) {
  266. $this->addColumn($field, $definition);
  267. }
  268. }
  269. /**
  270. * {@inheritDoc}
  271. */
  272. public function name()
  273. {
  274. return $this->_table;
  275. }
  276. /**
  277. * {@inheritDoc}
  278. */
  279. public function addColumn($name, $attrs)
  280. {
  281. if (is_string($attrs)) {
  282. $attrs = ['type' => $attrs];
  283. }
  284. $valid = static::$_columnKeys;
  285. if (isset(static::$_columnExtras[$attrs['type']])) {
  286. $valid += static::$_columnExtras[$attrs['type']];
  287. }
  288. $attrs = array_intersect_key($attrs, $valid);
  289. $this->_columns[$name] = $attrs + $valid;
  290. $this->_typeMap[$name] = $this->_columns[$name]['type'];
  291. return $this;
  292. }
  293. /**
  294. * {@inheritDoc}
  295. */
  296. public function removeColumn($name)
  297. {
  298. unset($this->_columns[$name], $this->_typeMap[$name]);
  299. return $this;
  300. }
  301. /**
  302. * {@inheritDoc}
  303. */
  304. public function columns()
  305. {
  306. return array_keys($this->_columns);
  307. }
  308. /**
  309. * Get column data in the table.
  310. *
  311. * @param string $name The column name.
  312. * @return array|null Column data or null.
  313. * @deprecated 3.5.0 Use getColumn() instead.
  314. */
  315. public function column($name)
  316. {
  317. deprecationWarning('TableSchema::column() is deprecated. Use TableSchema::getColumn() instead.');
  318. return $this->getColumn($name);
  319. }
  320. /**
  321. * {@inheritDoc}
  322. */
  323. public function getColumn($name)
  324. {
  325. if (!isset($this->_columns[$name])) {
  326. return null;
  327. }
  328. $column = $this->_columns[$name];
  329. unset($column['baseType']);
  330. return $column;
  331. }
  332. /**
  333. * Sets the type of a column, or returns its current type
  334. * if none is passed.
  335. *
  336. * @param string $name The column to get the type of.
  337. * @param string|null $type The type to set the column to.
  338. * @return string|null Either the column type or null.
  339. * @deprecated 3.5.0 Use setColumnType()/getColumnType() instead.
  340. */
  341. public function columnType($name, $type = null)
  342. {
  343. deprecationWarning('TableSchema::columnType() is deprecated. Use TableSchema::setColumnType() or TableSchema::getColumnType() instead.');
  344. if ($type !== null) {
  345. $this->setColumnType($name, $type);
  346. }
  347. return $this->getColumnType($name);
  348. }
  349. /**
  350. * {@inheritDoc}
  351. */
  352. public function getColumnType($name)
  353. {
  354. if (!isset($this->_columns[$name])) {
  355. return null;
  356. }
  357. return $this->_columns[$name]['type'];
  358. }
  359. /**
  360. * {@inheritDoc}
  361. */
  362. public function setColumnType($name, $type)
  363. {
  364. if (!isset($this->_columns[$name])) {
  365. return $this;
  366. }
  367. $this->_columns[$name]['type'] = $type;
  368. $this->_typeMap[$name] = $type;
  369. return $this;
  370. }
  371. /**
  372. * {@inheritDoc}
  373. */
  374. public function hasColumn($name)
  375. {
  376. return isset($this->_columns[$name]);
  377. }
  378. /**
  379. * {@inheritDoc}
  380. */
  381. public function baseColumnType($column)
  382. {
  383. if (isset($this->_columns[$column]['baseType'])) {
  384. return $this->_columns[$column]['baseType'];
  385. }
  386. $type = $this->getColumnType($column);
  387. if ($type === null) {
  388. return null;
  389. }
  390. if (Type::getMap($type)) {
  391. $type = Type::build($type)->getBaseType();
  392. }
  393. return $this->_columns[$column]['baseType'] = $type;
  394. }
  395. /**
  396. * {@inheritDoc}
  397. */
  398. public function typeMap()
  399. {
  400. return $this->_typeMap;
  401. }
  402. /**
  403. * {@inheritDoc}
  404. */
  405. public function isNullable($name)
  406. {
  407. if (!isset($this->_columns[$name])) {
  408. return true;
  409. }
  410. return ($this->_columns[$name]['null'] === true);
  411. }
  412. /**
  413. * {@inheritDoc}
  414. */
  415. public function defaultValues()
  416. {
  417. $defaults = [];
  418. foreach ($this->_columns as $name => $data) {
  419. if (!array_key_exists('default', $data)) {
  420. continue;
  421. }
  422. if ($data['default'] === null && $data['null'] !== true) {
  423. continue;
  424. }
  425. $defaults[$name] = $data['default'];
  426. }
  427. return $defaults;
  428. }
  429. /**
  430. * {@inheritDoc}
  431. * @throws \Cake\Database\Exception
  432. */
  433. public function addIndex($name, $attrs)
  434. {
  435. if (is_string($attrs)) {
  436. $attrs = ['type' => $attrs];
  437. }
  438. $attrs = array_intersect_key($attrs, static::$_indexKeys);
  439. $attrs += static::$_indexKeys;
  440. unset($attrs['references'], $attrs['update'], $attrs['delete']);
  441. if (!in_array($attrs['type'], static::$_validIndexTypes, true)) {
  442. throw new Exception(sprintf('Invalid index type "%s" in index "%s" in table "%s".', $attrs['type'], $name, $this->_table));
  443. }
  444. if (empty($attrs['columns'])) {
  445. throw new Exception(sprintf('Index "%s" in table "%s" must have at least one column.', $name, $this->_table));
  446. }
  447. $attrs['columns'] = (array)$attrs['columns'];
  448. foreach ($attrs['columns'] as $field) {
  449. if (empty($this->_columns[$field])) {
  450. $msg = sprintf(
  451. 'Columns used in index "%s" in table "%s" must be added to the Table schema first. ' .
  452. 'The column "%s" was not found.',
  453. $name,
  454. $this->_table,
  455. $field
  456. );
  457. throw new Exception($msg);
  458. }
  459. }
  460. $this->_indexes[$name] = $attrs;
  461. return $this;
  462. }
  463. /**
  464. * {@inheritDoc}
  465. */
  466. public function indexes()
  467. {
  468. return array_keys($this->_indexes);
  469. }
  470. /**
  471. * Read information about an index based on name.
  472. *
  473. * @param string $name The name of the index.
  474. * @return array|null Array of index data, or null
  475. * @deprecated 3.5.0 Use getIndex() instead.
  476. */
  477. public function index($name)
  478. {
  479. deprecationWarning('TableSchema::index() is deprecated. Use TableSchema::getIndex() instead.');
  480. return $this->getIndex($name);
  481. }
  482. /**
  483. * {@inheritDoc}
  484. */
  485. public function getIndex($name)
  486. {
  487. if (!isset($this->_indexes[$name])) {
  488. return null;
  489. }
  490. return $this->_indexes[$name];
  491. }
  492. /**
  493. * {@inheritDoc}
  494. */
  495. public function primaryKey()
  496. {
  497. foreach ($this->_constraints as $name => $data) {
  498. if ($data['type'] === static::CONSTRAINT_PRIMARY) {
  499. return $data['columns'];
  500. }
  501. }
  502. return [];
  503. }
  504. /**
  505. * {@inheritDoc}
  506. * @throws \Cake\Database\Exception
  507. */
  508. public function addConstraint($name, $attrs)
  509. {
  510. if (is_string($attrs)) {
  511. $attrs = ['type' => $attrs];
  512. }
  513. $attrs = array_intersect_key($attrs, static::$_indexKeys);
  514. $attrs += static::$_indexKeys;
  515. if (!in_array($attrs['type'], static::$_validConstraintTypes, true)) {
  516. throw new Exception(sprintf('Invalid constraint type "%s" in table "%s".', $attrs['type'], $this->_table));
  517. }
  518. if (empty($attrs['columns'])) {
  519. throw new Exception(sprintf('Constraints in table "%s" must have at least one column.', $this->_table));
  520. }
  521. $attrs['columns'] = (array)$attrs['columns'];
  522. foreach ($attrs['columns'] as $field) {
  523. if (empty($this->_columns[$field])) {
  524. $msg = sprintf(
  525. 'Columns used in constraints must be added to the Table schema first. ' .
  526. 'The column "%s" was not found in table "%s".',
  527. $field,
  528. $this->_table
  529. );
  530. throw new Exception($msg);
  531. }
  532. }
  533. if ($attrs['type'] === static::CONSTRAINT_FOREIGN) {
  534. $attrs = $this->_checkForeignKey($attrs);
  535. if (isset($this->_constraints[$name])) {
  536. $this->_constraints[$name]['columns'] = array_unique(array_merge(
  537. $this->_constraints[$name]['columns'],
  538. $attrs['columns']
  539. ));
  540. if (isset($this->_constraints[$name]['references'])) {
  541. $this->_constraints[$name]['references'][1] = array_unique(array_merge(
  542. (array)$this->_constraints[$name]['references'][1],
  543. [$attrs['references'][1]]
  544. ));
  545. }
  546. return $this;
  547. }
  548. } else {
  549. unset($attrs['references'], $attrs['update'], $attrs['delete']);
  550. }
  551. $this->_constraints[$name] = $attrs;
  552. return $this;
  553. }
  554. /**
  555. * {@inheritDoc}
  556. */
  557. public function dropConstraint($name)
  558. {
  559. if (isset($this->_constraints[$name])) {
  560. unset($this->_constraints[$name]);
  561. }
  562. return $this;
  563. }
  564. /**
  565. * Check whether or not a table has an autoIncrement column defined.
  566. *
  567. * @return bool
  568. */
  569. public function hasAutoincrement()
  570. {
  571. foreach ($this->_columns as $column) {
  572. if (isset($column['autoIncrement']) && $column['autoIncrement']) {
  573. return true;
  574. }
  575. }
  576. return false;
  577. }
  578. /**
  579. * Helper method to check/validate foreign keys.
  580. *
  581. * @param array $attrs Attributes to set.
  582. * @return array
  583. * @throws \Cake\Database\Exception When foreign key definition is not valid.
  584. */
  585. protected function _checkForeignKey($attrs)
  586. {
  587. if (count($attrs['references']) < 2) {
  588. throw new Exception('References must contain a table and column.');
  589. }
  590. if (!in_array($attrs['update'], static::$_validForeignKeyActions)) {
  591. throw new Exception(sprintf('Update action is invalid. Must be one of %s', implode(',', static::$_validForeignKeyActions)));
  592. }
  593. if (!in_array($attrs['delete'], static::$_validForeignKeyActions)) {
  594. throw new Exception(sprintf('Delete action is invalid. Must be one of %s', implode(',', static::$_validForeignKeyActions)));
  595. }
  596. return $attrs;
  597. }
  598. /**
  599. * {@inheritDoc}
  600. */
  601. public function constraints()
  602. {
  603. return array_keys($this->_constraints);
  604. }
  605. /**
  606. * Read information about a constraint based on name.
  607. *
  608. * @param string $name The name of the constraint.
  609. * @return array|null Array of constraint data, or null
  610. * @deprecated 3.5.0 Use getConstraint() instead.
  611. */
  612. public function constraint($name)
  613. {
  614. deprecationWarning('TableSchema::constraint() is deprecated. Use TableSchema::getConstraint() instead.');
  615. return $this->getConstraint($name);
  616. }
  617. /**
  618. * {@inheritDoc}
  619. */
  620. public function getConstraint($name)
  621. {
  622. if (!isset($this->_constraints[$name])) {
  623. return null;
  624. }
  625. return $this->_constraints[$name];
  626. }
  627. /**
  628. * {@inheritDoc}
  629. */
  630. public function setOptions($options)
  631. {
  632. $this->_options = array_merge($this->_options, $options);
  633. return $this;
  634. }
  635. /**
  636. * {@inheritDoc}
  637. */
  638. public function getOptions()
  639. {
  640. return $this->_options;
  641. }
  642. /**
  643. * Get/set the options for a table.
  644. *
  645. * Table options allow you to set platform specific table level options.
  646. * For example the engine type in MySQL.
  647. *
  648. * @deprecated 3.4.0 Use setOptions()/getOptions() instead.
  649. * @param array|null $options The options to set, or null to read options.
  650. * @return $this|array Either the TableSchema instance, or an array of options when reading.
  651. */
  652. public function options($options = null)
  653. {
  654. deprecationWarning('TableSchema::options() is deprecated. Use TableSchema::setOptions() or TableSchema::getOptions() instead.');
  655. if ($options !== null) {
  656. return $this->setOptions($options);
  657. }
  658. return $this->getOptions();
  659. }
  660. /**
  661. * {@inheritDoc}
  662. */
  663. public function setTemporary($temporary)
  664. {
  665. $this->_temporary = (bool)$temporary;
  666. return $this;
  667. }
  668. /**
  669. * {@inheritDoc}
  670. */
  671. public function isTemporary()
  672. {
  673. return $this->_temporary;
  674. }
  675. /**
  676. * Get/Set whether the table is temporary in the database
  677. *
  678. * @deprecated 3.4.0 Use setTemporary()/isTemporary() instead.
  679. * @param bool|null $temporary whether or not the table is to be temporary
  680. * @return $this|bool Either the TableSchema instance, the current temporary setting
  681. */
  682. public function temporary($temporary = null)
  683. {
  684. deprecationWarning(
  685. 'TableSchema::temporary() is deprecated. ' .
  686. 'Use TableSchema::setTemporary()/isTemporary() instead.'
  687. );
  688. if ($temporary !== null) {
  689. return $this->setTemporary($temporary);
  690. }
  691. return $this->isTemporary();
  692. }
  693. /**
  694. * {@inheritDoc}
  695. */
  696. public function createSql(Connection $connection)
  697. {
  698. $dialect = $connection->getDriver()->schemaDialect();
  699. $columns = $constraints = $indexes = [];
  700. foreach (array_keys($this->_columns) as $name) {
  701. $columns[] = $dialect->columnSql($this, $name);
  702. }
  703. foreach (array_keys($this->_constraints) as $name) {
  704. $constraints[] = $dialect->constraintSql($this, $name);
  705. }
  706. foreach (array_keys($this->_indexes) as $name) {
  707. $indexes[] = $dialect->indexSql($this, $name);
  708. }
  709. return $dialect->createTableSql($this, $columns, $constraints, $indexes);
  710. }
  711. /**
  712. * {@inheritDoc}
  713. */
  714. public function dropSql(Connection $connection)
  715. {
  716. $dialect = $connection->getDriver()->schemaDialect();
  717. return $dialect->dropTableSql($this);
  718. }
  719. /**
  720. * {@inheritDoc}
  721. */
  722. public function truncateSql(Connection $connection)
  723. {
  724. $dialect = $connection->getDriver()->schemaDialect();
  725. return $dialect->truncateTableSql($this);
  726. }
  727. /**
  728. * {@inheritDoc}
  729. */
  730. public function addConstraintSql(Connection $connection)
  731. {
  732. $dialect = $connection->getDriver()->schemaDialect();
  733. return $dialect->addConstraintSql($this);
  734. }
  735. /**
  736. * {@inheritDoc}
  737. */
  738. public function dropConstraintSql(Connection $connection)
  739. {
  740. $dialect = $connection->getDriver()->schemaDialect();
  741. return $dialect->dropConstraintSql($this);
  742. }
  743. /**
  744. * Returns an array of the table schema.
  745. *
  746. * @return array
  747. */
  748. public function __debugInfo()
  749. {
  750. return [
  751. 'table' => $this->_table,
  752. 'columns' => $this->_columns,
  753. 'indexes' => $this->_indexes,
  754. 'constraints' => $this->_constraints,
  755. 'options' => $this->_options,
  756. 'typeMap' => $this->_typeMap,
  757. 'temporary' => $this->_temporary,
  758. ];
  759. }
  760. }
  761. // @deprecated 3.4.0 Add backwards compat alias.
  762. class_alias('Cake\Database\Schema\TableSchema', 'Cake\Database\Schema\Table');