-- seahub
CREATE TABLE IF NOT EXISTS "DJANGO_MIGRATIONS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "app" varchar(255) NOT NULL, "name" varchar(255) NOT NULL, "applied" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "ADMIN_LOG_ADMINLOG" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "email" varchar(254) NOT NULL, "operation" varchar(255) NOT NULL, "detail" text NOT NULL, "BIGINT" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "API2_TOKEN" ("key" varchar(40) NOT NULL PRIMARY KEY, "user" varchar(255) NOT NULL UNIQUE, "created" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "API2_TOKENV2" ("key" varchar(40) NOT NULL PRIMARY KEY, "user" varchar(255) NOT NULL, "platform" varchar(32) NOT NULL, "device_id" varchar(40) NOT NULL, "device_name" varchar(40) NOT NULL, "platform_version" varchar(16) NOT NULL, "client_version" varchar(16) NOT NULL, "last_accessed" BIGINT NOT NULL, "last_login_ip" varchar(39) NULL, "created_at" BIGINT NOT NULL, "wiped_at" BIGINT NULL);
CREATE TABLE IF NOT EXISTS "ABUSE_REPORTS_ABUSEREPORT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "reporter" text NULL, "repo_id" varchar(36) NOT NULL, "repo_name" varchar(255) NOT NULL, "file_path" text NULL, "abuse_type" varchar(255) NOT NULL, "description" text NULL, "handled"  INTEGER NOT NULL, "time" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "DJANGO_CONTENT_TYPE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "app_label" varchar(100) NOT NULL, "model" varchar(100) NOT NULL);
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(1,'contenttypes','contenttype');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(2,'constance','config');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(3,'sessions','session');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(4,'base','clientlogintoken');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(5,'base','commandslastcheck');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(6,'base','devicetoken');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(7,'base','filecomment');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(8,'base','userlastlogin');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(9,'base','userstarredfiles');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(10,'base','reposecretkey');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(11,'base','socialauthuser');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(12,'auth','permission');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(13,'auth','group');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(14,'auth','user');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(15,'registration','registrationprofile');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(16,'captcha','captchastore');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(17,'database','constance');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(18,'post_office','attachment');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(19,'post_office','email');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(20,'post_office','emailtemplate');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(21,'post_office','log');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(22,'termsandconditions','termsandconditions');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(23,'termsandconditions','usertermsandconditions');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(24,'api2','token');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(25,'api2','tokenv2');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(26,'avatar','avatar');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(27,'avatar','groupavatar');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(28,'contacts','contact');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(29,'drafts','draft');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(30,'drafts','draftreviewer');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(31,'institutions','institution');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(32,'institutions','institutionadmin');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(33,'institutions','institutionquota');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(34,'invitations','invitation');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(35,'invitations','reposhareinvitation');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(36,'wiki','wiki');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(37,'notifications','notification');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(38,'notifications','usernotification');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(39,'options','useroptions');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(40,'profile','detailedprofile');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(41,'profile','profile');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(42,'share','anonymousshare');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(43,'share','extragroupssharepermission');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(44,'share','extrasharepermission');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(45,'share','fileshare');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(46,'share','orgfileshare');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(47,'share','privatefiledirshare');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(48,'share','uploadlinkshare');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(49,'admin_log','adminlog');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(50,'tags','filetag');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(51,'tags','fileuuidmap');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(52,'tags','tags');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(53,'revision_tag','revisiontags');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(54,'revision_tag','tags');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(55,'two_factor','phonedevice');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(56,'two_factor','staticdevice');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(57,'two_factor','statictoken');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(58,'two_factor','totpdevice');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(59,'role_permissions','adminrole');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(60,'trusted_ip','trustedip');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(61,'repo_tags','repotags');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(62,'file_tags','filetags');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(63,'related_files','relatedfiles');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(64,'file_participants','fileparticipant');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(65,'REPO_API_TOKENS','repoapitokens');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(66,'abuse_reports','abusereport');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(67,'sysadmin_extra','userloginlog');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(68,'organizations','orgmemberquota');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(69,'organizations','orgsettings');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(70,'django_cas_ng','proxygrantingticket');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(71,'django_cas_ng','sessionticket');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(72,'plan','userplan');
INSERT INTO "DJANGO_CONTENT_TYPE" VALUES(73,'plan','orgplan');
CREATE TABLE IF NOT EXISTS "AUTH_USER" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "password" varchar(128) NOT NULL, "last_login" BIGINT NULL, "is_superuser"  INTEGER NOT NULL, "first_name" varchar(30) NOT NULL, "last_name" varchar(30) NOT NULL, "email" varchar(254) NOT NULL, "is_staff"  INTEGER NOT NULL, "is_active"  INTEGER NOT NULL, "date_joined" BIGINT NOT NULL, "username" varchar(150) NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "AUTH_GROUP" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "name" varchar(80) NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "AUTH_PERMISSION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "content_type_id" integer NOT NULL REFERENCES "DJANGO_CONTENT_TYPE" ("id"), "codename" varchar(100) NOT NULL, "name" varchar(255) NOT NULL);
INSERT INTO "AUTH_PERMISSION" VALUES(1,1,'add_contenttype','Can add content type');
INSERT INTO "AUTH_PERMISSION" VALUES(2,1,'change_contenttype','Can change content type');
INSERT INTO "AUTH_PERMISSION" VALUES(3,1,'delete_contenttype','Can delete content type');
INSERT INTO "AUTH_PERMISSION" VALUES(4,2,'change_config','Can change config');
INSERT INTO "AUTH_PERMISSION" VALUES(5,3,'add_session','Can add session');
INSERT INTO "AUTH_PERMISSION" VALUES(6,3,'change_session','Can change session');
INSERT INTO "AUTH_PERMISSION" VALUES(7,3,'delete_session','Can delete session');
INSERT INTO "AUTH_PERMISSION" VALUES(8,4,'add_clientlogintoken','Can add client login token');
INSERT INTO "AUTH_PERMISSION" VALUES(9,4,'change_clientlogintoken','Can change client login token');
INSERT INTO "AUTH_PERMISSION" VALUES(10,4,'delete_clientlogintoken','Can delete client login token');
INSERT INTO "AUTH_PERMISSION" VALUES(11,5,'add_commandslastcheck','Can add commands last check');
INSERT INTO "AUTH_PERMISSION" VALUES(12,5,'change_commandslastcheck','Can change commands last check');
INSERT INTO "AUTH_PERMISSION" VALUES(13,5,'delete_commandslastcheck','Can delete commands last check');
INSERT INTO "AUTH_PERMISSION" VALUES(14,6,'add_devicetoken','Can add device token');
INSERT INTO "AUTH_PERMISSION" VALUES(15,6,'change_devicetoken','Can change device token');
INSERT INTO "AUTH_PERMISSION" VALUES(16,6,'delete_devicetoken','Can delete device token');
INSERT INTO "AUTH_PERMISSION" VALUES(17,7,'add_filecomment','Can add file comment');
INSERT INTO "AUTH_PERMISSION" VALUES(18,7,'change_filecomment','Can change file comment');
INSERT INTO "AUTH_PERMISSION" VALUES(19,7,'delete_filecomment','Can delete file comment');
INSERT INTO "AUTH_PERMISSION" VALUES(20,8,'add_userlastlogin','Can add user last login');
INSERT INTO "AUTH_PERMISSION" VALUES(21,8,'change_userlastlogin','Can change user last login');
INSERT INTO "AUTH_PERMISSION" VALUES(22,8,'delete_userlastlogin','Can delete user last login');
INSERT INTO "AUTH_PERMISSION" VALUES(23,9,'add_userstarredfiles','Can add user starred files');
INSERT INTO "AUTH_PERMISSION" VALUES(24,9,'change_userstarredfiles','Can change user starred files');
INSERT INTO "AUTH_PERMISSION" VALUES(25,9,'delete_userstarredfiles','Can delete user starred files');
INSERT INTO "AUTH_PERMISSION" VALUES(26,10,'add_reposecretkey','Can add repo secret key');
INSERT INTO "AUTH_PERMISSION" VALUES(27,10,'change_reposecretkey','Can change repo secret key');
INSERT INTO "AUTH_PERMISSION" VALUES(28,10,'delete_reposecretkey','Can delete repo secret key');
INSERT INTO "AUTH_PERMISSION" VALUES(29,11,'add_socialauthuser','Can add social auth user');
INSERT INTO "AUTH_PERMISSION" VALUES(30,11,'change_socialauthuser','Can change social auth user');
INSERT INTO "AUTH_PERMISSION" VALUES(31,11,'delete_socialauthuser','Can delete social auth user');
INSERT INTO "AUTH_PERMISSION" VALUES(32,12,'add_permission','Can add permission');
INSERT INTO "AUTH_PERMISSION" VALUES(33,12,'change_permission','Can change permission');
INSERT INTO "AUTH_PERMISSION" VALUES(34,12,'delete_permission','Can delete permission');
INSERT INTO "AUTH_PERMISSION" VALUES(35,13,'add_group','Can add group');
INSERT INTO "AUTH_PERMISSION" VALUES(36,13,'change_group','Can change group');
INSERT INTO "AUTH_PERMISSION" VALUES(37,13,'delete_group','Can delete group');
INSERT INTO "AUTH_PERMISSION" VALUES(38,14,'add_user','Can add user');
INSERT INTO "AUTH_PERMISSION" VALUES(39,14,'change_user','Can change user');
INSERT INTO "AUTH_PERMISSION" VALUES(40,14,'delete_user','Can delete user');
INSERT INTO "AUTH_PERMISSION" VALUES(41,15,'add_registrationprofile','Can add registration profile');
INSERT INTO "AUTH_PERMISSION" VALUES(42,15,'change_registrationprofile','Can change registration profile');
INSERT INTO "AUTH_PERMISSION" VALUES(43,15,'delete_registrationprofile','Can delete registration profile');
INSERT INTO "AUTH_PERMISSION" VALUES(44,16,'add_captchastore','Can add captcha store');
INSERT INTO "AUTH_PERMISSION" VALUES(45,16,'change_captchastore','Can change captcha store');
INSERT INTO "AUTH_PERMISSION" VALUES(46,16,'delete_captchastore','Can delete captcha store');
INSERT INTO "AUTH_PERMISSION" VALUES(47,17,'add_constance','Can add constance');
INSERT INTO "AUTH_PERMISSION" VALUES(48,17,'change_constance','Can change constance');
INSERT INTO "AUTH_PERMISSION" VALUES(49,17,'delete_constance','Can delete constance');
INSERT INTO "AUTH_PERMISSION" VALUES(50,18,'add_attachment','Can add Attachment');
INSERT INTO "AUTH_PERMISSION" VALUES(51,18,'change_attachment','Can change Attachment');
INSERT INTO "AUTH_PERMISSION" VALUES(52,18,'delete_attachment','Can delete Attachment');
INSERT INTO "AUTH_PERMISSION" VALUES(53,19,'add_email','Can add Email');
INSERT INTO "AUTH_PERMISSION" VALUES(54,19,'change_email','Can change Email');
INSERT INTO "AUTH_PERMISSION" VALUES(55,19,'delete_email','Can delete Email');
INSERT INTO "AUTH_PERMISSION" VALUES(56,20,'add_emailtemplate','Can add Email Template');
INSERT INTO "AUTH_PERMISSION" VALUES(57,20,'change_emailtemplate','Can change Email Template');
INSERT INTO "AUTH_PERMISSION" VALUES(58,20,'delete_emailtemplate','Can delete Email Template');
INSERT INTO "AUTH_PERMISSION" VALUES(59,21,'add_log','Can add Log');
INSERT INTO "AUTH_PERMISSION" VALUES(60,21,'change_log','Can change Log');
INSERT INTO "AUTH_PERMISSION" VALUES(61,21,'delete_log','Can delete Log');
INSERT INTO "AUTH_PERMISSION" VALUES(62,22,'add_termsandconditions','Can add Terms and Conditions');
INSERT INTO "AUTH_PERMISSION" VALUES(63,22,'change_termsandconditions','Can change Terms and Conditions');
INSERT INTO "AUTH_PERMISSION" VALUES(64,22,'delete_termsandconditions','Can delete Terms and Conditions');
INSERT INTO "AUTH_PERMISSION" VALUES(65,23,'add_usertermsandconditions','Can add User Terms and Conditions');
INSERT INTO "AUTH_PERMISSION" VALUES(66,23,'change_usertermsandconditions','Can change User Terms and Conditions');
INSERT INTO "AUTH_PERMISSION" VALUES(67,23,'delete_usertermsandconditions','Can delete User Terms and Conditions');
INSERT INTO "AUTH_PERMISSION" VALUES(68,24,'add_token','Can add token');
INSERT INTO "AUTH_PERMISSION" VALUES(69,24,'change_token','Can change token');
INSERT INTO "AUTH_PERMISSION" VALUES(70,24,'delete_token','Can delete token');
INSERT INTO "AUTH_PERMISSION" VALUES(71,25,'add_tokenv2','Can add token v2');
INSERT INTO "AUTH_PERMISSION" VALUES(72,25,'change_tokenv2','Can change token v2');
INSERT INTO "AUTH_PERMISSION" VALUES(73,25,'delete_tokenv2','Can delete token v2');
INSERT INTO "AUTH_PERMISSION" VALUES(74,26,'add_avatar','Can add avatar');
INSERT INTO "AUTH_PERMISSION" VALUES(75,26,'change_avatar','Can change avatar');
INSERT INTO "AUTH_PERMISSION" VALUES(76,26,'delete_avatar','Can delete avatar');
INSERT INTO "AUTH_PERMISSION" VALUES(77,27,'add_groupavatar','Can add group avatar');
INSERT INTO "AUTH_PERMISSION" VALUES(78,27,'change_groupavatar','Can change group avatar');
INSERT INTO "AUTH_PERMISSION" VALUES(79,27,'delete_groupavatar','Can delete group avatar');
INSERT INTO "AUTH_PERMISSION" VALUES(80,28,'add_contact','Can add contact');
INSERT INTO "AUTH_PERMISSION" VALUES(81,28,'change_contact','Can change contact');
INSERT INTO "AUTH_PERMISSION" VALUES(82,28,'delete_contact','Can delete contact');
INSERT INTO "AUTH_PERMISSION" VALUES(83,29,'add_draft','Can add draft');
INSERT INTO "AUTH_PERMISSION" VALUES(84,29,'change_draft','Can change draft');
INSERT INTO "AUTH_PERMISSION" VALUES(85,29,'delete_draft','Can delete draft');
INSERT INTO "AUTH_PERMISSION" VALUES(86,30,'add_draftreviewer','Can add draft reviewer');
INSERT INTO "AUTH_PERMISSION" VALUES(87,30,'change_draftreviewer','Can change draft reviewer');
INSERT INTO "AUTH_PERMISSION" VALUES(88,30,'delete_draftreviewer','Can delete draft reviewer');
INSERT INTO "AUTH_PERMISSION" VALUES(89,31,'add_institution','Can add institution');
INSERT INTO "AUTH_PERMISSION" VALUES(90,31,'change_institution','Can change institution');
INSERT INTO "AUTH_PERMISSION" VALUES(91,31,'delete_institution','Can delete institution');
INSERT INTO "AUTH_PERMISSION" VALUES(92,32,'add_institutionadmin','Can add institution admin');
INSERT INTO "AUTH_PERMISSION" VALUES(93,32,'change_institutionadmin','Can change institution admin');
INSERT INTO "AUTH_PERMISSION" VALUES(94,32,'delete_institutionadmin','Can delete institution admin');
INSERT INTO "AUTH_PERMISSION" VALUES(95,33,'add_institutionquota','Can add institution quota');
INSERT INTO "AUTH_PERMISSION" VALUES(96,33,'change_institutionquota','Can change institution quota');
INSERT INTO "AUTH_PERMISSION" VALUES(97,33,'delete_institutionquota','Can delete institution quota');
INSERT INTO "AUTH_PERMISSION" VALUES(98,34,'add_invitation','Can add invitation');
INSERT INTO "AUTH_PERMISSION" VALUES(99,34,'change_invitation','Can change invitation');
INSERT INTO "AUTH_PERMISSION" VALUES(100,34,'delete_invitation','Can delete invitation');
INSERT INTO "AUTH_PERMISSION" VALUES(101,35,'add_reposhareinvitation','Can add repo share invitation');
INSERT INTO "AUTH_PERMISSION" VALUES(102,35,'change_reposhareinvitation','Can change repo share invitation');
INSERT INTO "AUTH_PERMISSION" VALUES(103,35,'delete_reposhareinvitation','Can delete repo share invitation');
INSERT INTO "AUTH_PERMISSION" VALUES(104,36,'add_wiki','Can add wiki');
INSERT INTO "AUTH_PERMISSION" VALUES(105,36,'change_wiki','Can change wiki');
INSERT INTO "AUTH_PERMISSION" VALUES(106,36,'delete_wiki','Can delete wiki');
INSERT INTO "AUTH_PERMISSION" VALUES(107,37,'add_notification','Can add notification');
INSERT INTO "AUTH_PERMISSION" VALUES(108,37,'change_notification','Can change notification');
INSERT INTO "AUTH_PERMISSION" VALUES(109,37,'delete_notification','Can delete notification');
INSERT INTO "AUTH_PERMISSION" VALUES(110,38,'add_usernotification','Can add user notification');
INSERT INTO "AUTH_PERMISSION" VALUES(111,38,'change_usernotification','Can change user notification');
INSERT INTO "AUTH_PERMISSION" VALUES(112,38,'delete_usernotification','Can delete user notification');
INSERT INTO "AUTH_PERMISSION" VALUES(113,39,'add_useroptions','Can add user options');
INSERT INTO "AUTH_PERMISSION" VALUES(114,39,'change_useroptions','Can change user options');
INSERT INTO "AUTH_PERMISSION" VALUES(115,39,'delete_useroptions','Can delete user options');
INSERT INTO "AUTH_PERMISSION" VALUES(116,40,'add_detailedprofile','Can add detailed profile');
INSERT INTO "AUTH_PERMISSION" VALUES(117,40,'change_detailedprofile','Can change detailed profile');
INSERT INTO "AUTH_PERMISSION" VALUES(118,40,'delete_detailedprofile','Can delete detailed profile');
INSERT INTO "AUTH_PERMISSION" VALUES(119,41,'add_profile','Can add profile');
INSERT INTO "AUTH_PERMISSION" VALUES(120,41,'change_profile','Can change profile');
INSERT INTO "AUTH_PERMISSION" VALUES(121,41,'delete_profile','Can delete profile');
INSERT INTO "AUTH_PERMISSION" VALUES(122,42,'add_anonymousshare','Can add anonymous share');
INSERT INTO "AUTH_PERMISSION" VALUES(123,42,'change_anonymousshare','Can change anonymous share');
INSERT INTO "AUTH_PERMISSION" VALUES(124,42,'delete_anonymousshare','Can delete anonymous share');
INSERT INTO "AUTH_PERMISSION" VALUES(125,43,'add_extragroupssharepermission','Can add extra groups share permission');
INSERT INTO "AUTH_PERMISSION" VALUES(126,43,'change_extragroupssharepermission','Can change extra groups share permission');
INSERT INTO "AUTH_PERMISSION" VALUES(127,43,'delete_extragroupssharepermission','Can delete extra groups share permission');
INSERT INTO "AUTH_PERMISSION" VALUES(128,44,'add_extrasharepermission','Can add extra share permission');
INSERT INTO "AUTH_PERMISSION" VALUES(129,44,'change_extrasharepermission','Can change extra share permission');
INSERT INTO "AUTH_PERMISSION" VALUES(130,44,'delete_extrasharepermission','Can delete extra share permission');
INSERT INTO "AUTH_PERMISSION" VALUES(131,45,'add_fileshare','Can add file share');
INSERT INTO "AUTH_PERMISSION" VALUES(132,45,'change_fileshare','Can change file share');
INSERT INTO "AUTH_PERMISSION" VALUES(133,45,'delete_fileshare','Can delete file share');
INSERT INTO "AUTH_PERMISSION" VALUES(134,46,'add_orgfileshare','Can add org file share');
INSERT INTO "AUTH_PERMISSION" VALUES(135,46,'change_orgfileshare','Can change org file share');
INSERT INTO "AUTH_PERMISSION" VALUES(136,46,'delete_orgfileshare','Can delete org file share');
INSERT INTO "AUTH_PERMISSION" VALUES(137,47,'add_privatefiledirshare','Can add private file dir share');
INSERT INTO "AUTH_PERMISSION" VALUES(138,47,'change_privatefiledirshare','Can change private file dir share');
INSERT INTO "AUTH_PERMISSION" VALUES(139,47,'delete_privatefiledirshare','Can delete private file dir share');
INSERT INTO "AUTH_PERMISSION" VALUES(140,48,'add_uploadlinkshare','Can add upload link share');
INSERT INTO "AUTH_PERMISSION" VALUES(141,48,'change_uploadlinkshare','Can change upload link share');
INSERT INTO "AUTH_PERMISSION" VALUES(142,48,'delete_uploadlinkshare','Can delete upload link share');
INSERT INTO "AUTH_PERMISSION" VALUES(143,49,'add_adminlog','Can add admin log');
INSERT INTO "AUTH_PERMISSION" VALUES(144,49,'change_adminlog','Can change admin log');
INSERT INTO "AUTH_PERMISSION" VALUES(145,49,'delete_adminlog','Can delete admin log');
INSERT INTO "AUTH_PERMISSION" VALUES(146,50,'add_filetag','Can add file tag');
INSERT INTO "AUTH_PERMISSION" VALUES(147,50,'change_filetag','Can change file tag');
INSERT INTO "AUTH_PERMISSION" VALUES(148,50,'delete_filetag','Can delete file tag');
INSERT INTO "AUTH_PERMISSION" VALUES(149,51,'add_fileuuidmap','Can add file uuid map');
INSERT INTO "AUTH_PERMISSION" VALUES(150,51,'change_fileuuidmap','Can change file uuid map');
INSERT INTO "AUTH_PERMISSION" VALUES(151,51,'delete_fileuuidmap','Can delete file uuid map');
INSERT INTO "AUTH_PERMISSION" VALUES(152,52,'add_tags','Can add tags');
INSERT INTO "AUTH_PERMISSION" VALUES(153,52,'change_tags','Can change tags');
INSERT INTO "AUTH_PERMISSION" VALUES(154,52,'delete_tags','Can delete tags');
INSERT INTO "AUTH_PERMISSION" VALUES(155,53,'add_revisiontags','Can add revision tags');
INSERT INTO "AUTH_PERMISSION" VALUES(156,53,'change_revisiontags','Can change revision tags');
INSERT INTO "AUTH_PERMISSION" VALUES(157,53,'delete_revisiontags','Can delete revision tags');
INSERT INTO "AUTH_PERMISSION" VALUES(158,54,'add_tags','Can add tags');
INSERT INTO "AUTH_PERMISSION" VALUES(159,54,'change_tags','Can change tags');
INSERT INTO "AUTH_PERMISSION" VALUES(160,54,'delete_tags','Can delete tags');
INSERT INTO "AUTH_PERMISSION" VALUES(161,55,'add_phonedevice','Can add phone device');
INSERT INTO "AUTH_PERMISSION" VALUES(162,55,'change_phonedevice','Can change phone device');
INSERT INTO "AUTH_PERMISSION" VALUES(163,55,'delete_phonedevice','Can delete phone device');
INSERT INTO "AUTH_PERMISSION" VALUES(164,56,'add_staticdevice','Can add static device');
INSERT INTO "AUTH_PERMISSION" VALUES(165,56,'change_staticdevice','Can change static device');
INSERT INTO "AUTH_PERMISSION" VALUES(166,56,'delete_staticdevice','Can delete static device');
INSERT INTO "AUTH_PERMISSION" VALUES(167,57,'add_statictoken','Can add static token');
INSERT INTO "AUTH_PERMISSION" VALUES(168,57,'change_statictoken','Can change static token');
INSERT INTO "AUTH_PERMISSION" VALUES(169,57,'delete_statictoken','Can delete static token');
INSERT INTO "AUTH_PERMISSION" VALUES(170,58,'add_totpdevice','Can add TOTP device');
INSERT INTO "AUTH_PERMISSION" VALUES(171,58,'change_totpdevice','Can change TOTP device');
INSERT INTO "AUTH_PERMISSION" VALUES(172,58,'delete_totpdevice','Can delete TOTP device');
INSERT INTO "AUTH_PERMISSION" VALUES(173,59,'add_adminrole','Can add admin role');
INSERT INTO "AUTH_PERMISSION" VALUES(174,59,'change_adminrole','Can change admin role');
INSERT INTO "AUTH_PERMISSION" VALUES(175,59,'delete_adminrole','Can delete admin role');
INSERT INTO "AUTH_PERMISSION" VALUES(176,60,'add_trustedip','Can add trusted ip');
INSERT INTO "AUTH_PERMISSION" VALUES(177,60,'change_trustedip','Can change trusted ip');
INSERT INTO "AUTH_PERMISSION" VALUES(178,60,'delete_trustedip','Can delete trusted ip');
INSERT INTO "AUTH_PERMISSION" VALUES(179,61,'add_repotags','Can add repo tags');
INSERT INTO "AUTH_PERMISSION" VALUES(180,61,'change_repotags','Can change repo tags');
INSERT INTO "AUTH_PERMISSION" VALUES(181,61,'delete_repotags','Can delete repo tags');
INSERT INTO "AUTH_PERMISSION" VALUES(182,62,'add_filetags','Can add file tags');
INSERT INTO "AUTH_PERMISSION" VALUES(183,62,'change_filetags','Can change file tags');
INSERT INTO "AUTH_PERMISSION" VALUES(184,62,'delete_filetags','Can delete file tags');
INSERT INTO "AUTH_PERMISSION" VALUES(185,63,'add_relatedfiles','Can add related files');
INSERT INTO "AUTH_PERMISSION" VALUES(186,63,'change_relatedfiles','Can change related files');
INSERT INTO "AUTH_PERMISSION" VALUES(187,63,'delete_relatedfiles','Can delete related files');
INSERT INTO "AUTH_PERMISSION" VALUES(188,64,'add_fileparticipant','Can add file participant');
INSERT INTO "AUTH_PERMISSION" VALUES(189,64,'change_fileparticipant','Can change file participant');
INSERT INTO "AUTH_PERMISSION" VALUES(190,64,'delete_fileparticipant','Can delete file participant');
INSERT INTO "AUTH_PERMISSION" VALUES(191,65,'add_repoapitokens','Can add repo api tokens');
INSERT INTO "AUTH_PERMISSION" VALUES(192,65,'change_repoapitokens','Can change repo api tokens');
INSERT INTO "AUTH_PERMISSION" VALUES(193,65,'delete_repoapitokens','Can delete repo api tokens');
INSERT INTO "AUTH_PERMISSION" VALUES(194,66,'add_abusereport','Can add abuse report');
INSERT INTO "AUTH_PERMISSION" VALUES(195,66,'change_abusereport','Can change abuse report');
INSERT INTO "AUTH_PERMISSION" VALUES(196,66,'delete_abusereport','Can delete abuse report');
INSERT INTO "AUTH_PERMISSION" VALUES(197,67,'add_userloginlog','Can add user login log');
INSERT INTO "AUTH_PERMISSION" VALUES(198,67,'change_userloginlog','Can change user login log');
INSERT INTO "AUTH_PERMISSION" VALUES(199,67,'delete_userloginlog','Can delete user login log');
INSERT INTO "AUTH_PERMISSION" VALUES(200,68,'add_orgmemberquota','Can add org member quota');
INSERT INTO "AUTH_PERMISSION" VALUES(201,68,'change_orgmemberquota','Can change org member quota');
INSERT INTO "AUTH_PERMISSION" VALUES(202,68,'delete_orgmemberquota','Can delete org member quota');
INSERT INTO "AUTH_PERMISSION" VALUES(203,69,'add_orgsettings','Can add org settings');
INSERT INTO "AUTH_PERMISSION" VALUES(204,69,'change_orgsettings','Can change org settings');
INSERT INTO "AUTH_PERMISSION" VALUES(205,69,'delete_orgsettings','Can delete org settings');
INSERT INTO "AUTH_PERMISSION" VALUES(206,70,'add_proxygrantingticket','Can add proxy granting ticket');
INSERT INTO "AUTH_PERMISSION" VALUES(207,70,'change_proxygrantingticket','Can change proxy granting ticket');
INSERT INTO "AUTH_PERMISSION" VALUES(208,70,'delete_proxygrantingticket','Can delete proxy granting ticket');
INSERT INTO "AUTH_PERMISSION" VALUES(209,71,'add_sessionticket','Can add session ticket');
INSERT INTO "AUTH_PERMISSION" VALUES(210,71,'change_sessionticket','Can change session ticket');
INSERT INTO "AUTH_PERMISSION" VALUES(211,71,'delete_sessionticket','Can delete session ticket');
INSERT INTO "AUTH_PERMISSION" VALUES(212,72,'add_userplan','Can add user plan');
INSERT INTO "AUTH_PERMISSION" VALUES(213,72,'change_userplan','Can change user plan');
INSERT INTO "AUTH_PERMISSION" VALUES(214,72,'delete_userplan','Can delete user plan');
INSERT INTO "AUTH_PERMISSION" VALUES(215,73,'add_orgplan','Can add org plan');
INSERT INTO "AUTH_PERMISSION" VALUES(216,73,'change_orgplan','Can change org plan');
INSERT INTO "AUTH_PERMISSION" VALUES(217,73,'delete_orgplan','Can delete org plan');
CREATE TABLE IF NOT EXISTS "AUTH_GROUP_PERMISSIONS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "group_id" integer NOT NULL REFERENCES "auth_group" ("id"), "permission_id" integer NOT NULL REFERENCES "AUTH_PERMISSION" ("id"));
CREATE TABLE IF NOT EXISTS "AUTH_USER_GROUPS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user_id" integer NOT NULL REFERENCES "AUTH_USER" ("id"), "group_id" integer NOT NULL REFERENCES "auth_group" ("id"));
CREATE TABLE IF NOT EXISTS "AUTH_USER_USER_PERMISSIONS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user_id" integer NOT NULL REFERENCES "AUTH_USER" ("id"), "permission_id" integer NOT NULL REFERENCES "AUTH_PERMISSION" ("id"));
CREATE TABLE IF NOT EXISTS "AVATAR_AVATAR" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "emailuser" varchar(255) NOT NULL, "primary"  INTEGER NOT NULL, "avatar" varchar(1024) NOT NULL, "date_uploaded" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "AVATAR_GROUPAVATAR" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "group_id" varchar(255) NOT NULL, "avatar" varchar(1024) NOT NULL, "date_uploaded" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "TAGS_FILEUUIDMAP" ("uuid" varchar(32) NOT NULL PRIMARY KEY, "repo_id" varchar(36) NOT NULL, "repo_id_parent_path_md5" varchar(100) NOT NULL, "parent_path" text NOT NULL, "filename" varchar(1024) NOT NULL, "is_dir"  INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "TAGS_TAGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "name" varchar(255) NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "TAGS_FILETAG" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "tag_id" integer NOT NULL REFERENCES "TAGS_TAGS" ("id"), "uuid_id" varchar(32) NOT NULL REFERENCES "TAGS_FILEUUIDMAP" ("uuid"));
CREATE TABLE IF NOT EXISTS "BASE_CLIENTLOGINTOKEN" ("token" varchar(32) NOT NULL PRIMARY KEY, "username" varchar(255) NOT NULL, "timestamp" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "BASE_COMMANDSLASTCHECK" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "command_type" varchar(100) NOT NULL, "last_check" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "BASE_DEVICETOKEN" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "token" varchar(80) NOT NULL, "user" varchar(255) NOT NULL, "platform" varchar(32) NOT NULL, "version" varchar(16) NOT NULL, "pversion" varchar(16) NOT NULL);
CREATE TABLE IF NOT EXISTS "BASE_USERLASTLOGIN" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "last_login" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "BASE_USERSTARREDFILES" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "email" varchar(254) NOT NULL, "org_id" integer NOT NULL, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "is_dir"  INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "BASE_REPOSECRETKEY" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL UNIQUE, "secret_key" varchar(44) NOT NULL);
CREATE TABLE IF NOT EXISTS "BASE_FILECOMMENT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "author" varchar(255) NOT NULL, "comment" text NOT NULL, "created_at" BIGINT NOT NULL, "updated_at" BIGINT NOT NULL, "uuid_id" varchar(32) NOT NULL REFERENCES "TAGS_FILEUUIDMAP" ("uuid"), "detail" text NOT NULL, "resolved"  INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "SOCIAL_AUTH_USERSOCIALAUTH" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "provider" varchar(32) NOT NULL, "uid" varchar(255) NOT NULL, "extra_data" text NULL);
CREATE TABLE IF NOT EXISTS "CAPTCHA_CAPTCHASTORE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "challenge" varchar(32) NOT NULL, "response" varchar(32) NOT NULL, "hashkey" varchar(40) NOT NULL UNIQUE, "expiration" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "CONTACTS_CONTACT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user_email" varchar(255) NOT NULL, "contact_email" varchar(255) NOT NULL, "contact_name" varchar(255) NULL, "note" varchar(255) NULL);
CREATE TABLE IF NOT EXISTS "CONSTANCE_CONFIG" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "constance_key" varchar(255) NOT NULL UNIQUE, "value" text NULL);
CREATE TABLE IF NOT EXISTS "DJANGO_CAS_NG_SESSIONTICKET" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "session_key" varchar(255) NOT NULL, "ticket" varchar(255) NOT NULL);
CREATE TABLE IF NOT EXISTS "DJANGO_CAS_NG_PROXYGRANTINGTICKET" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "session_key" varchar(255) NULL, "pgtiou" varchar(255) NULL, "pgt" varchar(255) NULL, "date" BIGINT NOT NULL, "user" varchar(255) NOT NULL);
CREATE TABLE IF NOT EXISTS "DRAFTS_DRAFT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "created_at" BIGINT NOT NULL, "updated_at" BIGINT NOT NULL, "username" varchar(255) NOT NULL, "origin_file_version" varchar(100) NOT NULL, "draft_file_path" varchar(1024) NOT NULL, "origin_file_uuid" varchar(32) NOT NULL UNIQUE, "publish_file_version" varchar(100) NULL, "status" varchar(20) NOT NULL, "origin_repo_id" varchar(36) NOT NULL);
CREATE TABLE IF NOT EXISTS "DRAFTS_DRAFTREVIEWER" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "reviewer" varchar(255) NOT NULL, "draft_id" integer NOT NULL REFERENCES "DRAFTS_DRAFT" ("id"));
CREATE TABLE IF NOT EXISTS "FILE_PARTICIPANTS_FILEPARTICIPANT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "uuid_id" varchar(32) NOT NULL REFERENCES "TAGS_FILEUUIDMAP" ("uuid"));
CREATE TABLE IF NOT EXISTS "REPO_TAGS_REPOTAGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "name" varchar(255) NOT NULL, "color" varchar(255) NOT NULL);
CREATE TABLE IF NOT EXISTS "FILE_TAGS_FILETAGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "file_uuid_id" varchar(32) NOT NULL REFERENCES "TAGS_FILEUUIDMAP" ("uuid"), "repo_tag_id" integer NOT NULL REFERENCES "REPO_TAGS_REPOTAGS" ("id"));
CREATE TABLE IF NOT EXISTS "INSTITUTIONS_INSTITUTION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "name" varchar(200) NOT NULL, "create_time" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "INSTITUTIONS_INSTITUTIONQUOTA" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "quota" bigint NOT NULL, "institution_id" integer NOT NULL REFERENCES "INSTITUTIONS_INSTITUTION" ("id"));
CREATE TABLE IF NOT EXISTS "INSTITUTIONS_INSTITUTIONADMIN" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "institution_id" integer NOT NULL REFERENCES "INSTITUTIONS_INSTITUTION" ("id"), "user" varchar(255) NOT NULL);
CREATE TABLE IF NOT EXISTS "INVITATIONS_INVITATION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "token" varchar(40) NOT NULL, "inviter" varchar(255) NOT NULL, "accepter" varchar(255) NOT NULL, "invite_time" BIGINT NOT NULL, "accept_time" BIGINT NULL, "invite_type" varchar(20) NOT NULL, "expire_time" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "REPO_SHARE_INVITATION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "permission" varchar(50) NOT NULL, "invitation_id" integer NOT NULL REFERENCES "INVITATIONS_INVITATION" ("id"));
CREATE TABLE IF NOT EXISTS "NOTIFICATIONS_NOTIFICATION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "message" varchar(512) NOT NULL, "primary"  INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "NOTIFICATIONS_USERNOTIFICATION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "to_user" varchar(255) NOT NULL, "msg_type" varchar(30) NOT NULL, "detail" text NOT NULL, "seen"  INTEGER NOT NULL, "timestamp" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "OPTIONS_USEROPTIONS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "email" varchar(255) NOT NULL, "option_val" varchar(512) NOT NULL, "option_key" varchar(50) NOT NULL);
CREATE TABLE IF NOT EXISTS "ORGANIZATIONS_ORGMEMBERQUOTA" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "org_id" integer NOT NULL, "quota" integer NOT NULL);
CREATE TABLE IF NOT EXISTS "ORGANIZATIONS_ORGSETTINGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "role" varchar(100) NULL, "org_id" integer NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "POST_OFFICE_EMAIL" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "from_email" varchar(254) NOT NULL, "to" text NOT NULL, "cc" text NOT NULL, "bcc" text NOT NULL, "subject" varchar(989) NOT NULL, "message" text NOT NULL, "html_message" text NOT NULL, "status" INTEGER NULL, "priority" INTEGER NULL, "created" BIGINT NOT NULL, "last_updated" BIGINT NOT NULL, "scheduled_time" BIGINT NULL, "headers" text NULL, "context" text NULL, "backend_alias" varchar(64) NOT NULL, "template_id" integer NULL REFERENCES "POST_OFFICE_EMAILTEMPLATE" ("id"));
CREATE TABLE IF NOT EXISTS "POST_OFFICE_EMAILTEMPLATE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "description" text NOT NULL, "subject" varchar(255) NOT NULL, "content" text NOT NULL, "html_content" text NOT NULL, "created" BIGINT NOT NULL, "last_updated" BIGINT NOT NULL, "language" varchar(12) NOT NULL, "name" varchar(255) NOT NULL, "default_template_id" integer NULL REFERENCES "POST_OFFICE_EMAILTEMPLATE" ("id"));
CREATE TABLE IF NOT EXISTS "POST_OFFICE_ATTACHMENT_EMAILS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "attachment_id" integer NOT NULL REFERENCES "POST_OFFICE_ATTACHMENT" ("id"), "email_id" integer NOT NULL REFERENCES "POST_OFFICE_EMAIL" ("id"));
CREATE TABLE IF NOT EXISTS "POST_OFFICE_LOG" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "date" BIGINT NOT NULL, "exception_type" varchar(255) NOT NULL, "message" text NOT NULL, "email_id" integer NOT NULL REFERENCES "POST_OFFICE_EMAIL" ("id"), "status" INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "POST_OFFICE_ATTACHMENT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "file" varchar(100) NOT NULL, "name" varchar(255) NOT NULL, "mimetype" varchar(255) NOT NULL, "headers" text NULL);
CREATE TABLE IF NOT EXISTS "PROFILE_DETAILEDPROFILE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user" varchar(255) NOT NULL, "department" varchar(512) NOT NULL, "telephone" varchar(100) NOT NULL);
CREATE TABLE IF NOT EXISTS "PROFILE_PROFILE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user" varchar(254) NOT NULL UNIQUE, "nickname" varchar(64) NOT NULL, "intro" text NOT NULL, "lang_code" text NULL, "login_id" varchar(225) NULL UNIQUE, "institution" varchar(225) NULL, "list_in_address_book"  INTEGER NOT NULL, "contact_email" varchar(225) NULL UNIQUE,"is_manually_set_contact_email" integer DEFAULT 0);
CREATE TABLE IF NOT EXISTS "REGISTRATION_REGISTRATIONPROFILE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "emailuser_id" integer NOT NULL, "activation_key" varchar(40) NOT NULL);
CREATE TABLE IF NOT EXISTS "RELATED_FILES_RELATEDFILES" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "o_uuid_id" varchar(32) NOT NULL REFERENCES "TAGS_FILEUUIDMAP" ("uuid"), "r_uuid_id" varchar(32) NOT NULL REFERENCES "TAGS_FILEUUIDMAP" ("uuid"));
CREATE TABLE IF NOT EXISTS "REPO_API_TOKENS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "app_name" varchar(255) NOT NULL, "token" varchar(40) NOT NULL UNIQUE, "generated_at" BIGINT NOT NULL, "generated_by" varchar(255) NOT NULL, "last_access" BIGINT NOT NULL, "permission" varchar(15) NOT NULL);
CREATE TABLE IF NOT EXISTS "REVISION_TAG_TAGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "name" varchar(255) NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "REVISION_TAG_REVISIONTAGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "revision_id" varchar(255) NOT NULL, "username" varchar(255) NOT NULL, "tag_id" integer NOT NULL REFERENCES "REVISION_TAG_TAGS" ("id"));
CREATE TABLE IF NOT EXISTS "ROLE_PERMISSIONS_ADMINROLE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "email" varchar(254) NOT NULL UNIQUE, "role" varchar(255) NOT NULL);
CREATE TABLE IF NOT EXISTS "DJANGO_SESSION" ("session_key" varchar(40) NOT NULL PRIMARY KEY, "session_data" text NOT NULL, "expire_date" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "SHARE_ANONYMOUSSHARE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_owner" varchar(255) NOT NULL, "repo_id" varchar(36) NOT NULL, "anonymous_email" varchar(255) NOT NULL, "token" varchar(25) NOT NULL UNIQUE);
CREATE TABLE IF NOT EXISTS "SHARE_EXTRAGROUPSSHAREPERMISSION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "group_id" integer NOT NULL, "permission" varchar(30) NOT NULL);
CREATE TABLE IF NOT EXISTS "SHARE_EXTRASHAREPERMISSION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "share_to" varchar(255) NOT NULL, "permission" varchar(30) NOT NULL);
CREATE TABLE IF NOT EXISTS "SHARE_FILESHARE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "token" varchar(100) NOT NULL UNIQUE, "ctime" BIGINT NOT NULL, "view_cnt" integer NOT NULL, "s_type" varchar(2) NOT NULL, "password" varchar(128) NULL, "expire_date" BIGINT NULL, "permission" varchar(50) NOT NULL, "user_scope" varchar(225) DEFAULT 'all_users', "authed_details" TEXT DEFAULT NULL);
CREATE TABLE IF NOT EXISTS "SHARE_ORGFILESHARE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "org_id" integer NOT NULL, "file_share_id" integer NOT NULL UNIQUE REFERENCES "SHARE_FILESHARE" ("id"));
CREATE TABLE IF NOT EXISTS "SHARE_PRIVATEFILEDIRSHARE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "from_user" varchar(255) NOT NULL, "to_user" varchar(255) NOT NULL, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "token" varchar(10) NOT NULL UNIQUE, "permission" varchar(5) NOT NULL, "s_type" varchar(5) NOT NULL);
CREATE TABLE IF NOT EXISTS "SHARE_UPLOADLINKSHARE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "repo_id" varchar(36) NOT NULL, "path" text NOT NULL, "token" varchar(100) NOT NULL UNIQUE, "ctime" BIGINT NOT NULL, "view_cnt" integer NOT NULL, "password" varchar(128) NULL, "expire_date" BIGINT NULL);
CREATE TABLE IF NOT EXISTS "SYSADMIN_EXTRA_USERLOGINLOG" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "login_date" BIGINT NOT NULL, "login_ip" varchar(128) NOT NULL, "login_success"  INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "TERMSANDCONDITIONS_TERMSANDCONDITIONS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "slug" varchar(50) NOT NULL, "name" text NOT NULL, "version_number" decimal NOT NULL, "text" text NULL, "info" text NULL, "date_active" BIGINT NULL, "date_created" BIGINT NOT NULL);
CREATE TABLE IF NOT EXISTS "TERMSANDCONDITIONS_USERTERMSANDCONDITIONS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "ip_address" varchar(39) NULL, "date_accepted" BIGINT NOT NULL, "terms_id" integer NOT NULL REFERENCES "TERMSANDCONDITIONS_TERMSANDCONDITIONS" ("id"));
CREATE TABLE IF NOT EXISTS "TRUSTED_IP_TRUSTEDIP" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "ip" varchar(255) NOT NULL);
CREATE TABLE IF NOT EXISTS "TWO_FACTOR_PHONEDEVICE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user" varchar(255) NOT NULL UNIQUE, "name" varchar(64) NOT NULL, "confirmed"  INTEGER NOT NULL, "number" varchar(40) NOT NULL, "key" varchar(40) NOT NULL, "method" varchar(4) NOT NULL);
CREATE TABLE IF NOT EXISTS "TWO_FACTOR_STATICDEVICE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user" varchar(255) NOT NULL UNIQUE, "name" varchar(64) NOT NULL, "confirmed"  INTEGER NOT NULL);
CREATE TABLE IF NOT EXISTS "TWO_FACTOR_STATICTOKEN" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "token" varchar(16) NOT NULL, "device_id" integer NOT NULL REFERENCES "TWO_FACTOR_STATICDEVICE" ("id"));
CREATE TABLE IF NOT EXISTS "TWO_FACTOR_TOTPDEVICE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "user" varchar(255) NOT NULL UNIQUE, "name" varchar(64) NOT NULL, "confirmed"  INTEGER NOT NULL, "key" varchar(80) NOT NULL, "step" INTEGER NOT NULL, "t0" bigint NOT NULL, "digits" INTEGER NOT NULL, "tolerance" INTEGER NOT NULL, "drift" INTEGER NOT NULL, "last_t" bigint NOT NULL);
CREATE TABLE IF NOT EXISTS "WIKI_WIKI" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "username" varchar(255) NOT NULL, "name" varchar(255) NOT NULL, "slug" varchar(255) NOT NULL UNIQUE, "permission" varchar(50) NOT NULL, "created_at" BIGINT NOT NULL, "repo_id" varchar(36) NOT NULL);
CREATE INDEX IF NOT EXISTS "ABUSE_REPORTS_ABUSEREPORT_abuse_type_703d5335" ON "ABUSE_REPORTS_ABUSEREPORT" ("abuse_type");
CREATE INDEX IF NOT EXISTS "ABUSE_REPORTS_ABUSEREPORT_handled_94b8304c" ON "ABUSE_REPORTS_ABUSEREPORT" ("handled");
CREATE INDEX IF NOT EXISTS "ADMIN_LOG_ADMINLOG_email_7213c993" ON "ADMIN_LOG_ADMINLOG" ("email");
CREATE INDEX IF NOT EXISTS "ADMIN_LOG_ADMINLOG_operation_4bad7bd1" ON "ADMIN_LOG_ADMINLOG" ("operation");
CREATE UNIQUE INDEX IF NOT EXISTS  "API2_TOKENV2_user_platform_device_id_37005c24_uniq" ON "API2_TOKENV2" ("user", "platform", "device_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "DJANGO_CONTENT_TYPE_app_label_model_76bd3d3b_uniq" ON "DJANGO_CONTENT_TYPE" ("app_label", "model");
CREATE UNIQUE INDEX IF NOT EXISTS  "AUTH_GROUP_PERMISSIONS_group_id_permission_id_0cd325b0_uniq" ON "AUTH_GROUP_PERMISSIONS" ("group_id", "permission_id");
CREATE INDEX IF NOT EXISTS "AUTH_GROUP_PERMISSIONS_group_id_b120cbf9" ON "AUTH_GROUP_PERMISSIONS" ("group_id");
CREATE INDEX IF NOT EXISTS "AUTH_GROUP_PERMISSIONS_permission_id_84c5c92e" ON "AUTH_GROUP_PERMISSIONS" ("permission_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "AUTH_USER_GROUPS_user_id_group_id_94350c0c_uniq" ON "AUTH_USER_GROUPS" ("user_id", "group_id");
CREATE INDEX IF NOT EXISTS "AUTH_USER_GROUPS_user_id_6a12ed8b" ON "AUTH_USER_GROUPS" ("user_id");
CREATE INDEX IF NOT EXISTS "AUTH_USER_GROUPS_group_id_97559544" ON "AUTH_USER_GROUPS" ("group_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "AUTH_USER_USER_PERMISSIONS_user_id_permission_id_14a6b632_uniq" ON "AUTH_USER_USER_PERMISSIONS" ("user_id", "permission_id");
CREATE INDEX IF NOT EXISTS "AUTH_USER_USER_PERMISSIONS_user_id_a95ead1b" ON "AUTH_USER_USER_PERMISSIONS" ("user_id");
CREATE INDEX IF NOT EXISTS "AUTH_USER_USER_PERMISSIONS_permission_id_1fbb5f2c" ON "AUTH_USER_USER_PERMISSIONS" ("permission_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "AUTH_PERMISSION_content_type_id_codename_01ab375a_uniq" ON "AUTH_PERMISSION" ("content_type_id", "codename");
CREATE INDEX IF NOT EXISTS "AUTH_PERMISSION_content_type_id_2f476e4b" ON "AUTH_PERMISSION" ("content_type_id");
CREATE INDEX IF NOT EXISTS "TAGS_FILEUUIDMAP_repo_id_ac67aa33" ON "TAGS_FILEUUIDMAP" ("repo_id");
CREATE INDEX IF NOT EXISTS "TAGS_FILEUUIDMAP_repo_id_parent_path_md5_c8bb0860" ON "TAGS_FILEUUIDMAP" ("repo_id_parent_path_md5");
CREATE INDEX IF NOT EXISTS "TAGS_FILETAG_tag_id_0f264fc9" ON "TAGS_FILETAG" ("tag_id");
CREATE INDEX IF NOT EXISTS "TAGS_FILETAG_uuid_id_2aa2266c" ON "TAGS_FILETAG" ("uuid_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "BASE_DEVICETOKEN_token_user_38535636_uniq" ON "BASE_DEVICETOKEN" ("token", "user");
CREATE INDEX IF NOT EXISTS "BASE_CLIENTLOGINTOKEN_username_4ad5d42c" ON "BASE_CLIENTLOGINTOKEN" ("username");
CREATE INDEX IF NOT EXISTS "BASE_USERLASTLOGIN_username_270de06f" ON "BASE_USERLASTLOGIN" ("username");
CREATE INDEX IF NOT EXISTS "BASE_USERSTARREDFILES_email_29e69053" ON "BASE_USERSTARREDFILES" ("email");
CREATE INDEX IF NOT EXISTS "BASE_USERSTARREDFILES_repo_id_f5ecc00a" ON "BASE_USERSTARREDFILES" ("repo_id");
CREATE INDEX IF NOT EXISTS "SOCIAL_AUTH_USERSOCIALAUTH_username_3f06b5cf" ON "SOCIAL_AUTH_USERSOCIALAUTH" ("username");
CREATE INDEX IF NOT EXISTS "BASE_FILECOMMENT_author_8a4d7e91" ON "BASE_FILECOMMENT" ("author");
CREATE INDEX IF NOT EXISTS "BASE_FILECOMMENT_uuid_id_4f9a2ca2" ON "BASE_FILECOMMENT" ("uuid_id");
CREATE INDEX IF NOT EXISTS "BASE_FILECOMMENT_resolved_e0717eca" ON "BASE_FILECOMMENT" ("resolved");
CREATE UNIQUE INDEX IF NOT EXISTS  "SOCIAL_AUTH_USERSOCIALAUTH_provider_uid_e6b5e668_uniq" ON "SOCIAL_AUTH_USERSOCIALAUTH" ("provider", "uid");
CREATE INDEX IF NOT EXISTS "CONTACTS_CONTACT_user_email_149035d4" ON "CONTACTS_CONTACT" ("user_email");
CREATE UNIQUE INDEX IF NOT EXISTS  "DJANGO_CAS_NG_PROXYGRANTINGTICKET_session_key_user_8a4ec2bc_uniq" ON "DJANGO_CAS_NG_PROXYGRANTINGTICKET" ("session_key", "user");
CREATE INDEX IF NOT EXISTS "DJANGO_CAS_NG_PROXYGRANTINGTICKET_user_1f42619d" ON "DJANGO_CAS_NG_PROXYGRANTINGTICKET" ("user");
CREATE INDEX IF NOT EXISTS "DRAFTS_DRAFTREVIEWER_reviewer_e4c777ac" ON "DRAFTS_DRAFTREVIEWER" ("reviewer");
CREATE INDEX IF NOT EXISTS "DRAFTS_DRAFTREVIEWER_draft_id_4ea59775" ON "DRAFTS_DRAFTREVIEWER" ("draft_id");
CREATE INDEX IF NOT EXISTS "DRAFTS_DRAFT_created_at_e9f4523f" ON "DRAFTS_DRAFT" ("created_at");
CREATE INDEX IF NOT EXISTS "DRAFTS_DRAFT_updated_at_0a144b05" ON "DRAFTS_DRAFT" ("updated_at");
CREATE INDEX IF NOT EXISTS "DRAFTS_DRAFT_username_73e6738b" ON "DRAFTS_DRAFT" ("username");
CREATE INDEX IF NOT EXISTS "DRAFTS_DRAFT_origin_repo_id_8978ca2c" ON "DRAFTS_DRAFT" ("origin_repo_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "FILE_PARTICIPANTS_FILEPARTICIPANT_uuid_id_username_c747dd36_uniq" ON "FILE_PARTICIPANTS_FILEPARTICIPANT" ("uuid_id", "username");
CREATE INDEX IF NOT EXISTS "FILE_PARTICIPANTS_FILEPARTICIPANT_uuid_id_861b7339" ON "FILE_PARTICIPANTS_FILEPARTICIPANT" ("uuid_id");
CREATE INDEX IF NOT EXISTS "REPO_TAGS_REPOTAGS_repo_id_1163a48f" ON "REPO_TAGS_REPOTAGS" ("repo_id");
CREATE INDEX IF NOT EXISTS "REPO_TAGS_REPOTAGS_name_3f4c9027" ON "REPO_TAGS_REPOTAGS" ("name");
CREATE INDEX IF NOT EXISTS "REPO_TAGS_REPOTAGS_color_1292b6c1" ON "REPO_TAGS_REPOTAGS" ("color");
CREATE INDEX IF NOT EXISTS "FILE_TAGS_FILETAGS_file_uuid_id_e30f0ec8" ON "FILE_TAGS_FILETAGS" ("file_uuid_id");
CREATE INDEX IF NOT EXISTS "FILE_TAGS_FILETAGS_repo_tag_id_c39660cb" ON "FILE_TAGS_FILETAGS" ("repo_tag_id");
CREATE INDEX IF NOT EXISTS "INSTITUTIONS_INSTITUTIONQUOTA_institution_id_d23201d9" ON "INSTITUTIONS_INSTITUTIONQUOTA" ("institution_id");
CREATE INDEX IF NOT EXISTS "INSTITUTIONS_INSTITUTIONADMIN_institution_id_1e9bb58b" ON "INSTITUTIONS_INSTITUTIONADMIN" ("institution_id");
CREATE INDEX IF NOT EXISTS "INSTITUTIONS_INSTITUTIONADMIN_user_c71d766d" ON "INSTITUTIONS_INSTITUTIONADMIN" ("user");
CREATE INDEX IF NOT EXISTS "INVITATIONS_INVITATION_token_25a92a38" ON "INVITATIONS_INVITATION" ("token");
CREATE INDEX IF NOT EXISTS "INVITATIONS_INVITATION_inviter_b0a7b855" ON "INVITATIONS_INVITATION" ("inviter");
CREATE INDEX IF NOT EXISTS "REPO_SHARE_INVITATION_repo_id_7bcf84fa" ON "REPO_SHARE_INVITATION" ("repo_id");
CREATE INDEX IF NOT EXISTS "REPO_SHARE_INVITATION_invitation_id_b71effd2" ON "REPO_SHARE_INVITATION" ("invitation_id");
CREATE INDEX IF NOT EXISTS "NOTIFICATIONS_NOTIFICATION_primary_4f95ec21" ON "NOTIFICATIONS_NOTIFICATION" ("primary");
CREATE INDEX IF NOT EXISTS "NOTIFICATIONS_USERNOTIFICATION_to_user_6cadafa1" ON "NOTIFICATIONS_USERNOTIFICATION" ("to_user");
CREATE INDEX IF NOT EXISTS "NOTIFICATIONS_USERNOTIFICATION_msg_type_985afd02" ON "NOTIFICATIONS_USERNOTIFICATION" ("msg_type");
CREATE INDEX IF NOT EXISTS "NOTIFICATIONS_USERNOTIFICATION_timestamp_125067e8" ON "NOTIFICATIONS_USERNOTIFICATION" ("timestamp");
CREATE INDEX IF NOT EXISTS "OPTIONS_USEROPTIONS_email_77d5726a" ON "OPTIONS_USEROPTIONS" ("email");
CREATE INDEX IF NOT EXISTS "OPTIONS_USEROPTIONS_option_key_7bf7ae4b" ON "OPTIONS_USEROPTIONS" ("option_key");
CREATE INDEX IF NOT EXISTS "ORGANIZATIONS_ORGMEMBERQUOTA_org_id_93dde51d" ON "ORGANIZATIONS_ORGMEMBERQUOTA" ("org_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "POST_OFFICE_ATTACHMENT_EMAILS_attachment_id_email_id_8e046917_uniq" ON "POST_OFFICE_ATTACHMENT_EMAILS" ("attachment_id", "email_id");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_ATTACHMENT_EMAILS_attachment_id_6136fd9a" ON "POST_OFFICE_ATTACHMENT_EMAILS" ("attachment_id");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_ATTACHMENT_EMAILS_email_id_96875fd9" ON "POST_OFFICE_ATTACHMENT_EMAILS" ("email_id");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_EMAIL_status_013a896c" ON "POST_OFFICE_EMAIL" ("status");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_EMAIL_created_1306952f" ON "POST_OFFICE_EMAIL" ("created");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_EMAIL_last_updated_0ffcec35" ON "POST_OFFICE_EMAIL" ("last_updated");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_EMAIL_scheduled_time_3869ebec" ON "POST_OFFICE_EMAIL" ("scheduled_time");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_EMAIL_template_id_417da7da" ON "POST_OFFICE_EMAIL" ("template_id");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_EMAILTEMPLATE_default_template_id_2ac2f889" ON "POST_OFFICE_EMAILTEMPLATE" ("default_template_id");
CREATE INDEX IF NOT EXISTS "POST_OFFICE_LOG_email_id_d42c8808" ON "POST_OFFICE_LOG" ("email_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "POST_OFFICE_EMAILTEMPLATE_name_language_default_template_id_4023e3e4_uniq" ON "POST_OFFICE_EMAILTEMPLATE" ("name", "language", "default_template_id");
CREATE INDEX IF NOT EXISTS "PROFILE_DETAILEDPROFILE_user_612c11ba" ON "PROFILE_DETAILEDPROFILE" ("user");
CREATE INDEX IF NOT EXISTS "PROFILE_PROFILE_institution_c0286bd1" ON "PROFILE_PROFILE" ("institution");
CREATE INDEX IF NOT EXISTS "PROFILE_PROFILE_list_in_address_book_b1009a78" ON "PROFILE_PROFILE" ("list_in_address_book");
CREATE INDEX IF NOT EXISTS "RELATED_FILES_RELATEDFILES_o_uuid_id_aaa8e613" ON "RELATED_FILES_RELATEDFILES" ("o_uuid_id");
CREATE INDEX IF NOT EXISTS "RELATED_FILES_RELATEDFILES_r_uuid_id_031751df" ON "RELATED_FILES_RELATEDFILES" ("r_uuid_id");
CREATE INDEX IF NOT EXISTS "REPO_API_TOKENS_repo_id_47a50fef" ON "REPO_API_TOKENS" ("repo_id");
CREATE INDEX IF NOT EXISTS "REPO_API_TOKENS_app_name_7c395c31" ON "REPO_API_TOKENS" ("app_name");
CREATE INDEX IF NOT EXISTS "REVISION_TAG_REVISIONTAGS_repo_id_212c0c69" ON "REVISION_TAG_REVISIONTAGS" ("repo_id");
CREATE INDEX IF NOT EXISTS "REVISION_TAG_REVISIONTAGS_revision_id_fd9fe0f9" ON "REVISION_TAG_REVISIONTAGS" ("revision_id");
CREATE INDEX IF NOT EXISTS "REVISION_TAG_REVISIONTAGS_username_3007d29e" ON "REVISION_TAG_REVISIONTAGS" ("username");
CREATE INDEX IF NOT EXISTS "REVISION_TAG_REVISIONTAGS_tag_id_ee4e9b00" ON "REVISION_TAG_REVISIONTAGS" ("tag_id");
CREATE INDEX IF NOT EXISTS "DJANGO_SESSION_expire_date_a5c62663" ON "DJANGO_SESSION" ("expire_date");
CREATE INDEX IF NOT EXISTS "SHARE_EXTRAGROUPSSHAREPERMISSION_repo_id_38dbaea1" ON "SHARE_EXTRAGROUPSSHAREPERMISSION" ("repo_id");
CREATE INDEX IF NOT EXISTS "SHARE_EXTRAGROUPSSHAREPERMISSION_group_id_6ca34bb2" ON "SHARE_EXTRAGROUPSSHAREPERMISSION" ("group_id");
CREATE INDEX IF NOT EXISTS "SHARE_EXTRASHAREPERMISSION_repo_id_23cc10fc" ON "SHARE_EXTRASHAREPERMISSION" ("repo_id");
CREATE INDEX IF NOT EXISTS "SHARE_EXTRASHAREPERMISSION_share_to_823c16cb" ON "SHARE_EXTRASHAREPERMISSION" ("share_to");
CREATE INDEX IF NOT EXISTS "SHARE_ORGFILESHARE_org_id_8d17998c" ON "SHARE_ORGFILESHARE" ("org_id");
CREATE INDEX IF NOT EXISTS "SHARE_UPLOADLINKSHARE_username_3203c243" ON "SHARE_UPLOADLINKSHARE" ("username");
CREATE INDEX IF NOT EXISTS "SHARE_UPLOADLINKSHARE_repo_id_c519f857" ON "SHARE_UPLOADLINKSHARE" ("repo_id");
CREATE INDEX IF NOT EXISTS "SHARE_UPLOADLINKSHARE_expire_date" ON "SHARE_UPLOADLINKSHARE" ("expire_date");
CREATE INDEX IF NOT EXISTS "SHARE_FILESHARE_username_5cb6de75" ON "SHARE_FILESHARE" ("username");
CREATE INDEX IF NOT EXISTS "SHARE_FILESHARE_repo_id_9b5ae27a" ON "SHARE_FILESHARE" ("repo_id");
CREATE INDEX IF NOT EXISTS "SHARE_FILESHARE_s_type_724eb6c1" ON "SHARE_FILESHARE" ("s_type");
CREATE INDEX IF NOT EXISTS "SHARE_FILESHARE_permission_d12c353f" ON "SHARE_FILESHARE" ("permission");
CREATE INDEX IF NOT EXISTS "SHARE_FILESHARE_idx_ctime" ON "SHARE_FILESHARE" ("ctime");
CREATE INDEX IF NOT EXISTS "SHARE_FILESHARE_idx_view_cnt" ON "SHARE_FILESHARE" ("view_cnt");
CREATE INDEX IF NOT EXISTS "SHARE_PRIVATEFILEDIRSHARE_from_user_d568d535" ON "SHARE_PRIVATEFILEDIRSHARE" ("from_user");
CREATE INDEX IF NOT EXISTS "SHARE_PRIVATEFILEDIRSHARE_to_user_2a92a044" ON "SHARE_PRIVATEFILEDIRSHARE" ("to_user");
CREATE INDEX IF NOT EXISTS "SHARE_PRIVATEFILEDIRSHARE_repo_id_97c5cb6f" ON "SHARE_PRIVATEFILEDIRSHARE" ("repo_id");
CREATE INDEX IF NOT EXISTS "SYSADMIN_EXTRA_USERLOGINLOG_username_5748b9e3" ON "SYSADMIN_EXTRA_USERLOGINLOG" ("username");
CREATE INDEX IF NOT EXISTS "SYSADMIN_EXTRA_USERLOGINLOG_login_date_c171d790" ON "SYSADMIN_EXTRA_USERLOGINLOG" ("login_date");
CREATE UNIQUE INDEX IF NOT EXISTS  "TERMSANDCONDITIONS_USERTERMSANDCONDITIONS_username_terms_id_a7dabb70_uniq" ON "TERMSANDCONDITIONS_USERTERMSANDCONDITIONS" ("username", "terms_id");
CREATE INDEX IF NOT EXISTS "TERMSANDCONDITIONS_TERMSANDCONDITIONS_slug_489d1e9d" ON "TERMSANDCONDITIONS_TERMSANDCONDITIONS" ("slug");
CREATE INDEX IF NOT EXISTS "TERMSANDCONDITIONS_USERTERMSANDCONDITIONS_terms_id_eacdbcc7" ON "TERMSANDCONDITIONS_USERTERMSANDCONDITIONS" ("terms_id");
CREATE INDEX IF NOT EXISTS "TRUSTED_IP_TRUSTEDIP_ip_e898970c" ON "TRUSTED_IP_TRUSTEDIP" ("ip");
CREATE INDEX IF NOT EXISTS "TWO_FACTOR_STATICTOKEN_token_2ade1084" ON "TWO_FACTOR_STATICTOKEN" ("token");
CREATE INDEX IF NOT EXISTS "TWO_FACTOR_STATICTOKEN_device_id_93095b45" ON "TWO_FACTOR_STATICTOKEN" ("device_id");
CREATE UNIQUE INDEX IF NOT EXISTS  "WIKI_WIKI_username_repo_id_4c8925af_uniq" ON "WIKI_WIKI" ("username", "repo_id");
CREATE INDEX IF NOT EXISTS "WIKI_WIKI_created_at_54930e39" ON "WIKI_WIKI" ("created_at");
CREATE INDEX IF NOT EXISTS "WIKI_WIKI_repo_id_2ee93c37" ON "WIKI_WIKI" ("repo_id");
CREATE TABLE IF NOT EXISTS "OCM_SHARE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "shared_secret" varchar(36) NOT NULL UNIQUE, "from_user" varchar(255) NOT NULL, "to_user" varchar(255) NOT NULL, "to_server_url" varchar(200) NOT NULL, "repo_id" varchar(36) NOT NULL, "repo_name" varchar(255) NOT NULL, "permission" varchar(50) NOT NULL, "path" text NOT NULL, "ctime" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "OCM_SHARE_from_user_7fbb7bb6" ON "OCM_SHARE" ("from_user");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_to_user_4e255523" ON "OCM_SHARE" ("to_user");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_to_server_url_43f0e89b" ON "OCM_SHARE" ("to_server_url");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_repo_id_51937581" ON "OCM_SHARE" ("repo_id");
CREATE TABLE IF NOT EXISTS "OCM_SHARE_RECEIVED" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "shared_secret" varchar(36) NOT NULL UNIQUE, "from_user" varchar(255) NOT NULL, "to_user" varchar(255) NOT NULL, "from_server_url" varchar(200) NOT NULL, "repo_id" varchar(36) NOT NULL, "repo_name" varchar(255) NOT NULL, "permission" varchar(50) NOT NULL, "path" text NOT NULL, "provider_id" varchar(40) NOT NULL, "ctime" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "OCM_SHARE_RECEIVED_from_user_8137d8eb" ON "OCM_SHARE_RECEIVED" ("from_user");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_RECEIVED_to_user_0921d09a" ON "OCM_SHARE_RECEIVED" ("to_user");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_RECEIVED_from_server_url_10527b80" ON "OCM_SHARE_RECEIVED" ("from_server_url");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_RECEIVED_repo_id_9e77a1b9" ON "OCM_SHARE_RECEIVED" ("repo_id");
CREATE INDEX IF NOT EXISTS "OCM_SHARE_RECEIVED_provider_id_60c873e0" ON "OCM_SHARE_RECEIVED" ("provider_id");
CREATE TABLE IF NOT EXISTS "REPO_AUTO_DELETE" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL UNIQUE, "days" integer NOT NULL);
CREATE TABLE IF NOT EXISTS "EXTERNAL_DEPARTMENT" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "group_id" integer NOT NULL UNIQUE, "provider" varchar(32) NOT NULL, "outer_id" bigint NOT NULL);
CREATE UNIQUE INDEX IF NOT EXISTS  "EXTERNAL_DEPARTMENT_provider_outer_id_8dns6vkw_uniq" ON "EXTERNAL_DEPARTMENT" ("provider","outer_id");
CREATE TABLE IF NOT EXISTS "CUSTOM_SHARE_PERMISSION" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "name" varchar(255) NOT NULL, "description" varchar(500) NOT NULL, "permission" text NOT NULL);
CREATE INDEX IF NOT EXISTS "CUSTOM_SHARE_PERMISSION_repo_id_578fe49f" ON "CUSTOM_SHARE_PERMISSION" ("repo_id");
CREATE TABLE IF NOT EXISTS "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "description" varchar(255) NULL, "name" varchar(255) NOT NULL, "owner" varchar(255) NOT NULL, "owner_display_name" varchar(255) NULL, "protocol_name" varchar(255) NOT NULL, "shared_secret" varchar(255) NOT NULL, "permissions" varchar(255) NOT NULL, "provider_id" varchar(255) NOT NULL, "resource_type" varchar(255) NOT NULL, "share_type" varchar(255) NOT NULL, "share_with" varchar(255) NOT NULL, "shared_by" varchar(255) NOT NULL, "shared_by_display_name" varchar(255) NOT NULL, "ctime" BIGINT NOT NULL, "is_dir"  INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_owner_261eaa70" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("owner");
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_shared_secret_fbb6be5a" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("shared_secret");
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_provider_id_a55680e9" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("provider_id");
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_resource_type_a3c71b57" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("resource_type");
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_share_type_7615aaab" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("share_type");
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_share_with_5a23eb17" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("share_with");
CREATE INDEX IF NOT EXISTS "ocm_via_webdav_share_received_shared_by_1786d580" ON "OCM_VIA_WEBDAV_RECEIVED_SHARES" ("shared_by");
CREATE TABLE IF NOT EXISTS "ONLYOFFICE_ONLYOFFICEDOCKEY" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "doc_key" varchar(36) NOT NULL, "username" varchar(255) NOT NULL, "repo_id" varchar(36) NULL, "file_path" TEXT NOT NULL, "repo_id_file_path_md5" varchar(100) NOT NULL, "created_time" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "ONLYOFFICE_ONLYOFFICEDOCKEY_doc_key_edba1352" ON "ONLYOFFICE_ONLYOFFICEDOCKEY" ("doc_key");
CREATE INDEX IF NOT EXISTS "ONLYOFFICE_ONLYOFFICEDOCKEY_repo_id_file_path_md5_52002073" ON "ONLYOFFICE_ONLYOFFICEDOCKEY" ("repo_id_file_path_md5");
CREATE TABLE IF NOT EXISTS "ORG_SAML_CONFIG" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "org_id" integer NOT NULL UNIQUE, "metadata_url" TEXT NOT NULL, "domain" varchar(255) NULL UNIQUE, "dns_txt" varchar(64) NULL, "domain_verified" integer NOT NULL DEFAULT 0, "idp_certificate" text NULL);
CREATE INDEX IF NOT EXISTS "ORG_SAML_CONFIG_domain_verified_398065b9" ON "ORG_SAML_CONFIG" ("domain_verified");
CREATE TABLE IF NOT EXISTS "BASE_USERMONITOREDREPOS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "email" varchar(254) NOT NULL, "repo_id" varchar(36) NOT NULL, "timestamp" BIGINT NOT NULL, UNIQUE("email", "repo_id"));
CREATE INDEX IF NOT EXISTS "BASE_USERMONITOREDREPOS_email_55ead1b9" ON "BASE_USERMONITOREDREPOS" ("email");
CREATE INDEX IF NOT EXISTS "BASE_USERMONITOREDREPOS_repo_id_00e624c3" ON "BASE_USERMONITOREDREPOS" ("repo_id");
CREATE TABLE IF NOT EXISTS "ORGANIZATIONS_ORGADMINSETTINGS" ("id" integer NOT NULL PRIMARY KEY AUTO_INCREMENT, "org_id" integer NOT NULL, "key" varchar(255) NOT NULL, "value" TEXT NOT NULL, UNIQUE("org_id", "key"));
CREATE INDEX IF NOT EXISTS "ORGANIZATIONS_ORGADMINSETTINGS_org_id_4f70d186" ON "ORGANIZATIONS_ORGADMINSETTINGS" ("org_id");
CREATE TABLE IF NOT EXISTS "HISTORY_NAME" ("id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, "doc_uuid" varchar(36) NOT NULL, "obj_id" varchar(40) NOT NULL, "name" varchar(255) NOT NULL, UNIQUE("doc_uuid", "obj_id"));
CREATE INDEX IF NOT EXISTS "HISTORY_NAME_doc_uuid" ON "HISTORY_NAME" ("doc_uuid");
CREATE TABLE IF NOT EXISTS "SDOC_DRAFT" ("id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, "doc_uuid" varchar(36) NOT NULL UNIQUE, "repo_id" varchar(36) NOT NULL, "username" varchar(255) NOT NULL, "created_at" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "SDOC_DRAFT_repo_id" ON "SDOC_DRAFT" ("repo_id");
CREATE INDEX IF NOT EXISTS "SDOC_DRAFT_username" ON "SDOC_DRAFT" ("username");
CREATE TABLE IF NOT EXISTS "SDOC_REVISION" ("id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, "repo_id" varchar(36) NOT NULL, "revision_id" integer NOT NULL, "doc_uuid" varchar(36) NOT NULL UNIQUE, "origin_doc_uuid" varchar(36) NOT NULL, "origin_doc_path" text NOT NULL, "origin_file_version" varchar(100) NOT NULL, "publish_file_version" varchar(100) NULL, "username" varchar(255) NOT NULL, "publisher" varchar(255) NULL ,"is_published" integer NOT NULL, "created_at" BIGINT NOT NULL, "updated_at" BIGINT NOT NULL, UNIQUE("repo_id", "revision_id"));
CREATE INDEX IF NOT EXISTS "SDOC_REVISION_repo_id" ON "SDOC_REVISION" ("repo_id");
CREATE INDEX IF NOT EXISTS "SDOC_REVISION_origin_doc_uuid" ON "SDOC_REVISION" ("origin_doc_uuid");
CREATE INDEX IF NOT EXISTS "SDOC_REVISION_username" ON "SDOC_REVISION" ("username");
CREATE INDEX IF NOT EXISTS "SDOC_REVISION_is_published" ON "SDOC_REVISION" ("is_published");
CREATE TABLE IF NOT EXISTS "SDOC_COMMENT_REPLY" ("id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, "author" varchar(255) NOT NULL, "reply" text NOT NULL, "type" varchar(36) NOT NULL, "comment_id" integer NOT NULL, "doc_uuid" varchar(36) NOT NULL, "created_at" BIGINT NOT NULL, "updated_at" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "SDOC_COMMENT_REPLY_comment_id" ON "SDOC_COMMENT_REPLY" ("comment_id");
CREATE INDEX IF NOT EXISTS "SDOC_COMMENT_REPLY_doc_uuid" ON "SDOC_COMMENT_REPLY" ("doc_uuid");
CREATE TABLE IF NOT EXISTS "SDOC_NOTIFICATION" ("id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, "doc_uuid" varchar(36) NOT NULL UNIQUE, "username" varchar(255) NOT NULL, "msg_type" varchar(36) NOT NULL, "created_at" BIGINT NOT NULL, "detail" text NOT NULL, "seen" integer NOT NULL DEFAULT 0);
CREATE INDEX IF NOT EXISTS "SDOC_NOTIFICATION_doc_uuid_username" ON "SDOC_NOTIFICATION" ("doc_uuid", "username");
CREATE INDEX IF NOT EXISTS "SDOC_NOTIFICATION_created_at" ON "SDOC_NOTIFICATION" ("created_at");
CREATE TABLE IF NOT EXISTS "BASE_CLIENTSSOTOKEN" ("id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, "token" varchar(100) NOT NULL UNIQUE, "username" varchar(255) NULL, "status" varchar(10) NOT NULL, "api_key" varchar(40) NULL, "created_at" BIGINT NOT NULL, "updated_at" BIGINT NULL, "accessed_at" BIGINT NULL);
CREATE INDEX IF NOT EXISTS "BASE_CLIENTSSOTOKEN_username_651ec6b5" ON "BASE_CLIENTSSOTOKEN" ("username");
CREATE INDEX IF NOT EXISTS "BASE_CLIENTSSOTOKEN_created_at_d185d3e0" ON "BASE_CLIENTSSOTOKEN" ("created_at");
CREATE INDEX IF NOT EXISTS "BASE_CLIENTSSOTOKEN_updated_at_591fc2cd" ON "BASE_CLIENTSSOTOKEN" ("updated_at");
CREATE INDEX IF NOT EXISTS "BASE_CLIENTSSOTOKEN_accessed_at_cdc66bf3" ON "BASE_CLIENTSSOTOKEN" ("accessed_at");
CREATE TABLE IF NOT EXISTS "WIKI_WIKI2" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"owner" varchar(255) NOT NULL,"name" varchar(255) NOT NULL,"repo_id" varchar(36) NOT NULL,"created_at" BIGINT NOT NULL,UNIQUE("owner", "repo_id"));
CREATE INDEX IF NOT EXISTS "WIKI_WIKI_created_at_54930e36" ON "WIKI_WIKI2" ("created_at");
CREATE INDEX IF NOT EXISTS "WIKI_WIKI_repo_id_2ee93c31" ON "WIKI_WIKI2" ("repo_id");
CREATE TABLE IF NOT EXISTS "WIKIPAGETRASH" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"doc_uuid" TEXT NOT NULL,"page_id" varchar(4) NOT NULL,"parent_page_id" varchar(4) DEFAULT NULL,"subpages" TEXT,"name" varchar(255) NOT NULL,"delete_time" BIGINT NOT NULL,"size" INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_WIKIPAGETRASH_repo_id" ON "WIKIPAGETRASH" ("repo_id");
CREATE TABLE IF NOT EXISTS "FILETRASH" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"user" varchar(255) NOT NULL,"obj_type" varchar(10) NOT NULL,"obj_id" varchar(40) NOT NULL,"obj_name" varchar(255) NOT NULL,"delete_time" BIGINT NOT NULL,"repo_id" varchar(36) NOT NULL,"commit_id" varchar(40) DEFAULT NULL,"path" TEXT NOT NULL,"size" INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_FILETRASH_repo_id" ON "FILETRASH" ("repo_id");
CREATE TABLE IF NOT EXISTS "REPO_METADATA" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"enabled" INTEGER NOT NULL,"face_recognition_enabled" INTEGER DEFAULT NULL,"last_face_cluster_time" BIGINT DEFAULT NULL,"modified_time" BIGINT NOT NULL,"created_time" BIGINT NOT NULL,"from_commit" varchar(40) DEFAULT NULL,"to_commit" varchar(40) DEFAULT NULL,UNIQUE("repo_id"));
CREATE INDEX IF NOT EXISTS "key_REPO_METADATA_enabled" ON "REPO_METADATA" ("enabled");
CREATE INDEX IF NOT EXISTS "key_REPO_METADATA_face_recognition_enabled" ON "REPO_METADATA" ("face_recognition_enabled");
CREATE TABLE IF NOT EXISTS "REPO_METADATA_VIEW" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"details" TEXT NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_repo_meatadata_view_repo_id" ON "REPO_METADATA_VIEW" ("repo_id");
CREATE TABLE IF NOT EXISTS "SDOC_OPERATION_LOG" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"doc_uuid" varchar(36) NOT NULL,"op_id" BIGINT NOT NULL,"op_time" BIGINT NOT NULL,"operations" TEXT NOT NULL,"author" varchar(255) NOT NULL);
CREATE INDEX IF NOT EXISTS "SDOC_OPERATION_LOG_op_time" ON "SDOC_OPERATION_LOG" ("op_time");
CREATE INDEX IF NOT EXISTS "SDOC_OPERATION_LOG_doc_uuid" ON "SDOC_OPERATION_LOG" ("doc_uuid");
CREATE INDEX IF NOT EXISTS "sdoc_idx_operation_log_doc_uuid_op_id" ON "SDOC_OPERATION_LOG" ("doc_uuid", "op_id");
CREATE TABLE IF NOT EXISTS "WIKI_WIKI2_PUBLISH" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"publish_url" varchar(40) DEFAULT NULL,"username" varchar(255) NOT NULL,"created_at" BIGINT NOT NULL,"visit_count" INTEGER NOT NULL DEFAULT 0,UNIQUE("repo_id"),UNIQUE("publish_url"));
CREATE INDEX IF NOT EXISTS "ix_wiki2_publish_repo_id" ON "WIKI_WIKI2_PUBLISH" ("repo_id");


-- seafevents
CREATE TABLE IF NOT EXISTS "DELETED_FILES_COUNT" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"deleted_time" BIGINT NOT NULL,"files_count" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_DELETED_FILES_COUNT_repo_id" ON "DELETED_FILES_COUNT" ("repo_id");
CREATE INDEX IF NOT EXISTS "ix_DELETED_FILES_COUNT_deleted_time" ON "DELETED_FILES_COUNT" ("deleted_time");
CREATE TABLE IF NOT EXISTS "CONTENTSCANRECORD" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"commit_id" varchar(40) NOT NULL,"timestamp" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_CONTENTSCANRECORD_repo_id" ON "CONTENTSCANRECORD" ("repo_id");
CREATE TABLE IF NOT EXISTS "CONTENTSCANRESULT" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"path" text NOT NULL,"platform" varchar(32) NOT NULL,"detail" text NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_CONTENTSCANRESULT_repo_id" ON "CONTENTSCANRESULT" ("repo_id");
CREATE TABLE IF NOT EXISTS "ACTIVITY" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"op_type" varchar(128) NOT NULL,"op_user" varchar(255) NOT NULL,"obj_type" varchar(128) NOT NULL,"timestamp" BIGINT NOT NULL,"repo_id" varchar(36) NOT NULL,"commit_id" varchar(40) DEFAULT NULL,"path" text NOT NULL,"detail" text NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_ACTIVITY_timestamp" ON "ACTIVITY" ("timestamp");
CREATE TABLE IF NOT EXISTS "USERACTIVITY" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"username" varchar(255) NOT NULL,"activity_id" BIGINT DEFAULT NULL,"timestamp" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "activity_id" ON "USERACTIVITY" ("activity_id");
CREATE INDEX IF NOT EXISTS "ix_USERACTIVITY_timestamp" ON "USERACTIVITY" ("timestamp");
CREATE INDEX IF NOT EXISTS "idx_username_timestamp" ON "USERACTIVITY" ("username", "timestamp");
CREATE TABLE IF NOT EXISTS "FILEHISTORY" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"op_type" varchar(128) NOT NULL,"op_user" varchar(255) NOT NULL,"timestamp" BIGINT NOT NULL,"repo_id" varchar(36) NOT NULL,"commit_id" varchar(40) DEFAULT NULL,"file_id" varchar(340) NOT NULL,"file_uuid" varchar(40) DEFAULT NULL,"path" text NOT NULL,"repo_id_path_md5" varchar(32) DEFAULT NULL,"size" BIGINT NOT NULL,"old_path" text NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_FILEHISTORY_file_uuid" ON "FILEHISTORY" ("file_uuid");
CREATE INDEX IF NOT EXISTS "ix_FILEHISTORY_timestamp" ON "FILEHISTORY" ("timestamp");
CREATE TABLE IF NOT EXISTS "FILEAUDIT" ("eid" INTEGER PRIMARY KEY AUTO_INCREMENT,"timestamp" BIGINT NOT NULL,"etype" varchar(128) NOT NULL,"user" varchar(255) NOT NULL,"ip" varchar(45) NOT NULL,"device" text NOT NULL,"org_id" INTEGER NOT NULL,"repo_id" varchar(36) NOT NULL,"file_path" text NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_FILEAUDIT_user" ON "FILEAUDIT" ("user");
CREATE INDEX IF NOT EXISTS "idx_file_audit_user_orgid_eid" ON "FILEAUDIT" ("user", "org_id", "eid");
CREATE INDEX IF NOT EXISTS "idx_file_audit_repo_org_eid" ON "FILEAUDIT" ("repo_id", "org_id", "eid");
CREATE INDEX IF NOT EXISTS "ix_FILEAUDIT_timestamp" ON "FILEAUDIT" ("timestamp");
CREATE INDEX IF NOT EXISTS "ix_FILEAUDIT_repo_id" ON "FILEAUDIT" ("repo_id");
CREATE TABLE IF NOT EXISTS "FILEUPDATE" ("eid" INTEGER PRIMARY KEY AUTO_INCREMENT,"timestamp" BIGINT NOT NULL,"user" varchar(255) NOT NULL,"org_id" INTEGER NOT NULL,"repo_id" varchar(36) NOT NULL,"commit_id" varchar(40) NOT NULL,"file_oper" text NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_file_update_user_orgid_eid" ON "FILEUPDATE" ("user", "org_id", "eid");
CREATE INDEX IF NOT EXISTS "ix_FILEUPDATE_timestamp" ON "FILEUPDATE" ("timestamp");
CREATE INDEX IF NOT EXISTS "idx_file_update_repo_org_eid" ON "FILEUPDATE" ("repo_id", "org_id", "eid");
CREATE TABLE IF NOT EXISTS "PERMAUDIT" ("eid" INTEGER PRIMARY KEY AUTO_INCREMENT,"timestamp" BIGINT NOT NULL,"etype" varchar(128) NOT NULL,"from_user" varchar(255) NOT NULL,"to" varchar(255) NOT NULL,"org_id" INTEGER NOT NULL,"repo_id" varchar(36) NOT NULL,"file_path" text NOT NULL,"permission" varchar(15) NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_perm_audit_repo_org_eid" ON "PERMAUDIT" ("repo_id", "org_id", "eid");
CREATE INDEX IF NOT EXISTS "idx_perm_audit_user_orgid_eid" ON "PERMAUDIT" ("from_user", "org_id", "eid");
CREATE TABLE IF NOT EXISTS "TOTALSTORAGESTAT" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"timestamp" BIGINT NOT NULL,"total_size" BIGINT NOT NULL,"org_id" INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_storage_time_org" ON "TOTALSTORAGESTAT" ("timestamp", "org_id");
CREATE TABLE IF NOT EXISTS "FILEOPSSTAT" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"timestamp" BIGINT NOT NULL,"op_type" varchar(16) NOT NULL,"number" INTEGER NOT NULL,"org_id" INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_file_ops_time_org" ON "FILEOPSSTAT" ("timestamp", "org_id");
CREATE TABLE IF NOT EXISTS "USERACTIVITYSTAT" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"name_time_md5" varchar(32) DEFAULT NULL,"username" varchar(255) DEFAULT NULL,"timestamp" BIGINT NOT NULL,"org_id" INTEGER NOT NULL,UNIQUE("name_time_md5"));
CREATE INDEX IF NOT EXISTS "idx_activity_time_org" ON "USERACTIVITYSTAT" ("timestamp", "org_id");
CREATE INDEX IF NOT EXISTS "ix_USERACTIVITYSTAT_timestamp" ON "USERACTIVITYSTAT" ("timestamp");
CREATE TABLE IF NOT EXISTS "USERTRAFFIC" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"user" varchar(255) NOT NULL,"org_id" INTEGER DEFAULT NULL,"timestamp" BIGINT NOT NULL,"op_type" varchar(48) NOT NULL,"size" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_USERTRAFFIC_org_id" ON "USERTRAFFIC" ("org_id");
CREATE INDEX IF NOT EXISTS "idx_traffic_time_user" ON "USERTRAFFIC" ("timestamp", "user", "org_id");
CREATE TABLE IF NOT EXISTS "SYSTRAFFIC" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"org_id" INTEGER DEFAULT NULL,"timestamp" BIGINT NOT NULL,"op_type" varchar(48) NOT NULL,"size" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_SYSTRAFFIC_time_org" ON "SYSTRAFFIC" ("timestamp", "org_id");
CREATE INDEX IF NOT EXISTS "ix_SYSTRAFFIC_org_id" ON "SYSTRAFFIC" ("org_id");
CREATE TABLE IF NOT EXISTS "MONTHLYSYSTRAFFIC" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"org_id" INTEGER DEFAULT NULL,"timestamp" BIGINT NOT NULL,"web_file_upload" BIGINT NOT NULL,"web_file_download" BIGINT NOT NULL,"sync_file_upload" BIGINT NOT NULL,"sync_file_download" BIGINT NOT NULL,"link_file_upload" BIGINT NOT NULL,"link_file_download" BIGINT NOT NULL);
CREATE INDEX IF NOT EXISTS "idx_MONTHLYSYSTRAFFIC_time_org" ON "MONTHLYSYSTRAFFIC" ("timestamp", "org_id");
CREATE TABLE IF NOT EXISTS "VIRUSSCANRECORD" ("repo_id" varchar(36) NOT NULL PRIMARY KEY,"scan_commit_id" varchar(40) NOT NULL);
CREATE TABLE IF NOT EXISTS "VIRUSFILE" ("vid" INTEGER PRIMARY KEY AUTO_INCREMENT,"repo_id" varchar(36) NOT NULL,"commit_id" varchar(40) NOT NULL,"file_path" text NOT NULL,"has_deleted" INTEGER NOT NULL,"has_ignored" INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS "ix_VIRUSFILE_has_ignored" ON "VIRUSFILE" ("has_ignored");
CREATE INDEX IF NOT EXISTS "ix_VIRUSFILE_has_deleted" ON "VIRUSFILE" ("has_deleted");
CREATE TABLE IF NOT EXISTS "GROUPIDLDAPUUIDPAIR" ("id" INTEGER PRIMARY KEY AUTO_INCREMENT,"group_id" INTEGER NOT NULL UNIQUE,"group_uuid" varchar(36) NOT NULL UNIQUE);
