kopia lustrzana https://github.com/magicbug/Cloudlog
[Options] Creates options table during install and inserts the version2 flag and migration file makes sure it doesn't exisit.
This will hopefully resolve #2443 loop for new installs who of course don't need to run through the upgrade process for version 1 to 2pull/2448/head
rodzic
25f6faf275
commit
fde3357d2a
|
@ -11,35 +11,38 @@ class Migration_new_options_table extends CI_Migration {
|
||||||
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
$this->dbforge->add_field(array(
|
// if table options doesn't exist
|
||||||
'option_id' => array(
|
if (!$this->db->table_exists('options')) {
|
||||||
'type' => 'BIGINT',
|
$this->dbforge->add_field(array(
|
||||||
'constraint' => 20,
|
'option_id' => array(
|
||||||
'unsigned' => TRUE,
|
'type' => 'BIGINT',
|
||||||
'auto_increment' => TRUE
|
'constraint' => 20,
|
||||||
),
|
'unsigned' => TRUE,
|
||||||
|
'auto_increment' => TRUE
|
||||||
|
),
|
||||||
|
|
||||||
'option_name' => array(
|
'option_name' => array(
|
||||||
'type' => 'VARCHAR',
|
'type' => 'VARCHAR',
|
||||||
'constraint' => '191',
|
'constraint' => '191',
|
||||||
'null' => TRUE,
|
'null' => TRUE,
|
||||||
'unique' => TRUE,
|
'unique' => TRUE,
|
||||||
),
|
),
|
||||||
|
|
||||||
'option_value' => array(
|
'option_value' => array(
|
||||||
'type' => 'longtext',
|
'type' => 'longtext',
|
||||||
),
|
),
|
||||||
|
|
||||||
'autoload' => array(
|
'autoload' => array(
|
||||||
'type' => 'varchar',
|
'type' => 'varchar',
|
||||||
'constraint' => '20',
|
'constraint' => '20',
|
||||||
'null' => TRUE,
|
'null' => TRUE,
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->dbforge->add_key('option_id', TRUE);
|
$this->dbforge->add_key('option_id', TRUE);
|
||||||
|
|
||||||
$this->dbforge->create_table('options');
|
$this->dbforge->create_table('options');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
|
|
|
@ -11,6 +11,7 @@ class Migration_add_version_two_trigger_to_options extends CI_Migration {
|
||||||
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
array('option_name' => "version2_trigger", 'option_value' => "false", 'autoload' => "yes"),
|
array('option_name' => "version2_trigger", 'option_value' => "false", 'autoload' => "yes"),
|
||||||
);
|
);
|
||||||
|
@ -19,6 +20,7 @@ class Migration_add_version_two_trigger_to_options extends CI_Migration {
|
||||||
if($query->num_rows() == 0) {
|
if($query->num_rows() == 0) {
|
||||||
$this->db->insert_batch('options', $data);
|
$this->db->insert_batch('options', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
|
|
|
@ -296,6 +296,19 @@ CREATE TABLE `TABLE_HRD_CONTACTS_V01` (
|
||||||
-- Records of TABLE_HRD_CONTACTS_V01
|
-- Records of TABLE_HRD_CONTACTS_V01
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `options` (
|
||||||
|
`option_id` bigint(20) UNSIGNED NOT NULL,
|
||||||
|
`option_name` varchar(191) DEFAULT NULL,
|
||||||
|
`option_value` longtext NOT NULL,
|
||||||
|
`autoload` varchar(20) DEFAULT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `options` that stops the version2 trigger from firing
|
||||||
|
INSERT INTO `options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES (NULL, 'version2_trigger', 'yes', 'true')
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for timezones
|
-- Table structure for timezones
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
Ładowanie…
Reference in New Issue