forked from cakephp/phinx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureFlags.php
More file actions
49 lines (45 loc) · 1.5 KB
/
FeatureFlags.php
File metadata and controls
49 lines (45 loc) · 1.5 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* MIT License
* For full license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Phinx\Config;
/**
* Class to hold features flags to toggle breaking changes in Phinx.
*
* New flags should be added very sparingly.
*/
class FeatureFlags
{
/**
* @var bool Should Phinx create unsigned primary keys by default?
*/
public static bool $unsignedPrimaryKeys = true;
/**
* @var bool Should Phinx create columns NULL by default?
*/
public static bool $columnNullDefault = true;
/**
* @var bool Should Phinx create datetime columns for addTimestamps instead of timestamp?
* Also affects start_time and end_time column types in schema table.
*/
public static bool $addTimestampsUseDateTime = false;
/**
* Set the feature flags from the `feature_flags` section of the overall
* config.
*
* @param array $config The `feature_flags` section of the config
*/
public static function setFlagsFromConfig(array $config): void
{
if (isset($config['unsigned_primary_keys'])) {
self::$unsignedPrimaryKeys = (bool)$config['unsigned_primary_keys'];
}
if (isset($config['column_null_default'])) {
self::$columnNullDefault = (bool)$config['column_null_default'];
}
if (isset($config['add_timestamps_use_datetime'])) {
self::$addTimestampsUseDateTime = (bool)$config['add_timestamps_use_datetime'];
}
}
}