ColumnSchemaBuilder.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\sqlite;
  8. use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder;
  9. /**
  10. * ColumnSchemaBuilder is the schema builder for Sqlite databases.
  11. *
  12. * @author Chris Harris <chris@buckshotsoftware.com>
  13. * @since 2.0.8
  14. */
  15. class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
  16. {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. protected function buildUnsignedString()
  21. {
  22. return $this->isUnsigned ? ' UNSIGNED' : '';
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function __toString()
  28. {
  29. switch ($this->getTypeCategory()) {
  30. case self::CATEGORY_PK:
  31. $format = '{type}{check}{append}';
  32. break;
  33. case self::CATEGORY_NUMERIC:
  34. $format = '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}';
  35. break;
  36. default:
  37. $format = '{type}{length}{notnull}{unique}{check}{default}{append}';
  38. }
  39. return $this->buildCompleteString($format);
  40. }
  41. }