File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1414 */
1515class Migration extends \yii \db \Migration
1616{
17+ use SchemaBuilderTrait;
1718
1819 public $ db = 'clickhouse ' ;
1920
Original file line number Diff line number Diff line change 1414 */
1515class Schema extends \yii \db \mysql \Schema
1616{
17+ /**
18+ * UUID columnd data type
19+ */
20+ const TYPE_UUID = 'UUID ' ;
21+
1722 public $ columnSchemaClass = 'bashkarev\clickhouse\ColumnSchema ' ;
1823
1924 /**
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace bashkarev \clickhouse ;
4+
5+ /**
6+ * Schema builder trait
7+ *
8+ * Provides some shortcuts for specific clickhouse data types and etc.
9+ *
10+ * @see \yii\db\SchemaBuilderTrait For better understanding about logic of this trait
11+ * @method \yii\db\Connection getDb()
12+ */
13+ trait SchemaBuilderTrait
14+ {
15+ /**
16+ * Creates an UUID column
17+ *
18+ * @return ColumnSchemaBuilder
19+ * @see https://clickhouse.tech/docs/en/sql-reference/data-types/uuid/ For more information about UUID columns
20+ */
21+ public function uuid (): ColumnSchemaBuilder
22+ {
23+ return $ this ->getDb ()->getSchema ()->createColumnSchemaBuilder (Schema::TYPE_UUID );
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments