Passed
Pull Request — master (#6127)
by Angel Fernando Quiroz
10:19
created

Version20250306100000   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 4 1
A getDescription() 0 3 1
A up() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
6
7
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
8
use Doctrine\DBAL\Schema\Schema;
9
10
final class Version20250306100000 extends AbstractMigrationChamilo
11
{
12
    public function getDescription(): string
13
    {
14
        return 'Create the plugin table to manage plugin installation and activation.';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        // Create the plugin table
20
        $this->addSql("
21
            CREATE TABLE plugin (
22
                id INT AUTO_INCREMENT PRIMARY KEY,
23
                title VARCHAR(255) UNIQUE NOT NULL,
24
                installed TINYINT(1) NOT NULL DEFAULT 0,
25
                active TINYINT(1) NOT NULL DEFAULT 0,
26
                version VARCHAR(20) NOT NULL DEFAULT '1.0.0',
27
                access_url_id INT NOT NULL,
28
                configuration JSON DEFAULT NULL,
29
                source ENUM('official', 'third_party') NOT NULL DEFAULT 'third_party'
30
            );
31
        ");
32
    }
33
34
    public function down(Schema $schema): void
35
    {
36
        // Drop the plugin table if rolling back the migration
37
        $this->addSql("DROP TABLE plugin;");
38
    }
39
}
40