;              

DROP ALIAS IF EXISTS "public"."cast_to_numeric";               
CREATE FORCE ALIAS "public"."cast_to_numeric" FOR "docspell.store.impl.h2.CastNumericFun.castToNumeric";       
CREATE SEQUENCE "public"."SYSTEM_SEQUENCE_95446BBD_DF65_42A9_A00E_2556C5A54A0C" START WITH 977 BELONGS_TO_TABLE;               
CREATE CACHED TABLE "public"."flyway_schema_history"(
    "installed_rank" INT NOT NULL,
    "version" VARCHAR(50),
    "description" VARCHAR(200) NOT NULL,
    "type" VARCHAR(20) NOT NULL,
    "script" VARCHAR(1000) NOT NULL,
    "checksum" INT,
    "installed_by" VARCHAR(100) NOT NULL,
    "installed_on" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "execution_time" INT NOT NULL,
    "success" BOOLEAN NOT NULL
);         
ALTER TABLE "public"."flyway_schema_history" ADD CONSTRAINT "public"."flyway_schema_history_pk" PRIMARY KEY("installed_rank"); 
-- 35 +/- SELECT COUNT(*) FROM public.flyway_schema_history;   
INSERT INTO "public"."flyway_schema_history" VALUES
(-1, NULL, '<< Flyway Schema History table created >>', 'TABLE', '', NULL, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.222', 0, TRUE),
(1, '1.0.0', 'initial database', 'SQL', 'V1.0.0__initial_database.sql', 317337288, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.329', 49, TRUE),
(2, '1.1.0', 'useremail', 'SQL', 'V1.1.0__useremail.sql', 655930044, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.357', 8, TRUE),
(3, '1.2.0', 'origin source', 'SQL', 'V1.2.0__origin_source.sql', 811358974, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.375', 3, TRUE),
(4, '1.3.0', 'periodic job', 'SQL', 'V1.3.0__periodic_job.sql', -1440002901, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.391', 2, TRUE),
(5, '1.4.0', 'attachment archive', 'SQL', 'V1.4.0__attachment_archive.sql', 857738097, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.411', 3, TRUE),
(6, '1.5.0', 'userimap', 'SQL', 'V1.5.0__userimap.sql', 405891450, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.43', 3, TRUE),
(7, '1.6.0', 'integration enabled', 'SQL', 'V1.6.0__integration_enabled.sql', -1400448292, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.46', 13, TRUE),
(8, '1.7.0', 'fts-migration', 'SQL', 'V1.7.0__fts-migration.sql', 945262447, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.475', 1, TRUE),
(9, '1.8.0', 'folders', 'SQL', 'V1.8.0__folders.sql', 1074998524, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.515', 26, TRUE),
(10, '1.9.0', 'updated column', 'SQL', 'V1.9.0__updated_column.sql', -1023981633, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.558', 30, TRUE),
(11, '1.9.1', 'classifier', 'SQL', 'V1.9.1__classifier.sql', -920209386, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.572', 2, TRUE),
(12, '1.9.3', 'joblog counter', 'SQL', 'V1.9.3__joblog_counter.sql', 175554607, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.591', 6, TRUE),
(13, '1.9.4', 'unique equipments', 'SQL', 'V1.9.4__unique_equipments.sql', 770293754, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.605', 1, TRUE),
(14, '1.10.0', 'attachment preview', 'SQL', 'V1.10.0__attachment_preview.sql', 175251272, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.619', 2, TRUE),
(15, '1.11.0', 'pdf pages', 'SQL', 'V1.11.0__pdf_pages.sql', -235351002, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.636', 2, TRUE),
(16, '1.12.0', 'upload data', 'SQL', 'V1.12.0__upload_data.sql', -1136859296, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.656', 9, TRUE),
(17, '1.13.0', 'custom fields', 'SQL', 'V1.13.0__custom_fields.sql', 1090781225, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.674', 7, TRUE),
(18, '1.14.0', 'person org', 'SQL', 'V1.14.0__person_org.sql', -1121419990, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.692', 8, TRUE),
(19, '1.15.0', 'rememberme', 'SQL', 'V1.15.0__rememberme.sql', -456374843, 'DOCSPELL', TIMESTAMP '2021-01-03 20:49:32.708', 3, TRUE),
(20, '1.16.0', 'add imap oauth', 'SQL', 'V1.16.0__add_imap_oauth.sql', 1011393315, 'DOCSPELL', TIMESTAMP '2021-01-11 22:57:11.585', 74, TRUE),
(21, '1.17.0', 'meta language', 'SQL', 'V1.17.0__meta_language.sql', -1186679534, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:14.623', 97, TRUE),
(22, '1.18.0', 'classifier model', 'SQL', 'V1.18.0__classifier_model.sql', -1508014303, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:14.914', 147, TRUE),
(23, '1.19.0', 'add classify meta', 'SQL', 'V1.19.0__add_classify_meta.sql', -1255719254, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:15.019', 20, TRUE),
(24, '1.19.1', 'remove enabled', 'SQL', 'V1.19.1__remove_enabled.sql', 187540848, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:15.96', 19, TRUE),
(25, '1.20.0', 'personuse', 'SQL', 'V1.20.0__personuse.sql', 1870008223, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:16.109', 84, TRUE),
(26, '1.20.1', 'equipment description', 'SQL', 'V1.20.1__equipment_description.sql', 243680045, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:16.166', 18, TRUE),
(27, '1.20.2', 'org shortname', 'SQL', 'V1.20.2__org_shortname.sql', -1354794671, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:16.248', 32, TRUE),
(28, '1.20.3', 'node seen', 'SQL', 'V1.20.3__node_seen.sql', 763931359, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:16.344', 17, TRUE),
(29, '1.20.4', 'source lang', 'SQL', 'V1.20.4__source_lang.sql', 1895536250, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:16.436', 32, TRUE);  
INSERT INTO "public"."flyway_schema_history" VALUES
(30, '1.21.0', 'cast function', 'SQL', 'V1.21.0__cast_function.sql', -428878353, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:44.727', 27, TRUE),
(31, '1.21.1', 'equip org use', 'SQL', 'V1.21.1__equip_org_use.sql', 352694567, 'DOCSPELL', TIMESTAMP '2021-03-14 00:41:44.991', 131, TRUE),
(32, '1.22.0', 'add task name', 'SQL', 'V1.22.0__add_task_name.sql', -1625232914, 'DOCSPELL', TIMESTAMP '2021-05-29 14:02:47.320332', 48, TRUE),
(33, '1.23.0', 'clientsettings', 'SQL', 'V1.23.0__clientsettings.sql', 1152128793, 'DOCSPELL', TIMESTAMP '2021-05-29 14:02:47.454567', 17, TRUE),
(34, '1.24.0', 'drop fts migration', 'SQL', 'V1.24.0__drop_fts_migration.sql', -501760318, 'DOCSPELL', TIMESTAMP '2021-06-11 16:12:26.558332', 35, TRUE);     
CREATE INDEX "public"."flyway_schema_history_s_idx" ON "public"."flyway_schema_history"("success");            
CREATE CACHED TABLE "public"."filemeta"(
    "id" VARCHAR(254) NOT NULL,
    "timestamp" VARCHAR(40) NOT NULL,
    "mimetype" VARCHAR(254) NOT NULL,
    "length" BIGINT NOT NULL,
    "checksum" VARCHAR(254) NOT NULL,
    "chunks" INT NOT NULL,
    "chunksize" INT NOT NULL
);            
ALTER TABLE "public"."filemeta" ADD CONSTRAINT "public"."CONSTRAINT_D" PRIMARY KEY("id");      
-- 11 +/- SELECT COUNT(*) FROM public.filemeta;
INSERT INTO "public"."filemeta" VALUES
('DtG18bCtiGr-fGEwzMKktpB-tosSKp9g7ty-wDgXGffbp1f', '2021-01-03T21:13:33.143Z', 'application/pdf', 43627, 'c2de358a0974f9b047aed8e457def7d4b1b39170f44819ec3152b42db787d72e', 1, 524288),
('8jre1Sk2anC-XycazyE1d9M-UUjNsj1LsLu-zmZfiPwKB6J', '2021-01-03T21:13:34.674Z', 'application/pdf', 35462, '783587cd7e9aac2d973d76327d7357f2940a8956d5daa10cc3fe217481400579', 1, 524288),
('D8Cj2R2fmSM-z31GMJF61iG-BQnDzjGWeh1-bhQfBym5qrQ', '2021-01-03T21:13:35.419Z', 'image/png', 11412, 'a9ca9ff17de87d600cc0df41b47897ab85082dce6f06592118f8decf21400a8b', 1, 524288),
('JXziW35E2TW-zXPFxZeeNwA-M1fcdXMEdAL-FVYEyKNC7N', '2021-01-03T21:34:43.640Z', 'application/pdf', 34420, '40675c22ab035b8a4ffe760732b65e5f1d452c59b44d3d0a2a08a95d28853497', 1, 524288),
('BQR2G7GT5LQ-FKV4FQ1hnDu-9TSkF7nhUyz-nmpe9qDVvBd', '2021-01-03T21:34:45.147Z', 'application/pdf', 17244, '1dea317cb834622172ca4886a3f8c8d93552cd74f31d310b14ad85cef7d4875a', 1, 524288),
('7Vvy4bZfe3b-YCpAVWc8Lw9-wUkKLWjo3RL-4RnazGiQtnY', '2021-01-03T21:34:45.856Z', 'image/png', 12483, '57aa438ace1925d7913c94cbb9d435aedc8029ef415f967dd79e7ff9dd81ad7a', 1, 524288),
('8Zqe9ujkK9F-x8su5twLT6Q-N45WGGTmjzk-cf5xbFP9TDK', '2021-07-13T21:03:14.284073Z', 'application/gzip', 13088, 'c79b6e8a62c6b21961dc06d464947c242591799694c705d6d293ab7ad75ec9dd', 4, 4096),
('Fi8t9zhK4oj-qAUuNjvvkkk-8rdDiFgg7Cs-GY5ku8ArwUM', '2021-07-13T21:03:15.285774Z', 'application/gzip', 13095, '0296d7af528d64cd351e252256fc9060fdbfc1ab0bf5323a0e526238117aea24', 4, 4096),
('5VXHZhGz7UQ-x7rN8GNmhFP-bneB7vgdkEo-gEcwXC9XBPJ', '2021-07-13T21:03:15.806989Z', 'application/gzip', 13098, 'bc4cab804a91cb7fc50a7c0d0d7b0927e78d6cc9f1577b5ccc52dbec91523e25', 4, 4096),
('39fJiyTA5cF-NbFRocgVXsa-8HZq4chnjuj-PtT7VwD4EWV', '2021-07-13T21:03:16.189302Z', 'application/gzip', 13096, 'd9298fb169c51890ad5e146108c75bfeb8e8452bd54b2cdb32f1000e2146a4e4', 4, 4096),
('DHGeDybWtnT-AkD5avn2wTB-RvfFeVguPUu-LDJADAajdSD', '2021-07-13T21:03:16.435753Z', 'application/gzip', 12734, 'fc228c554ae12b3998728b00f098dbc0aa20ae767c6f945acc8f0ae65fcb35fb', 4, 4096);              
CREATE CACHED TABLE "public"."filechunk"(
    "fileid" VARCHAR(254) NOT NULL,
    "chunknr" INT NOT NULL,
    "chunklength" INT NOT NULL,
    "chunkdata" BYTEA NOT NULL
);    
ALTER TABLE "public"."filechunk" ADD CONSTRAINT "public"."CONSTRAINT_B" PRIMARY KEY("fileid", "chunknr");      
-- 26 +/- SELECT COUNT(*) FROM public.filechunk;               
INSERT INTO "public"."filechunk" VALUES
('DtG18bCtiGr-fGEwzMKktpB-tosSKp9g7ty-wDgXGffbp1f', 0, 43627, X'[encoded data, 87254 characters]');              
INSERT INTO "public"."filechunk" VALUES
('8jre1Sk2anC-XycazyE1d9M-UUjNsj1LsLu-zmZfiPwKB6J', 0, 35462, X'[encoded data, 70924 characters]');        
INSERT INTO "public"."filechunk" VALUES
('D8Cj2R2fmSM-z31GMJF61iG-BQnDzjGWeh1-bhQfBym5qrQ', 0, 11412, X'[encoded data, 22824 characters]');            
INSERT INTO "public"."filechunk" VALUES
('JXziW35E2TW-zXPFxZeeNwA-M1fcdXMEdAL-FVYEyKNC7N', 0, 34420, X'[encoded data, 68840 characters]');             
INSERT INTO "public"."filechunk" VALUES
('BQR2G7GT5LQ-FKV4FQ1hnDu-9TSkF7nhUyz-nmpe9qDVvBd', 0, 17244, X'[encoded data, 34488 characters]');            
INSERT INTO "public"."filechunk" VALUES
('7Vvy4bZfe3b-YCpAVWc8Lw9-wUkKLWjo3RL-4RnazGiQtnY', 0, 12483, X'[encoded data, 24966 characters]');              
INSERT INTO "public"."filechunk" VALUES
('8Zqe9ujkK9F-x8su5twLT6Q-N45WGGTmjzk-cf5xbFP9TDK', 0, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('8Zqe9ujkK9F-x8su5twLT6Q-N45WGGTmjzk-cf5xbFP9TDK', 1, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('8Zqe9ujkK9F-x8su5twLT6Q-N45WGGTmjzk-cf5xbFP9TDK', 2, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('8Zqe9ujkK9F-x8su5twLT6Q-N45WGGTmjzk-cf5xbFP9TDK', 3, 800, X'd390c0989cf5624c44f41687ca3132857c8c418b3bf13353ea6db4eb310d7dc3f96a4ca05db4a1bebad8185ebe72e1380e512d969efa861a29dbed728d4a298a7f16e2072735ebd182817cb5d13b678d9b8e1fa592726a79be588bb9b7c3d39a57d68ad512d89a8b3b1616cbf9da58cca2f8bb90729ceb6bdcee714b6fc2377978490caed19bafb7108db17ec688a7cdfaccceb82315772c5bd89abd250e6bdcf6f1f7e5b568b0b8a92fa66e7153d28eb1c72d6b01fba7284c493a922776491afe19b86d9b0695a4719be63391dfbad98e3370ed6bc47235142b17be37475a7353bde251db6d8c6afd957a746cb511eb4f4b7e7a5c6e34e173af9bd6b242478f55a35a6c4dca51c3ed0373392b3172b36223871f8dfaac9660174464a2da116bddd62dcb05e16f0cd71bce5fdbd3eba6b7358e0f6eb8ae7f0575e568a5bb381295a10cf912816fdf82d3aee5f5d8d04f59b1d64db636336e737eafdbceb68dc3c1f0be5eb77d41757249bed0a8d4c616d4866284b7ed5d97df989f15af7b68568b9af1c4930a7876d170be264b5ab4d64d614b2c9d2d1ce2f9da6c526fbe3f2a49d7cab8ab9aaf358af992707479be01dbd7703bb7666b368aa559b1618b36cd1aef3aa2d76d6b9f5881ceea38aca94f332ae3cd5b4b7332fb78e3f4710bb2a05068d6f28531796abc6f476a74cf5039b630e393a37b55afdb86dded1dc612a809681f313dd1544be0f159771a4d047b614cc38158b3db9fddf119fd6d8bdf0addab22401436a7c5134f75773fee5a7f4fc57ff17fbcf9e79efaa3a36e9b7e9a7be6dff890e4efc8338ffc2783c6c78d8ff50132feff00dabd7600f31fb70fc4bf7739e4e15f3d7fd14c03c96b075a1dff8b63915843967ef894bd373e72fbdb93b0c24f1e6a0d8a838c1d21265d10932e1193ae71922d19fac6fa728fbfb5effcd8690c22b4e875992ae9b95200ba860b4eac1f303ea9b07ff9bf4534b38c7f49b4f82f4cc0fd9f8816ff4dfe5744f3c649d74634e07ffc3fa113dad798e5da86c3d79e583dadf79527b5fe337be6e127ed7ffabef35f74e28c3de6ef377f2d7e1f809f5df2f5b4b9afdc6ffe5ef34f8f819cde05d0ff035270f0efc0080100'),
('Fi8t9zhK4oj-qAUuNjvvkkk-8rdDiFgg7Cs-GY5ku8ArwUM', 0, 4096, X'[encoded data, 8192 characters]');   
INSERT INTO "public"."filechunk" VALUES
('Fi8t9zhK4oj-qAUuNjvvkkk-8rdDiFgg7Cs-GY5ku8ArwUM', 1, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('Fi8t9zhK4oj-qAUuNjvvkkk-8rdDiFgg7Cs-GY5ku8ArwUM', 2, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('Fi8t9zhK4oj-qAUuNjvvkkk-8rdDiFgg7Cs-GY5ku8ArwUM', 3, 807, X'40c2edc77f259c8604c6e4ac176322a2b738548e9129e4630c5adc899fd9a6de46bb1ed3d0379cafc604da551bea6b8a8de115ab168ce310d562e9a99f522365bb5dae512945f1cf42fce0a4663d9a3f90af367a67af75d3f0a354524eadc8176b31f7767c5af3aa5ab15a025b7371c78262395f1b8b59147f17528e737daddb236ee94df8260f2f8ec1357af3f516a231d6cf18f1b4599fd91977a4e28e650b5ab3b7c461addb21febea2160d1637f5c5d42d6e4ada31f6d8652d60ff14856d928ee4895d93867f066ebba6412569dcb6f94ce4b76eb6e30c5cfb1ab15c0dc5ca85efcd91d6dc54af78d4f61ba35a7fa51e2daf3662fd69c94f8fcb8d267cee75535b5668c95835aac5d6a41c35dcbe309733132337333672f8d1a8cf6c0976414426aa1db9ce6dddb25c10fec670bde1fc753dbd6e5a5be3f8e086ebfa5750578d56ba8b235119ca902f11f80e2d38ed5a5e8f0dfd362bd7b9c9d666c66dceef75dbdbb6713818ded7eb7628a84e2ece171a95dad8fcda508cf076bdebf31bf333e3750fcd6c51339e785201cf2e1cced764490bd7b96dd8124b670b8778be369bd49bef8f4ad2b52aeeaae66b8d62be241c5d916fc0f635dc2eadd99a8d6269666cd8a24d33c7bb8eec75dbd92756a2b33a0e6bcad38cca78f3d6d29ccc3ede386ddc82cc2f149ab57c614c9e1aefdb891add33548e2dccf8e4e85eddebb665777b87b1046a02da474c4b34d512787cd69d4713c15e10d37020d6ecf667777a467fdbe2b742f7ea081085cd69f1c453dcdd8fbbd6df53f15ffc1f6fdeb9a7fee8e8dba69de69ef9373e24f93beacca3fec9a0f171e3637d808cff3f8076af1dc0bcc7ed03f1ef5d0f7df857cf5f38c340f2da8156c7ffe25824d690a51f3e799f8d8fdcfef624acf093875a83e2206327884917c4a44bc4a46b9c648b87beb1a1dce36fed3b3f761a83082d7a5da64a7aae1280aee18213ea078e4f2aec5ff16f11cd2ce35f122dfe0b1370ff27a2c57f93ff15d1bc71d2b5110df81ff74fe884f6b566b9b6e1887527544feb7de589adffcc9a71c489079cbedfbc179d307dcf79fbcf5b87df07e267977c3d6dce2bf79fb7f7bcd36320a77701f4ff00c64e5337cd080100'),
('5VXHZhGz7UQ-x7rN8GNmhFP-bneB7vgdkEo-gEcwXC9XBPJ', 0, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('5VXHZhGz7UQ-x7rN8GNmhFP-bneB7vgdkEo-gEcwXC9XBPJ', 1, 4096, X'[encoded data, 8192 characters]');     
INSERT INTO "public"."filechunk" VALUES
('5VXHZhGz7UQ-x7rN8GNmhFP-bneB7vgdkEo-gEcwXC9XBPJ', 2, 4096, X'[encoded data, 8192 characters]');     
