blob: 9648ce89cf5bfc4a2e448df31aa45fbd5265348f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<?php
class Step00204NoDocumentDeletion extends Migration
{
function description()
{
return 'add field `author_name` to table dokumente and fill it with current names';
}
function up()
{
$db = DBManager::get();
$db->exec("ALTER TABLE `dokumente` ADD `author_name` VARCHAR( 255 ) NOT NULL DEFAULT ''");
$db->exec(" UPDATE dokumente
LEFT JOIN auth_user_md5 USING ( user_id )
LEFT JOIN user_info USING ( user_id )
SET author_name = TRIM( CONCAT( title_front, ' ', Vorname, ' ', Nachname, IF( title_rear != '', CONCAT( ', ', title_rear ) , '' ) ) )");
}
function down()
{
$db = DBManager::get();
$db->exec("ALTER TABLE `dokumente` DROP `author_name`");
}
}
?>
|