aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.2.13_add_courseware_public_links.php
blob: 1a9275cd692192987f500270b005a914098379d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
final class AddCoursewarePublicLinks extends Migration
{
    public function description()
    {
        return 'Create Courseware public links database table';
    }

    public function up()
    {
        \DBManager::get()->exec("CREATE TABLE `cw_public_links` (
            `id` char(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
            `user_id` char(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
            `structural_element_id` int(11) NOT NULL,
            `password` varbinary(64) NOT NULL,
            `expire_date` int(11) NOT NULL,
            `mkdate` int(11) NOT NULL,
            `chdate` int(11) NOT NULL,

            PRIMARY KEY (`id`),
            INDEX index_user_id (`user_id`),
            INDEX index_structural_element_id (`structural_element_id`)
            )
        ");
    }

    public function down()
    {
        \DBManager::get()->exec("DROP TABLE IF EXISTS `cw_public_links`");
    }
}