Skip to content

Commit

Permalink
Merge branch 'master' into feature/full-text-search
Browse files Browse the repository at this point in the history
  • Loading branch information
taka-oyama authored Nov 8, 2024
2 parents f2b4449 + e60ce6b commit aebc7c2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# v8.3.0 (2024-09-02)

- add support for full text search (#231)
- add support for invisible columns (#240)
- add support for change streams using Blueprint (#230)
- add support for snapshot queries (#215)
- deprecate Connection::getDatabaseContext() and move logic to UseMutations::getMutationExecutor() (#227)
Expand Down
14 changes: 14 additions & 0 deletions src/Schema/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,20 @@ protected function typeTokenList(Fluent $column): string
return 'tokenlist as (' . $function->value . '(' . implode(', ', $args) . '))';
}

/**
* Get the SQL for an invisible column modifier.
*
* @param Blueprint $blueprint
* @param ColumnDefinition&object{ invisible: bool } $column
* @return string|null
*/
protected function modifyInvisible(Blueprint $blueprint, Fluent $column)
{
return $column->invisible !== null
? ' hidden'
: null;
}

/**
* @param Blueprint $blueprint
* @param IntColumnDefinition $column
Expand Down
24 changes: 24 additions & 0 deletions tests/Schema/BlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,30 @@ public function test_tokenList_and_search_index(): void
}
}

public function test_invisible_columns(): void
{
$conn = $this->getDefaultConnection();
$grammar = new Grammar();
$tableName = $this->generateTableName('Invisible');

$blueprint = new Blueprint($tableName, function (Blueprint $table) {
$table->create();
$table->integer('id')->primary();
$table->string('name')->nullable()->invisible();
});

$this->assertSame([
"create table `{$tableName}` (`id` int64 not null, `name` string(255) hidden) primary key (`id`)",
], $blueprint->toSql($conn, $grammar));

$blueprint->build($conn, $grammar);

$conn->table($tableName)->insert(['id' => 1, 'name' => 'test']);
$row = $conn->table($tableName)->first();
$this->assertArrayHasKey('id', $row);
$this->assertArrayNotHasKey('name', $row);
}

public function test_interleaving(): void
{
$conn = $this->getDefaultConnection();
Expand Down

0 comments on commit aebc7c2

Please sign in to comment.