1 | <?php |
||
19 | trait EnvironmentalTableTrait |
||
20 | { |
||
21 | /** |
||
22 | * Identify whether we have ensured the environment table is present |
||
23 | * |
||
24 | * @var bool |
||
25 | */ |
||
26 | protected static $environmentTableChecked = false; |
||
27 | |||
28 | /** |
||
29 | * The table migration responsible for creating a new table (for an environment) if one |
||
30 | * doesn't already exist. |
||
31 | * |
||
32 | * @return MigrationInterface |
||
33 | */ |
||
34 | abstract static protected function createEnvironmentTableMigration(): MigrationInterface; |
||
35 | |||
36 | /** |
||
37 | * The name of the environment table. It's suggested to add an environmental suffix to the table. As an |
||
38 | * example: 'your_table_local' where '_local' is the environment. Do not include the table prefix. |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | abstract protected static function environmentTableAlias(): string; |
||
43 | |||
44 | /** |
||
45 | * @return bool |
||
46 | * @throws \yii\base\NotSupportedException |
||
47 | */ |
||
48 | protected static function doesEnvironmentTableExist(): bool |
||
56 | |||
57 | /** |
||
58 | * @throws \Throwable |
||
59 | */ |
||
60 | public static function ensureEnvironmentTableExists() |
||
75 | |||
76 | /** |
||
77 | * @return bool |
||
78 | * @throws \Throwable |
||
79 | */ |
||
80 | protected static function createEnvironmentTable(): bool |
||
88 | } |
||
89 |