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

codeigniter4 / CodeIgniter4 / 7205706136

14 Dec 2023 07:19AM UTC coverage: 85.054% (-0.004%) from 85.058%
7205706136

push

github

kenjis
Merge remote-tracking branch 'upstream/develop' into 4.5

7 of 8 new or added lines in 2 files covered. (87.5%)

1 existing line in 1 file now uncovered.

19326 of 22722 relevant lines covered (85.05%)

193.63 hits per line

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

85.71
/system/Database/Migration.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Database;
15

16
use Config\Database;
17

18
/**
19
 * Class Migration
20
 */
21
abstract class Migration
22
{
23
    /**
24
     * The name of the database group to use.
25
     *
26
     * @var string|null
27
     */
28
    protected $DBGroup;
29

30
    /**
31
     * Database Connection instance
32
     *
33
     * @var ConnectionInterface
34
     */
35
    protected $db;
36

37
    /**
38
     * Database Forge instance.
39
     *
40
     * @var Forge
41
     */
42
    protected $forge;
43

44
    public function __construct(?Forge $forge = null)
45
    {
46
        if (isset($this->DBGroup)) {
564✔
47
            $this->forge = Database::forge($this->DBGroup);
1✔
48
        } elseif ($forge !== null) {
564✔
49
            $this->forge = $forge;
564✔
50
        } else {
NEW
51
            $this->forge = Database::forge(config(Database::class)->defaultGroup);
×
52
        }
53

54
        $this->db = $this->forge->getConnection();
564✔
55
    }
56

57
    /**
58
     * Returns the database group name this migration uses.
59
     */
60
    public function getDBGroup(): ?string
61
    {
62
        return $this->DBGroup;
564✔
63
    }
64

65
    /**
66
     * Perform a migration step.
67
     */
68
    abstract public function up();
69

70
    /**
71
     * Revert a migration step.
72
     */
73
    abstract public function down();
74
}
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