• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ICanBoogie / ActiveRecord / 4542546258

pending completion
4542546258

push

github

Olivier Laviale
Add 'belongs_to' to the SchemaBuilder

29 of 29 new or added lines in 4 files covered. (100.0%)

1356 of 1726 relevant lines covered (78.56%)

36.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/lib/ActiveRecord/Driver/SQLiteDriver.php
1
<?php
2

3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace ICanBoogie\ActiveRecord\Driver;
13

14
use ICanBoogie\ActiveRecord\Schema;
15
use ICanBoogie\ActiveRecord\SchemaColumn;
16
use ICanBoogie\ActiveRecord\SchemaIndex;
17

18
use function array_filter;
19
use function array_map;
20
use function implode;
21
use function is_array;
22

23
/**
24
 * Connection driver for SQLite.
25
 */
26
final class SQLiteDriver extends BasicDriver
27
{
28
    /**
29
     * @inheritDoc
30
     */
31
    protected function render_create_table(string $table_name, Schema $schema): string
32
    {
33
        return (new TableRendererForSQLite())
88✔
34
            ->render($schema, $table_name);
88✔
35
    }
36

37
    /**
38
     * @inheritdoc
39
     */
40
    public function table_exists(string $name): bool
41
    {
42
        $tables = $this->connection
74✔
43
            ->query('SELECT name FROM sqlite_master WHERE type = "table" AND name = ?', [ $name ])
74✔
44
            ->all(\PDO::FETCH_COLUMN);
74✔
45

46
        return !!$tables;
74✔
47
    }
48

49
    /**
50
     * @inheritdoc
51
     */
52
    public function optimize(): void
53
    {
54
        $this->connection->exec('VACUUM');
×
55
    }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc