Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new dates in session table see #7719
- Loading branch information
Showing
2 changed files
with
52 additions
and
53 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
44 changes: 44 additions & 0 deletions
44
src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150528103216.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,44 @@ | ||
<?php | ||
/* For licensing terms, see /license.txt */ | ||
|
||
namespace Chamilo\CoreBundle\Migrations\Schema\V110; | ||
|
||
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; | ||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
/** | ||
* Session date changes | ||
*/ | ||
class Version20150528103216 extends AbstractMigrationChamilo | ||
{ | ||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function up(Schema $schema) | ||
{ | ||
$this->addSql('UPDATE session SET access_start_date = date_start'); | ||
$this->addSql("UPDATE session SET access_end_date = CONVERT(CONCAT(date_end, ' 23:59:59'), DATETIME)"); | ||
|
||
$this->addSql('UPDATE session SET coach_access_start_date = CONVERT(DATE_SUB(date_start, INTERVAL nb_days_access_before_beginning DAY), DATETIME) '); | ||
$this->addSql('UPDATE session SET coach_access_start_date = NULL WHERE nb_days_access_before_beginning = 0'); | ||
|
||
$this->addSql('UPDATE session SET coach_access_end_date = CONVERT(DATE_ADD(date_end, INTERVAL nb_days_access_after_end DAY), DATETIME) '); | ||
$this->addSql('UPDATE session SET coach_access_end_date = NULL WHERE nb_days_access_after_end = 0'); | ||
|
||
$this->addSql('UPDATE session SET display_start_date = access_start_date'); | ||
$this->addSql('UPDATE session SET display_end_date = access_end_date'); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function down(Schema $schema) | ||
{ | ||
$this->addSql('ALTER TABLE session DROP access_start_date'); | ||
$this->addSql('ALTER TABLE session DROP access_end_date'); | ||
$this->addSql('ALTER TABLE session DROP coach_access_start_date'); | ||
$this->addSql('ALTER TABLE session DROP coach_access_end_date'); | ||
$this->addSql('ALTER TABLE session DROP display_start_date'); | ||
$this->addSql('ALTER TABLE session DROP display_end_date'); | ||
} | ||
} |