m170612_150031_translation_workflow.php 2.16 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
7
8
9
 * @see https://www.open2.0.regione.lombardia.it Developers'community
 * @license GPLv3
 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
Marcello Pivanti's avatar
Marcello Pivanti committed
10
 *
waltermazza's avatar
waltermazza committed
11
 * @package    arter\amos\translation\migrations
Marcello Pivanti's avatar
Marcello Pivanti committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

/**
 * Class m170612_150031_translation_workflow
 */
class m170612_150031_translation_workflow extends \yii\db\Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->execute("SET FOREIGN_KEY_CHECKS=0;");

        $this->execute("
            INSERT INTO `sw_workflow` (`id`, `initial_status_id`) VALUES
            ('AmosTranslationWorkflow', 'DRAFT');
            
            INSERT INTO `sw_transition` (`workflow_id`, `start_status_id`, `end_status_id`) VALUES
            ('AmosTranslationWorkflow', 'APPROVED', 'DRAFT'),
            ('AmosTranslationWorkflow', 'APPROVED', 'TOBEREVIEWED'),
            ('AmosTranslationWorkflow', 'DRAFT', 'TRANSLATED'),
            ('AmosTranslationWorkflow', 'TOBEREVIEWED', 'TRANSLATED'),
            ('AmosTranslationWorkflow', 'TRANSLATED', 'APPROVED'),
            ('AmosTranslationWorkflow', 'TRANSLATED', 'TOBEREVIEWED');
            
            INSERT INTO `sw_status` (`id`, `workflow_id`, `label`, `sort_order`) VALUES
            ('APPROVED', 'AmosTranslationWorkflow', 'Approved', 4),
            ('DRAFT', 'AmosTranslationWorkflow', 'Draft', 1),
            ('TOBEREVIEWED', 'AmosTranslationWorkflow', 'To be reviewed', 3),
            ('TRANSLATED', 'AmosTranslationWorkflow', 'Translated', 2);

            INSERT INTO `sw_metadata` (`workflow_id`, `status_id`, `key`, `value`) VALUES
            ('AmosTranslationWorkflow', 'APPROVED', 'label', 'Approved'),
            ('AmosTranslationWorkflow', 'DRAFT', 'label', 'Draft');
                ");

        $this->execute("SET FOREIGN_KEY_CHECKS=1;");
        return true;
    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        echo "No migration dows available for m170612_150031_translation_workflow";
        return true;
    }
}