From da5a617430df5eb1df80b0f3a55ec5c7ebb823c3 Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 8 Mar 2024 10:48:21 +0000 Subject: [PATCH] Added detection and prepare for delete to migration --- application/migrations/186_rm_eqsl_dbl.php | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 application/migrations/186_rm_eqsl_dbl.php diff --git a/application/migrations/186_rm_eqsl_dbl.php b/application/migrations/186_rm_eqsl_dbl.php new file mode 100644 index 000000000..d748c7a68 --- /dev/null +++ b/application/migrations/186_rm_eqsl_dbl.php @@ -0,0 +1,30 @@ +1;'; + $query=$this->db->query($sql); + if ($query->num_rows() > 0) { + $eqsl2del=[]; + foreach ($query->result() as $row) + $eqsl2del[]=$row->id; + foreach ($eqsl2del as $oneeqsl) { + $res=$this->db->query("select image_file from eQSL_images where id=?",$oneeqsl)->result()[0]->image_file; + log_message("Error"," Need to remove file ".$res." with PK ".$oneeqsl); // Add moving of files HERE + } + foreach ($eqsl2del as $oneeqsl) { + // $this->db->query('delete from eQSL_images where id=?',$oneeqsl); + } + } + } + + public function down() { + } +} +