[Migrations] Fix in script 102 and 105 to check if things exists

pull/2037/head
Andreas 2023-03-15 14:40:32 +01:00
rodzic 363cda94bc
commit 5ac115ceee
2 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -15,8 +15,11 @@ class Migration_add_version_two_trigger_to_options extends CI_Migration {
array('option_name' => "version2_trigger", 'option_value' => "false", 'autoload' => "yes"),
);
$query = $this->db->select('option_name')->where('option_name', 'version2_trigger')->get('options');
if($query->num_rows() == 0) {
$this->db->insert_batch('options', $data);
}
}
public function down()
{

Wyświetl plik

@ -4,6 +4,7 @@ class Migration_create_dxcc_master_tables extends CI_Migration {
public function up()
{
if (!$this->db->table_exists('dxcc_master')) {
$this->db->query("CREATE TABLE `dxcc_master` (
`DXCCPrefix` varchar(6) DEFAULT NULL,
`DXCCSearch` varchar(6) DEFAULT NULL,
@ -1042,6 +1043,7 @@ class Migration_create_dxcc_master_tables extends CI_Migration {
$this->db->query("INSERT INTO `dxcc_master` (DXCCPrefix,DXCCSearch,DXCCMap,DXCCSort,CountryCode,PrefixList,DXCCName,Location,Continent,CQZone,ITUZone,IOTA,TimeZone,Latitude,Longitude,StartDate,EndDate) VALUES ('CE9','CE9','CE9',29,13,'RI1ANZ','Antarctica','Progress Station (Russia)','AN','39','69','AN-016',-6.0,-69.397,76.373,NULL,NULL);");
$this->db->query("INSERT INTO `dxcc_master` (DXCCPrefix,DXCCSearch,DXCCMap,DXCCSort,CountryCode,PrefixList,DXCCName,Location,Continent,CQZone,ITUZone,IOTA,TimeZone,Latitude,Longitude,StartDate,EndDate) VALUES ('UA0','UA0','UA',1,15,'UA0','Asiatic Russia','Asiatic Russia','AS',NULL,NULL,NULL,NULL,64.0,130.0,NULL,NULL);");
}
}
public function down(){
$this->db->query("");