forked from OpenCorpora/opencorpora
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(migration) keep deleted lemmata in the same table; interface changes…
… to distinguish them in history and on the editor page
Showing
8 changed files
with
89 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class UndeleteLemmata extends AbstractMigration | ||
{ | ||
/** | ||
* Migrate Up. | ||
*/ | ||
public function up() | ||
{ | ||
$this->execute(" | ||
ALTER TABLE dict_lemmata | ||
ADD COLUMN `deleted` tinyint(3) unsigned not null; | ||
"); | ||
$this->execute(" | ||
ALTER TABLE dict_lemmata | ||
ADD INDEX(`deleted`) | ||
"); | ||
$this->execute(" | ||
INSERT INTO dict_lemmata ( | ||
SELECT lemma_id, lemma_text, 1 | ||
FROM dict_lemmata_deleted | ||
) | ||
"); | ||
$this->dropTable('dict_lemmata_deleted'); | ||
} | ||
|
||
/** | ||
* Migrate Down. | ||
*/ | ||
public function down() | ||
{ | ||
$this->table('dict_lemmata_deleted', array('id' => false)) | ||
->addColumn('lemma_id', 'integer') | ||
->addColumn('lemma_text', 'string', array('limit' => 50)) | ||
->save(); | ||
$this->execute(" | ||
INSERT INTO dict_lemmata_deleted ( | ||
SELECT lemma_id, lemma_text | ||
FROM dict_lemmata | ||
WHERE deleted=1 | ||
) | ||
"); | ||
$this->execute(" | ||
DELETE FROM dict_lemmata | ||
WHERE deleted=1 | ||
"); | ||
$this->table('dict_lemmata')->removeIndex(array('deleted')); | ||
$this->table('dict_lemmata')->removeColumn('deleted'); | ||
} | ||
} |
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