Guest User

Untitled

a guest
Jan 13th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.88 KB | None | 0 0
  1. diff --git a/db/Event/499-AddPointColumn.php b/db/Event/499-AddPointColumn.php
  2. new file mode 100644
  3. index 0000000..eaa4272
  4. --- /dev/null
  5. +++ b/db/Event/499-AddPointColumn.php
  6. @@ -0,0 +1,24 @@
  7. +<?php
  8. +/**
  9. + * Add points column
  10. + * @author kshema
  11. + */
  12. +class Event_499 extends Migration
  13. +{
  14. +    public function deploy()
  15. +    {
  16. +        if (!MyDB::getInstance()->columnExists($this->migrationObject->database, Sessions::TABLE, 'points')) {
  17. +            $sql = "ALTER TABLE {$this->getTableName(Sessions::TABLE)} ADD COLUMN `points` smallint(1)";
  18. +            $result = MyDB::getInstance()->execute($sql);
  19. +            if (!$result) {
  20. +                 return false;
  21. +            }    
  22. +        }
  23. +        return true;
  24. +    }
  25. +
  26. +    public function getRollbackSQL()
  27. +    {
  28. +        return "ALTER TABLE {$this->getTableName(Sessions::TABLE)} DROP COLUMN `points`";
  29. +    }
  30. +}
Add Comment
Please, Sign In to add comment