Skip to content

Commit ac960a1

Browse files
[10.x] Include system versioned tables for MariaDB (#49509)
* include system versioned tables for mariadb * fix tests * wip
1 parent 0f1df95 commit ac960a1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function compileTables($database)
8888
return sprintf(
8989
'select table_name as `name`, (data_length + index_length) as `size`, '
9090
.'table_comment as `comment`, engine as `engine`, table_collation as `collation` '
91-
."from information_schema.tables where table_schema = %s and table_type = 'BASE TABLE' "
91+
."from information_schema.tables where table_schema = %s and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') "
9292
.'order by table_name',
9393
$this->quoteString($database)
9494
);

tests/Integration/Database/SchemaBuilderTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,21 @@ public function testGetCompoundForeignKeys()
367367
&& $foreign['foreign_columns'] === ['b', 'a']
368368
));
369369
}
370+
371+
public function testSystemVersionedTables()
372+
{
373+
if ($this->driver !== 'mysql' || ! $this->getConnection()->isMaria()) {
374+
$this->markTestSkipped('Test requires a MariaDB connection.');
375+
}
376+
377+
DB::statement('create table `test` (`foo` int) WITH system versioning;');
378+
379+
$this->assertTrue(Schema::hasTable('test'));
380+
381+
Schema::dropAllTables();
382+
383+
$this->artisan('migrate:install');
384+
385+
DB::statement('create table `test` (`foo` int) WITH system versioning;');
386+
}
370387
}

0 commit comments

Comments
 (0)