aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.4.7_create_stock_images_table.php
blob: e1a7b04338e625698c90bb5150a6f62b19d423df (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
32
33
34
35
36
37
38
39
40
41
<?php

class CreateStockImagesTable extends Migration
{
    public function description()
    {
        return 'create table for stock images';
    }

    public function up()
    {
        $db = DBManager::get();
        $query =
            "CREATE TABLE IF NOT EXISTS `stock_images` (
             `id` int(11) NOT NULL AUTO_INCREMENT,

             `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
             `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
             `license` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
             `author` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

             `mime_type` varchar(64) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
             `size` int(10) UNSIGNED NOT NULL,
             `width` int(10) UNSIGNED NOT NULL,
             `height` int(10) UNSIGNED NOT NULL,
             `palette` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
             `tags` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,

             `mkdate` int(11) UNSIGNED NOT NULL,
             `chdate` int(11) UNSIGNED NOT NULL,

             PRIMARY KEY (`id`))";
        $db->exec($query);
    }

    public function down()
    {
        $db = DBManager::get();
        $db->exec('DROP TABLE IF EXISTS `stock_images`');
    }
}