-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The primary keys haven't been autoincrement fields traditionally.
And specifying autoincrements this way doesn't work either.
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Adds autoincrement flags | ||
* | ||
* Copyright 2010-2016 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file LICENSE for license information (BSD). If you did not | ||
* did not receive this file, see http://www.horde.org/licenses/bsd. | ||
* | ||
* @author Jan Schneider <jan@horde.org> | ||
* @category Horde | ||
* @license http://www.horde.org/licenses/gpl GPL | ||
* @package Vilma | ||
*/ | ||
class VilmaUpgradeAutoIncrement extends Horde_Db_Migration_Base | ||
{ | ||
/** | ||
* Upgrade. | ||
*/ | ||
public function up() | ||
{ | ||
$this->changeColumn('vilma_domains', 'domain_id', 'autoincrementKey'); | ||
$this->changeColumn('vilma_users', 'user_id', 'autoincrementKey'); | ||
$this->changeColumn('vilma_virtuals', 'virtual_id', 'autoincrementKey'); | ||
try { | ||
$this->dropTable('vilma_domains_seq'); | ||
} catch (Horde_Db_Exception $e) { | ||
} | ||
try { | ||
$this->dropTable('vilma_users_seq'); | ||
} catch (Horde_Db_Exception $e) { | ||
} | ||
try { | ||
$this->dropTable('vilma_virtuals_seq'); | ||
} catch (Horde_Db_Exception $e) { | ||
} | ||
} | ||
|
||
/** | ||
* Downgrade | ||
*/ | ||
public function down() | ||
{ | ||
$this->changeColumn('vilma_domains', 'domain_id', 'integer', array('null' => false)); | ||
$this->changeColumn('vilma_users', 'user_id', 'integer', array('null' => false)); | ||
$this->changeColumn('vilma_virtuals', 'virtual_id', 'integer', array('null' => false)); | ||
} | ||
|
||
} |
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