-- This is the default config for version 0.1
CREATE TABLE config ( 
       name varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL, 
       value varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, 
       camera int(11) NOT NULL, 
       UNIQUE KEY camera (camera,name) 
       ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE videos ( 
        id int(11) unsigned NOT NULL AUTO_INCREMENT, 
        path varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, 
        starttime bigint(20) NOT NULL, 
        endtime bigint(20) DEFAULT NULL, 
        camera int(11) NOT NULL, 
        PRIMARY KEY (id,camera,starttime), 
        KEY endtime (endtime), 
        KEY starttime (starttime), 
        KEY camera (camera) 
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO config (camera, name, value) VALUES (-1, 'database-version', '1.0');
