Skip to content

Commit

Permalink
[10.x] Include system versioned tables for MariaDB (#49509)
Browse files Browse the repository at this point in the history
* include system versioned tables for mariadb

* fix tests

* wip
  • Loading branch information
hafezdivandari authored Dec 28, 2023
1 parent 0f1df95 commit ac960a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function compileTables($database)
return sprintf(
'select table_name as `name`, (data_length + index_length) as `size`, '
.'table_comment as `comment`, engine as `engine`, table_collation as `collation` '
."from information_schema.tables where table_schema = %s and table_type = 'BASE TABLE' "
."from information_schema.tables where table_schema = %s and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') "
.'order by table_name',
$this->quoteString($database)
);
Expand Down
17 changes: 17 additions & 0 deletions tests/Integration/Database/SchemaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,21 @@ public function testGetCompoundForeignKeys()
&& $foreign['foreign_columns'] === ['b', 'a']
));
}

public function testSystemVersionedTables()
{
if ($this->driver !== 'mysql' || ! $this->getConnection()->isMaria()) {
$this->markTestSkipped('Test requires a MariaDB connection.');
}

DB::statement('create table `test` (`foo` int) WITH system versioning;');

$this->assertTrue(Schema::hasTable('test'));

Schema::dropAllTables();

$this->artisan('migrate:install');

DB::statement('create table `test` (`foo` int) WITH system versioning;');
}
}

0 comments on commit ac960a1

Please sign in to comment.