You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1KB

  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. }