ColumnSchemaBuilder.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\db\oci;
  8. use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder;
  9. /**
  10. * ColumnSchemaBuilder is the schema builder for Oracle databases.
  11. *
  12. * @author Vasenin Matvey <vaseninm@gmail.com>
  13. * @author Chris Harris <chris@buckshotsoftware.com>
  14. * @since 2.0.6
  15. */
  16. class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. protected function buildUnsignedString()
  22. {
  23. return $this->isUnsigned ? ' UNSIGNED' : '';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function __toString()
  29. {
  30. switch ($this->getTypeCategory()) {
  31. case self::CATEGORY_PK:
  32. $format = '{type}{length}{check}{append}';
  33. break;
  34. case self::CATEGORY_NUMERIC:
  35. $format = '{type}{length}{unsigned}{default}{notnull}{check}{append}';
  36. break;
  37. default:
  38. $format = '{type}{length}{default}{notnull}{check}{append}';
  39. }
  40. return $this->buildCompleteString($format);
  41. }
  42. }