-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking changes! updated API Controller, Tree model and db table str…
…ucture, name_id -> domain_id + access_domain, name_id -> virtual attribute
- Loading branch information
Chris Stebe
committed
Apr 15, 2016
1 parent
2096cbc
commit 77c11c6
Showing
17 changed files
with
249 additions
and
88 deletions.
There are no files selected for viewing
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
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
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,21 @@ | ||
<?php | ||
|
||
use yii\db\Migration; | ||
|
||
class m160411_082658_rename_name_id_column extends Migration | ||
{ | ||
public function up() | ||
{ | ||
$this->dropIndex('name_id_UNIQUE', 'dmstr_page'); | ||
$this->renameColumn('dmstr_page', 'name_id', 'domain_id'); | ||
$this->execute("ALTER TABLE dmstr_page MODIFY COLUMN domain_id VARCHAR(255) NOT NULL;"); | ||
$this->execute( | ||
"ALTER TABLE `dmstr_page` ADD UNIQUE INDEX `name_id_UNIQUE` (`domain_id`, `access_domain`);" | ||
); | ||
} | ||
|
||
public function down() | ||
{ | ||
return false; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
migrations/m160411_111111_name_id_to_domain_id_renamer.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,29 @@ | ||
<?php | ||
|
||
use yii\db\Migration; | ||
|
||
class m160411_111111_name_id_to_domain_id_renamer extends Migration | ||
{ | ||
public function up() | ||
{ | ||
$languages = explode(',', getenv('APP_LANGUAGES')); | ||
|
||
if (count($languages) > 0 && $languages[0] !== '') { | ||
foreach ($languages as $language) { | ||
|
||
$this->execute( | ||
" | ||
UPDATE dmstr_page SET domain_id = REPLACE (domain_id, '_$language', '') WHERE domain_id LIKE '%_$language'; | ||
" | ||
); | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public function down() | ||
{ | ||
return false; | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.