76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
/**
|
|
* Миграция для создания таблицы настроек модулей
|
|
*
|
|
* Хранит переопределённые настройки модулей (цены, описание, триал).
|
|
*/
|
|
class CreateModuleSettingsTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'module_code' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 50,
|
|
],
|
|
'name' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
],
|
|
'description' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
],
|
|
'price_monthly' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'default' => 0,
|
|
],
|
|
'price_yearly' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'default' => 0,
|
|
],
|
|
'trial_days' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'default' => 0,
|
|
],
|
|
'is_active' => [
|
|
'type' => 'TINYINT',
|
|
'constraint' => 1,
|
|
'default' => 1,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addUniqueKey('module_code');
|
|
|
|
$this->forge->createTable('module_settings');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('module_settings', true);
|
|
}
|
|
}
|