Lepsi escapovani v migratoru
[mirrors/SokoMan.git] / assistants / migrations.inc.php
index c492ecb4e936b3975a5e9e3f4890300b70df5bf5..dd7b436d1ecec8afd2ee0f6586a38a2383370d96 100644 (file)
@@ -1,6 +1,13 @@
 <pre>
+<h1>-- populate barcode table</h1><?php
+$data = $this->db->safe_query_fetch('SELECT model_id as id, model_barcode as bar FROM model;', false);
+//print_r($data);
+echo("UPDATE item SET barcode_id=model_id;\n");
+echo("INSERT INTO barcode (barcode_id,model_id,barcode_name) VALUES\n");
+foreach($data as $line) echo("('".$line['id']."','".$line['id']."',".$this->db->quote($line['bar'])."),\n");
+?>
 <h1>-- populate columns item_date_bought and item_date_sold</h1><?php
-$data = $this->db->safe_query_fetch('SELECT item_id,MIN(item_valid_from) AS min,MAX(item_valid_from) AS max FROM item GROUP BY item_id;');
+$data = $this->db->safe_query_fetch('SELECT item_id,MIN(item_valid_from) AS min,MAX(item_valid_from) AS max FROM item GROUP BY item_id;', false);
 //print_r($data);
 echo("START TRANSACTION;\n");
 foreach($data as $line) echo("UPDATE item SET item_date_bought='".$line['min']."',item_date_sold='".$line['max']."' WHERE item_id=".$line['item_id'].";\n");
This page took 0.093391 seconds and 4 git commands to generate.