-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
migrations/20200521014822_add_base_language_to_categories.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class AddBaseLanguageToCategories extends AbstractMigration | ||
{ | ||
public function up() | ||
{ | ||
|
||
$result = $this->fetchRow( | ||
"SELECT config_value FROM config WHERE group_name='site' and config_key='language' " | ||
); | ||
// get two letter lang code | ||
$language = str_before(json_decode($result['config_value']), '-'); | ||
$this->table('tags') | ||
->addColumn('base_language', 'string', ['null' => false, 'default' => $language]) //es/en | ||
->update(); | ||
} | ||
|
||
|
||
public function down() | ||
{ | ||
$this->table('tags')->removeColumn('base_language'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters