blob: 1b728674f060fd4cd6a402d1bd5ad4d3808fc166 (
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
27
28
29
|
<?php
class DefaultDataFieldValues extends Migration
{
/**
* short description of this migration
*/
public function description()
{
return 'Add default values for generic data fields.';
}
/**
* perform this migration
*/
public function up()
{
DBManager::get()->exec("ALTER TABLE datafields ADD default_value TEXT NULL AFTER is_required");
DBManager::get()->exec("DELETE FROM datafields_entries WHERE content IS NULL OR content = ''");
}
/**
* revert this migration
*/
public function down()
{
DBManager::get()->exec("ALTER TABLE datafields DROP default_value");
}
}
|