Aktualni SQL dump
[mirrors/SokoMan.git] / assistants / migrations.inc.php
CommitLineData
a12d11db 1<pre>
ea921a95 2<h1>-- populate barcode table</h1><?php
836c989e 3$data = $this->db->safe_query_fetch('SELECT model_id as id, model_barcode as bar FROM model;', false);
ea921a95
TM
4//print_r($data);
5echo("UPDATE item SET barcode_id=model_id;\n");
6echo("INSERT INTO barcode (barcode_id,model_id,barcode_name) VALUES\n");
836c989e 7foreach($data as $line) echo("('".$line['id']."','".$line['id']."',".$this->db->quote($line['bar'])."),\n");
ea921a95 8?>
f7740b1c 9<h1>-- populate columns item_date_bought and item_date_sold</h1><?php
836c989e 10$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);
79cc0871
TM
11//print_r($data);
12echo("START TRANSACTION;\n");
a12d11db 13foreach($data as $line) echo("UPDATE item SET item_date_bought='".$line['min']."',item_date_sold='".$line['max']."' WHERE item_id=".$line['item_id'].";\n");
79cc0871 14echo("COMMIT;\n");
a12d11db 15?>
f7740b1c 16</pre>
This page took 0.169063 seconds and 4 git commands to generate.