Elgg
Version master
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
schema
migrations
20170728050000_expand_text_columns_to_longtext.php
Go to the documentation of this file.
1
<?php
2
3
use
Phinx\Db\Adapter\MysqlAdapter
;
4
use
Phinx\Migration\AbstractMigration
;
5
6
class
ExpandTextColumnsToLongtext
extends
AbstractMigration {
7
8
// Columns that change from text to longtext
9
private
$text_to_longtext = [
10
'config'
=> [
'value'
],
11
'private_settings'
=> [
'value'
],
12
];
13
17
public
function
up
() {
18
19
foreach
($this->text_to_longtext as
$table
=>
$columns
) {
20
if
(!$this->hasTable(
$table
)) {
21
continue
;
22
}
23
24
$table
= $this->table(
$table
);
25
26
foreach
(
$columns
as
$column
) {
27
if
(
$table
->hasColumn($column)) {
28
$table
->changeColumn($column,
'text'
, [
29
'limit'
=> MysqlAdapter::TEXT_LONG,
30
]);
31
}
32
}
33
34
$table
->save();
35
}
36
}
37
41
public
function
down
() {
42
43
foreach
($this->text_to_longtext as
$table
=>
$columns
) {
44
if
(!$this->hasTable(
$table
)) {
45
continue
;
46
}
47
48
$table
= $this->table(
$table
);
49
50
foreach
(
$columns
as
$column
) {
51
if
(
$table
->hasColumn($column)) {
52
$table
->changeColumn($column,
'text'
, [
53
'limit'
=> MysqlAdapter::TEXT_REGULAR,
54
]);
55
}
56
}
57
58
$table
->save();
59
}
60
}
61
}
MysqlAdapter
$column
$column
Definition:
add.php:10
ExpandTextColumnsToLongtext\down
down()
Shirnk certain columns from longtext to text.
Definition:
20170728050000_expand_text_columns_to_longtext.php:41
$columns
$columns
Definition:
table.php:30
$table
$table
Definition:
user.php:37
AbstractMigration
ExpandTextColumnsToLongtext
Definition:
20170728050000_expand_text_columns_to_longtext.php:6
ExpandTextColumnsToLongtext\up
up()
Expand certain columns from text to longtext.
Definition:
20170728050000_expand_text_columns_to_longtext.php:17
Generated on Sat Dec 21 2024 00:02:53 for Elgg by
1.8.11