mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			608 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b679f4218d | ||
|  | 77c6c4617b | ||
|  | 8240a208dd | ||
|  | 1c34f73f61 | ||
|  | c102089731 | ||
|  | 7495777d97 | ||
|  | fa2ffd7574 | ||
|  | 412c745e53 | ||
|  | 913d2c06f3 | ||
|  | d04d356429 | ||
|  | be59f248e8 | ||
|  | 1995b54770 | ||
|  | f2732bcab7 | ||
|  | 0e9d76890b | ||
|  | 9df521109b | ||
|  | 75b65c396e | ||
|  | d4d48f3834 | ||
|  | b90ba3d1a9 | ||
|  | 82ba0d5b1d | ||
|  | 590eea1183 | ||
|  | e6f3cc7988 | ||
|  | 7a650c605c | ||
|  | dfa7c64b1f | ||
|  | 2b10023055 | ||
|  | 168645cce9 | ||
|  | f4c81ecefb | ||
|  | 5a85fe92aa | ||
|  | feffd57f24 | ||
|  | faf81ae056 | ||
|  | 003fec4b11 | ||
|  | 5ecb603e86 | ||
|  | 1fed71a92e | ||
|  | dad82ea4e8 | ||
|  | 067251861d | ||
|  | 6bc8773d5f | ||
|  | a910034c96 | ||
|  | 257cc66f62 | ||
|  | 00f24bdb63 | ||
|  | fada3fe623 | ||
|  | d97e454463 | ||
|  | 3128a7d62f | ||
|  | b8fe9a41db | ||
|  | 8366a94bde | ||
|  | f56123b864 | ||
|  | ae951bfe23 | ||
|  | ad8d35efe9 | ||
|  | 0217b1c85d | ||
|  | c0aa14f586 | ||
|  | b54cfab4ff | ||
|  | a08985e7a6 | ||
|  | a789025025 | ||
|  | 3f307b117e | ||
|  | a232035d47 | ||
|  | 9d38e9342d | ||
|  | 4bc4b9ade7 | ||
|  | f0217cae5e | ||
|  | da050c6369 | ||
|  | 842c317568 | ||
|  | 47845930f4 | ||
|  | 972f2f40bf | ||
|  | 265401775b | ||
|  | 94111c464b | ||
|  | 94e18dfb7c | ||
|  | bc9903191e | ||
|  | cd8c24ceae | ||
|  | f9709c9c39 | ||
|  | c0964a4f12 | ||
|  | bcef8579ce | ||
|  | 1180be75d1 | ||
|  | cfa49c7b1b | ||
|  | 8e4926ed7f | ||
|  | 2430dcba65 | ||
|  | 7c885a8b76 | ||
|  | 402e29d6dc | ||
|  | e7faebfac3 | ||
|  | 10a5773c66 | ||
|  | 1e8472266f | ||
|  | b30792a3da | ||
|  | 8b56fb10fd | ||
|  | 26602e8226 | ||
|  | b8eeb0371c | ||
|  | b1c4737e78 | ||
|  | 3860028a9e | ||
|  | 16d97b95af | ||
|  | 20465a4f71 | ||
|  | 2ff6e50af4 | ||
|  | e0378c5064 | ||
|  | e29aee1aae | ||
|  | 1aff42f453 | ||
|  | a098630e09 | ||
|  | 074eb1c02f | ||
|  | 657496ea37 | ||
|  | 034aaa7209 | ||
|  | a81ea3771f | ||
|  | 4ceba8cc6e | ||
|  | d9550dd59b | ||
|  | 97f7fe7b18 | ||
|  | a810c08c02 | ||
|  | ab550a1e8d | ||
|  | 08e8047d8a | ||
|  | 67da877135 | ||
|  | 263b7a84bb | ||
|  | 9d18bebb13 | ||
|  | 2d339dec6b | ||
|  | b78ab1ee02 | ||
|  | 2f5f116345 | ||
|  | 64f1671566 | ||
|  | 26bcfe5160 | ||
|  | 89c04e6b6b | ||
|  | e079359c15 | ||
|  | c4ab6b4866 | ||
|  | 630d9f2e45 | ||
|  | bbceb6251a | ||
|  | 89f117da5b | ||
|  | 40fb4ff56b | ||
|  | d64c14482b | ||
|  | 61f197dd81 | ||
|  | 564366861e | ||
|  | 1ee2abcc42 | ||
|  | f4242b4096 | ||
|  | d59542dd6f | ||
|  | 211ff90ee8 | ||
|  | 8c11d022fb | ||
|  | 24210ef80c | ||
|  | 3f40a52f65 | ||
|  | df4cf80be4 | ||
|  | bc854ee149 | ||
|  | b23ead8097 | ||
|  | 886fdf7cd6 | ||
|  | 2135aa058e | ||
|  | de20183a22 | ||
|  | 42b5437c87 | ||
|  | 67542f448d | ||
|  | ae29c6bac4 | ||
|  | 1dce96b4c1 | ||
|  | 08e9b59696 | ||
|  | db9e35a7e1 | ||
|  | fe605c012a | ||
|  | 7a383a1314 | ||
|  | 5290aab781 | ||
|  | 86c3bbe5a2 | ||
|  | 4c7c53d8c8 | ||
|  | 21854b4a04 | ||
|  | 83f125a79f | ||
|  | e36bc42519 | ||
|  | 15ac81627c | ||
|  | 57fae2c8c6 | ||
|  | 87b76abef9 | ||
|  | d345b7ed56 | ||
|  | 298af217e9 | ||
|  | 89322c4b03 | ||
|  | 7d64f6a7dd | ||
|  | b7efc92099 | ||
|  | bc8b6284a6 | ||
|  | 20a187fab9 | ||
|  | 0b001f41c0 | ||
|  | 242977c7a5 | ||
|  | 364ac331da | ||
|  | fcc0a80f4e | ||
|  | 8996f35cc0 | ||
|  | ed5eb5c6db | ||
|  | acb50f44a1 | ||
|  | c946030106 | ||
|  | df0411197b | ||
|  | 600c16551a | ||
|  | 5710c9e997 | ||
|  | 550a9fa711 | ||
|  | 51348cfbad | ||
|  | 7400a6723e | ||
|  | e57dee2f14 | ||
|  | b02a5b872a | ||
|  | 4733de23ba | ||
|  | 57b7f6199e | ||
|  | a9df0c485f | ||
|  | 21dedff9bf | ||
|  | 6f60cf1a86 | ||
|  | 930d29d64a | ||
|  | c345e7031b | ||
|  | fc46398a3c | ||
|  | 7e41226549 | ||
|  | b0c0ed8512 | ||
|  | 5978447185 | ||
|  | ec4d445f97 | ||
|  | e378435fbe | ||
|  | e4dca4750f | ||
|  | 311b98ffcb | ||
|  | 126f41ae5e | ||
|  | 4b1678c416 | ||
|  | da74272f13 | ||
|  | 9ce224d4c5 | ||
|  | ce57a13002 | ||
|  | e42357f1f8 | ||
|  | ab7d121290 | ||
|  | 5209583a73 | ||
|  | 35fc4ba9a4 | ||
|  | 7f9019322b | ||
|  | 8a455e83f0 | ||
|  | 79b8d91025 | ||
|  | bcabe5786f | ||
|  | a7d3dafcf1 | ||
|  | e6af84df39 | ||
|  | 674172f0b8 | ||
|  | 7ec20f9384 | ||
|  | 6135de8507 | ||
|  | 63b0d30e74 | ||
|  | 9e29fba8da | ||
|  | 8910ae92c7 | ||
|  | 3413074235 | ||
|  | 33aa72eb97 | ||
|  | 6e0a65b59c | ||
|  | 56e49cfc19 | ||
|  | af40d73cee | ||
|  | 50b7063811 | ||
|  | ee1b377bc2 | ||
|  | 51dfe8bb14 | ||
|  | e426ee3e4f | ||
|  | a434aa113d | ||
|  | 3b551e3e4d | ||
|  | 3d98644bf6 | ||
|  | a22e4d60b6 | ||
|  | 069fbee3a6 | ||
|  | 8b21867c5c | ||
|  | 980309ae2a | ||
|  | 6a6bd4541a | ||
|  | a14aa461ca | ||
|  | 2cc4367b37 | ||
|  | 241d1b1035 | ||
|  | 449081807e | ||
|  | dc0d6d24bd | ||
|  | 4111a2f0e8 | ||
|  | 8ef4b2bf50 | ||
|  | 53875d26bc | ||
|  | f505f9d65a | ||
|  | 6434889cd6 | ||
|  | 21d2ca3c54 | ||
|  | 64a3a8b561 | ||
|  | 6738f2cd24 | ||
|  | 1cdd644b8f | ||
|  | f5dc05e79a | ||
|  | e2c37a6f8c | ||
|  | cfea2440fb | ||
|  | 23e34e8c02 | ||
|  | 8bd7b657f8 | ||
|  | 899d9e65fd | ||
|  | ec732c0a98 | ||
|  | 66797f34c4 | ||
|  | 1ad25b063d | ||
|  | e09b2902fa | ||
|  | f6776df645 | ||
|  | f0c672445d | ||
|  | a033ddfcb7 | ||
|  | d02d846024 | ||
|  | a8b6538c4e | ||
|  | 4eb4a44331 | ||
|  | c1e1f3df24 | ||
|  | 11e9f8403e | ||
|  | ba676587df | ||
|  | 20696aa0ab | ||
|  | a08690b123 | ||
|  | 79f54b4e97 | ||
|  | 973fe52275 | ||
|  | 5938e033d4 | ||
|  | eecba725b0 | ||
|  | fa40a5f496 | ||
|  | abbba6501d | ||
|  | 824f5dbaac | ||
|  | 24a45b03f5 | ||
|  | e10e18e63a | ||
|  | 7152c5e51d | ||
|  | 711af02928 | ||
|  | df8706026e | ||
|  | 17fe9a6a1b | ||
|  | 2d08eb7366 | ||
|  | 8d42ffca6d | ||
|  | 0654dc855f | ||
|  | 0571f02830 | ||
|  | b2b1c9ebb7 | ||
|  | 1f75b9c92f | ||
|  | e2c4f32b5e | ||
|  | 18ffcf7880 | ||
|  | 6ae8508413 | ||
|  | ec3b844026 | ||
|  | a1ca538106 | ||
|  | 75fc9e2048 | ||
|  | a1c1c7c830 | ||
|  | e4a483aefe | ||
|  | 8c2a5d19f2 | ||
|  | 2c450fc72d | ||
|  | 831de3ffed | ||
|  | 291b434d70 | ||
|  | a68fd5ab83 | ||
|  | 8a8bdaf80e | ||
|  | 26b89fc801 | ||
|  | af3fd61974 | ||
|  | f4dde84f06 | ||
|  | bc920dc5dc | ||
|  | 896c9cec04 | ||
|  | b37bcd294c | ||
|  | 14f24c646a | ||
|  | fea46bb150 | ||
|  | 37c30bf88a | ||
|  | d975acc99a | ||
|  | c2d35dac4d | ||
|  | 5358b58191 | ||
|  | 0264e847ef | ||
|  | c5917bfc78 | ||
|  | 533fcd06e4 | ||
|  | 192a2fe9f9 | ||
|  | e6bc8ed3b5 | ||
|  | 8ff563ba40 | ||
|  | d5bd9875f9 | ||
|  | 113bebed3b | ||
|  | 2fcb0c05c0 | ||
|  | fdb7b7721d | ||
|  | 3d9260c974 | ||
|  | 8769fd71cb | ||
|  | a2baa9bdb3 | ||
|  | 88714cce94 | ||
|  | bc1d438075 | ||
|  | fd00f6bd97 | ||
|  | b041d081db | ||
|  | fabf24a065 | ||
|  | e3fc0968ba | ||
|  | a766374bf4 | ||
|  | 0f693dae5e | ||
|  | 208492bee1 | ||
|  | b0d767df69 | ||
|  | 476b8250c9 | ||
|  | e4ba7d65e8 | ||
|  | 9c9a3fc030 | ||
|  | b85cf07a28 | ||
|  | bdde52f004 | ||
|  | dd37f09309 | ||
|  | a0caa21458 | ||
|  | 43e829ca99 | ||
|  | ed26e32ccb | ||
|  | 5866004e23 | ||
|  | 06bcfe1aee | ||
|  | 2d82da32d4 | ||
|  | 2b017a956e | ||
|  | 0448883782 | ||
|  | 9b9be5d155 | ||
|  | 3f2ee4aefd | ||
|  | b90ae8eb79 | ||
|  | 266807179c | ||
|  | 4023c28f5e | ||
|  | 010f075ac5 | ||
|  | 151687cd9b | ||
|  | f24ea8137b | ||
|  | b8d8e01908 | ||
|  | 79d492d0f0 | ||
|  | f0af26a57b | ||
|  | 2b8c6e3dd0 | ||
|  | 061f8acf11 | ||
|  | 5cfd1c030d | ||
|  | 6e300c7cf5 | ||
|  | 167d4816fd | ||
|  | 3e5db71652 | ||
|  | 1bc50ed976 | ||
|  | 08c638c2fa | ||
|  | 5f22864a93 | ||
|  | cfcc34fa8e | ||
|  | 635f5fdc5b | ||
|  | d0747b125c | ||
|  | 66374bf95f | ||
|  | d27fcaf317 | ||
|  | 0ee093f038 | ||
|  | 06eb0ce910 | ||
|  | c59b3a0c5c | ||
|  | 08eda83700 | ||
|  | d23bb5fd17 | ||
|  | 8cb07525cf | ||
|  | dc4c922edb | ||
|  | c3ed673453 | ||
|  | 3fd16a16e8 | ||
|  | 3448eba7b9 | ||
|  | ad8f374276 | ||
|  | 19a6d89d4f | ||
|  | b99d83af50 | ||
|  | e050e380b9 | ||
|  | 68d599ed19 | ||
|  | 9d9bc31d91 | ||
|  | b619a6515b | ||
|  | 13a16e8251 | ||
|  | 86a53ceebb | ||
|  | 669eaa7509 | ||
|  | f50084dc1b | ||
|  | 3a78a75afc | ||
|  | 6e7b722bf2 | ||
|  | 4ca0f4b06b | ||
|  | a33661d050 | ||
|  | f1338bb643 | ||
|  | b6b6d11ef7 | ||
|  | 17a6c94f66 | ||
|  | e74979ccc1 | ||
|  | e003341dff | ||
|  | 5c4369206a | ||
|  | 507a0e2e1d | ||
|  | b381331029 | ||
|  | af703445e1 | ||
|  | c508217604 | ||
|  | 6a1287a3de | ||
|  | 7261ab69bc | ||
|  | f9cfd134b7 | ||
|  | 89d28ef27c | ||
|  | 9da8d466b8 | ||
|  | 74d0626dc9 | ||
|  | 830a357b9a | ||
|  | 7b129c7c34 | ||
|  | adc98d4515 | ||
|  | f3959cf2aa | ||
|  | 6fdabbc73b | ||
|  | de6ff09bb9 | ||
|  | c82308489b | ||
|  | 98ee3b029a | ||
|  | a6bef45a30 | ||
|  | 05d077ce28 | ||
|  | 9adf4d7e8e | ||
|  | e2819109e9 | ||
|  | 3c8e267aad | ||
|  | da0670188b | ||
|  | 65938c5272 | ||
|  | 7ea72632b8 | ||
|  | 9ca225b40f | ||
|  | b68bdc5005 | ||
|  | 9e77a424a4 | ||
|  | e25b965cb3 | ||
|  | 8d3a3d4873 | ||
|  | c115628f1f | ||
|  | 703fbd30df | ||
|  | 5011b6a51a | ||
|  | 4cc02ffb31 | ||
|  | 1e767482b4 | ||
|  | 2035304b63 | ||
|  | 5be7f003ca | ||
|  | b660238a40 | ||
|  | b9ff481eb7 | ||
|  | eebbf74517 | ||
|  | 61e78858bc | ||
|  | 0351d7eff1 | ||
|  | 9e1c9782ff | ||
|  | b2148f4a18 | ||
|  | 16cc84be99 | ||
|  | 0265c190db | ||
|  | 32c88219c3 | ||
|  | 962d5a5674 | ||
|  | 995e6c2fef | ||
|  | 0a2807c0b3 | ||
|  | 1b9c3b0759 | ||
|  | f1a36f6cea | ||
|  | d9ec8bba80 | ||
|  | 02da5b598c | ||
|  | 2220c4491b | ||
|  | fb31acc8e0 | ||
|  | 92cf2c18fa | ||
|  | c5182b8757 | ||
|  | e054a1694e | ||
|  | 3a7da1d561 | ||
|  | 3893f663d0 | ||
|  | a0de3c97a5 | ||
|  | c886583396 | ||
|  | e48609aa68 | ||
|  | 882912826f | ||
|  | 6d51593b7d | ||
|  | faab6be48d | ||
|  | 8debf18984 | ||
|  | 4bf1c25721 | ||
|  | a1d7737551 | ||
|  | 2bfd7b844c | ||
|  | ac04be4433 | ||
|  | 5e5df72020 | ||
|  | f1344e3b95 | ||
|  | 9216e430db | ||
|  | 855b876d50 | ||
|  | c04bbd4973 | ||
|  | 1a615398aa | ||
|  | b557a44f34 | ||
|  | f50bb2278c | ||
|  | 6b68068cde | ||
|  | 7ed816f1b2 | ||
|  | f8dd8ebf1a | ||
|  | 4c64bd852e | ||
|  | af62b07d5b | ||
|  | 4338f65e01 | ||
|  | 9a147365f5 | ||
|  | e48bbe5b19 | ||
|  | bdff1c1246 | ||
|  | d4a955a3f5 | ||
|  | 07e214c564 | ||
|  | b351157a6a | ||
|  | 56378cd0f5 | ||
|  | a76e3f6e2d | ||
|  | f5573fcad4 | ||
|  | 60f88574b0 | ||
|  | 65c3bcb565 | ||
|  | ef4bc13dd1 | ||
|  | aa901b67ed | ||
|  | 7a389baf08 | ||
|  | 57b6271c0b | ||
|  | 9532a5662f | ||
|  | 520db931ae | ||
|  | 5e19a37df7 | ||
|  | 4b6b8b1678 | ||
|  | a3d44fbdef | ||
|  | 7fcf90437a | ||
|  | 614b1bdbaf | ||
|  | 4d213300ac | ||
|  | b7ca3dec54 | ||
|  | c4987c4fd1 | ||
|  | f176191efb | ||
|  | dc5304faa0 | ||
|  | 205f9953f9 | ||
|  | 58d61800f3 | ||
|  | b9639bffce | ||
|  | 3c7232f427 | ||
|  | 5707b7e29a | ||
|  | 2f5d3729de | ||
|  | bae8551652 | ||
|  | 1f5e4530c3 | ||
|  | 7d94202460 | ||
|  | 30cc566518 | ||
|  | 85933771f8 | ||
|  | e924662a29 | ||
|  | 2985100801 | ||
|  | d68ea201a3 | ||
|  | 7528181ca2 | ||
|  | 1302765478 | ||
|  | 5b220adc31 | ||
|  | 98dfc77195 | ||
|  | 1a0aaf4a30 | ||
|  | 79a85a0aa7 | ||
|  | 274cf7312c | ||
|  | 29e4e2afbb | ||
|  | 39f0f26f28 | ||
|  | 1a13132a69 | ||
|  | a3847842cb | ||
|  | b7bd5396d1 | ||
|  | 8c1c9b00e2 | ||
|  | 845f5d15c4 | ||
|  | d18b95d87c | ||
|  | 731051154b | ||
|  | a093508fbe | ||
|  | 5860b2eebb | ||
|  | a4aaa49774 | ||
|  | a4c7069856 | ||
|  | 7cad65b370 | ||
|  | 3ead734323 | ||
|  | 2451596e8c | ||
|  | a5d702b143 | ||
|  | 439ef4a8cb | ||
|  | 8bd3e17a3b | ||
|  | 7a7c890946 | ||
|  | cb8e551ee0 | ||
|  | 04f249e800 | ||
|  | a65eda5e4a | ||
|  | 9645a07f2f | ||
|  | f6dd1110e8 | ||
|  | 623200b92b | ||
|  | 4ff40ba14f | ||
|  | 16563eaba4 | ||
|  | caa6e9ee72 | ||
|  | f4a58a2598 | ||
|  | cecce1df20 | ||
|  | 2030c8e995 | ||
|  | 8a9bd4deb4 | ||
|  | 8417d4a4ea | ||
|  | 5d58520949 | ||
|  | d8d15b528e | ||
|  | 1d008cad13 | ||
|  | ef0941479c | ||
|  | 9afea492db | ||
|  | 84246fd197 | ||
|  | 9441cb177f | ||
|  | bcfe097dd6 | ||
|  | a410ed1b74 | ||
|  | 2edc7dbf58 | ||
|  | 051b9dff21 | ||
|  | de6108f95d | ||
|  | fddab59265 | ||
|  | 1308dc20e8 | ||
|  | e257634ccf | ||
|  | 3091119893 | ||
|  | c035627f0a | ||
|  | 273d4e0052 | ||
|  | 77eac8f764 | ||
|  | 1af10d48a2 | ||
|  | d13c8771ca | ||
|  | 6626f100ad | ||
|  | ccadff5015 | ||
|  | e41be520a8 | ||
|  | 43eb248450 | ||
|  | f22c76d9fb | ||
|  | b1131844d6 | ||
|  | 219098ab53 | ||
|  | e466c393eb | ||
|  | d8f1c39282 | ||
|  | cb3a5bba61 | ||
|  | 93cae44ba0 | ||
|  | a5ee590544 | ||
|  | 6c5b1420d2 | ||
|  | 8d8d654fe8 | ||
|  | 7494491560 | ||
|  | 79bb249f3b | ||
|  | 1fdf889ccf | ||
|  | 42510fda5c | ||
|  | f7e86c5be0 | ||
|  | af5b1021c7 | ||
|  | 4311834d75 | 
							
								
								
									
										1
									
								
								.github/FUNDING.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/FUNDING.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,4 @@ | |||||||
| # These are supported funding model platforms | # These are supported funding model platforms | ||||||
|  |  | ||||||
| github: [zadam] | github: [zadam] | ||||||
|  | custom: ["https://paypal.me/za4am"] | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								.github/ISSUE_TEMPLATE/bug_report.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								.github/ISSUE_TEMPLATE/bug_report.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  | name: Bug Report | ||||||
|  | description: Report a bug | ||||||
|  | title: "(Bug report) " | ||||||
|  | labels: "Type: Bug" | ||||||
|  | body: | ||||||
|  | - type: input | ||||||
|  |   attributes: | ||||||
|  |     label: Trilium Version | ||||||
|  |     description: What version of Trilium are you using? | ||||||
|  |     placeholder: 0.48.0-beta | ||||||
|  |   validations: | ||||||
|  |     required: true | ||||||
|  | - type: dropdown | ||||||
|  |   attributes: | ||||||
|  |     label: What operating system are you using? | ||||||
|  |     options: | ||||||
|  |       - Windows | ||||||
|  |       - macOS | ||||||
|  |       - Ubuntu | ||||||
|  |       - Other Linux | ||||||
|  |       - Other (specify below) | ||||||
|  |   validations: | ||||||
|  |     required: true | ||||||
|  | - type: dropdown | ||||||
|  |   attributes: | ||||||
|  |     label: What is your setup? | ||||||
|  |     description: https://github.com/zadam/trilium/wiki#choose-the-setup | ||||||
|  |     options: | ||||||
|  |       - Local (no sync) | ||||||
|  |       - Local + server sync | ||||||
|  |       - Server access only | ||||||
|  |   validations: | ||||||
|  |     required: true | ||||||
|  | - type: input | ||||||
|  |   attributes: | ||||||
|  |     label: Operating System Version | ||||||
|  |     description: What operating system version are you using? On Windows, click Start button > Settings > System > About. On macOS, click the Apple Menu > About This Mac. On Linux, use lsb_release or uname -a. | ||||||
|  |     placeholder: "e.g. Windows 10 version 1909, macOS Catalina 10.15.7, or Ubuntu 20.04" | ||||||
|  |   validations: | ||||||
|  |     required: true | ||||||
|  | - type: textarea | ||||||
|  |   attributes: | ||||||
|  |     label: Description | ||||||
|  |     description: A clear and concise description of the bug and any additional information. | ||||||
|  |   validations: | ||||||
|  |     required: true | ||||||
							
								
								
									
										15
									
								
								.github/ISSUE_TEMPLATE/feature_request.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.github/ISSUE_TEMPLATE/feature_request.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | name: Feature Request | ||||||
|  | description: Ask for a new feature to be added | ||||||
|  | title: "(Feature request) " | ||||||
|  | labels: "Type: Enhancement" | ||||||
|  | body: | ||||||
|  | - type: textarea | ||||||
|  |   attributes: | ||||||
|  |     label: Describe feature | ||||||
|  |     description: A clear and concise description of what you want to be added.. | ||||||
|  |   validations: | ||||||
|  |     required: true | ||||||
|  | - type: textarea | ||||||
|  |   attributes: | ||||||
|  |     label: Additional Information | ||||||
|  |     description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here. | ||||||
							
								
								
									
										71
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | |||||||
|  | # For most projects, this workflow file will not need changing; you simply need | ||||||
|  | # to commit it to your repository. | ||||||
|  | # | ||||||
|  | # You may wish to alter this file to override the set of languages analyzed, | ||||||
|  | # or to provide custom queries or build logic. | ||||||
|  | # | ||||||
|  | # ******** NOTE ******** | ||||||
|  | # We have attempted to detect the languages in your repository. Please check | ||||||
|  | # the `language` matrix defined below to confirm you have the correct set of | ||||||
|  | # supported CodeQL languages. | ||||||
|  | # | ||||||
|  | name: "CodeQL" | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: [ master ] | ||||||
|  |   pull_request: | ||||||
|  |     # The branches below must be a subset of the branches above | ||||||
|  |     branches: [ master ] | ||||||
|  |   schedule: | ||||||
|  |     - cron: '37 4 * * 1' | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   analyze: | ||||||
|  |     name: Analyze | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     permissions: | ||||||
|  |       actions: read | ||||||
|  |       contents: read | ||||||
|  |       security-events: write | ||||||
|  |  | ||||||
|  |     strategy: | ||||||
|  |       fail-fast: false | ||||||
|  |       matrix: | ||||||
|  |         language: [ 'javascript' ] | ||||||
|  |         # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||||||
|  |         # Learn more: | ||||||
|  |         # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||||||
|  |  | ||||||
|  |     steps: | ||||||
|  |     - name: Checkout repository | ||||||
|  |       uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|  |     # Initializes the CodeQL tools for scanning. | ||||||
|  |     - name: Initialize CodeQL | ||||||
|  |       uses: github/codeql-action/init@v1 | ||||||
|  |       with: | ||||||
|  |         languages: ${{ matrix.language }} | ||||||
|  |         # If you wish to specify custom queries, you can do so here or in a config file. | ||||||
|  |         # By default, queries listed here will override any specified in a config file. | ||||||
|  |         # Prefix the list here with "+" to use these queries and those in the config file. | ||||||
|  |         # queries: ./path/to/local/query, your-org/your-repo/queries@main | ||||||
|  |  | ||||||
|  |     # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java). | ||||||
|  |     # If this step fails, then you should remove it and run the build manually (see below) | ||||||
|  |     - name: Autobuild | ||||||
|  |       uses: github/codeql-action/autobuild@v1 | ||||||
|  |  | ||||||
|  |     # ℹ️ Command-line programs to run using the OS shell. | ||||||
|  |     # 📚 https://git.io/JvXDl | ||||||
|  |  | ||||||
|  |     # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||||||
|  |     #    and modify them (or add more) to build your code if your project | ||||||
|  |     #    uses a compiled language | ||||||
|  |  | ||||||
|  |     #- run: | | ||||||
|  |     #   make bootstrap | ||||||
|  |     #   make release | ||||||
|  |  | ||||||
|  |     - name: Perform CodeQL Analysis | ||||||
|  |       uses: github/codeql-action/analyze@v1 | ||||||
							
								
								
									
										53
									
								
								.github/workflows/docker.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								.github/workflows/docker.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | |||||||
|  | name: Publish Docker image | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     tags: [v*] | ||||||
|  | jobs: | ||||||
|  |   push_to_registries: | ||||||
|  |     name: Push Docker image to multiple registries | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     permissions: | ||||||
|  |       packages: write | ||||||
|  |       contents: read | ||||||
|  |     steps: | ||||||
|  |       - name: Checkout | ||||||
|  |         uses: actions/checkout@v2 | ||||||
|  |       - name: Set up QEMU | ||||||
|  |         uses: docker/setup-qemu-action@v1 | ||||||
|  |       - name: Docker meta | ||||||
|  |         id: meta | ||||||
|  |         uses: docker/metadata-action@v3 | ||||||
|  |         with: | ||||||
|  |           images: | | ||||||
|  |             zadam/trilium | ||||||
|  |             ghcr.io/zadam/trilium | ||||||
|  |           tags: | | ||||||
|  |             type=semver,pattern={{version}} | ||||||
|  |             type=semver,pattern={{major}}.{{minor}}-latest | ||||||
|  |             type=match,pattern=(\d+.\d+).\d+\-beta,enable=${{ endsWith(github.ref, 'beta') }},group=1,suffix=-latest | ||||||
|  |       - name: Set up Docker Buildx | ||||||
|  |         uses: docker/setup-buildx-action@v1 | ||||||
|  |         with: | ||||||
|  |           install: true | ||||||
|  |       - name: Log in to Docker Hub | ||||||
|  |         uses: docker/login-action@v1 | ||||||
|  |         with: | ||||||
|  |           username: ${{ secrets.DOCKER_USERNAME }} | ||||||
|  |           password: ${{ secrets.DOCKER_PASSWORD }} | ||||||
|  |       - name: Log in to GitHub Docker Registry | ||||||
|  |         uses: docker/login-action@v1 | ||||||
|  |         with: | ||||||
|  |           registry: ghcr.io | ||||||
|  |           username: ${{ github.repository_owner }} | ||||||
|  |           password: ${{ secrets.GITHUB_TOKEN }} | ||||||
|  |       - name: Create server-package.json | ||||||
|  |         run: cat package.json | grep -v electron > server-package.json | ||||||
|  |       - name: Build and Push | ||||||
|  |         uses: docker/build-push-action@v2.7.0 | ||||||
|  |         with: | ||||||
|  |           context: . | ||||||
|  |           platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 | ||||||
|  |           push: true | ||||||
|  |           cache-from: type=registry,ref=zadam/trilium:buildcache | ||||||
|  |           cache-to: type=registry,ref=zadam/trilium:buildcache,mode=max | ||||||
|  |           tags: ${{ steps.meta.outputs.tags }} | ||||||
| @@ -2,7 +2,7 @@ image: | |||||||
|   file: .gitpod.dockerfile |   file: .gitpod.dockerfile | ||||||
|  |  | ||||||
| tasks: | tasks: | ||||||
|     - before: nvm install 10 && nvm use 10 |     - before: nvm install 16.13.1 && nvm use 16.13.1 | ||||||
|       init: npm install |       init: npm install | ||||||
|       command: npm run start-server |       command: npm run start-server | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								.idea/dataSources.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								.idea/dataSources.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,11 +1,12 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||||
| <project version="4"> | <project version="4"> | ||||||
|   <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> |   <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> | ||||||
|     <data-source source="LOCAL" name="document.db" uuid="4e69c96a-8a2b-43f5-9b40-d1608f75f7a4"> |     <data-source source="LOCAL" name="SQLite - document.db" uuid="30cef30d-e704-484d-a4ca-5d3bfc2ece63"> | ||||||
|       <driver-ref>sqlite.xerial</driver-ref> |       <driver-ref>sqlite.xerial</driver-ref> | ||||||
|       <synchronize>true</synchronize> |       <synchronize>true</synchronize> | ||||||
|       <jdbc-driver>org.sqlite.JDBC</jdbc-driver> |       <jdbc-driver>org.sqlite.JDBC</jdbc-driver> | ||||||
|       <jdbc-url>jdbc:sqlite:$USER_HOME$/trilium-data/document.db</jdbc-url> |       <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/../trilium-data/document.db</jdbc-url> | ||||||
|  |       <working-dir>$ProjectFileDir$</working-dir> | ||||||
|     </data-source> |     </data-source> | ||||||
|   </component> |   </component> | ||||||
| </project> | </project> | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| FROM node:12.19.0-alpine | FROM node:16.13.1-alpine | ||||||
|  |  | ||||||
| # Create app directory | # Create app directory | ||||||
| WORKDIR /usr/src/app | WORKDIR /usr/src/app | ||||||
| @@ -16,7 +16,7 @@ RUN set -x \ | |||||||
|         make \ |         make \ | ||||||
|         nasm \ |         nasm \ | ||||||
|         libpng-dev \ |         libpng-dev \ | ||||||
|         python \ |         python3 \ | ||||||
|     && npm install --production \ |     && npm install --production \ | ||||||
|     && apk del .build-dependencies |     && apk del .build-dependencies | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| # Trilium注意事项 | # Trilium笔记 | ||||||
|  |  | ||||||
| [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | ||||||
|  |  | ||||||
| @@ -37,6 +37,8 @@ Trilium是作为桌面应用程序(Linux和Windows)或服务器上托管的W | |||||||
|  |  | ||||||
| [有关文档页面的完整列表,请参见Wiki。](https://github.com/zadam/trilium/wiki/) | [有关文档页面的完整列表,请参见Wiki。](https://github.com/zadam/trilium/wiki/) | ||||||
|  |  | ||||||
|  | [中文Wiki在这里](https://github.com/baddate/trilium/wiki/) | ||||||
|  |  | ||||||
| 您还可以阅读[个人知识库模式](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base),以获取有关如何使用Trilium的灵感。 | 您还可以阅读[个人知识库模式](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base),以获取有关如何使用Trilium的灵感。 | ||||||
|  |  | ||||||
| ## 贡献 | ## 贡献 | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								TODO
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								TODO
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | - new icon | ||||||
|  | - polish becca entities API | ||||||
|  | - separate private and public APIs in becca entities | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -5,3 +5,18 @@ echo "Packaging debian x64 distribution..." | |||||||
| VERSION=`jq -r ".version" package.json` | VERSION=`jq -r ".version" package.json` | ||||||
|  |  | ||||||
| ./node_modules/.bin/electron-installer-debian --config bin/deb-options.json --options.version=${VERSION} --arch amd64 | ./node_modules/.bin/electron-installer-debian --config bin/deb-options.json --options.version=${VERSION} --arch amd64 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # hacky stop-gag measure to produce debian compatible XZ compressed debs until this is fixed: https://github.com/electron-userland/electron-installer-debian/issues/272 | ||||||
|  | cd dist | ||||||
|  | ar x trilium_${VERSION}_amd64.deb | ||||||
|  | rm trilium_${VERSION}_amd64.deb | ||||||
|  | # recompress | ||||||
|  | < control.tar.zst zstd -d | xz > control.tar.xz | ||||||
|  | < data.tar.zst zstd -d | xz > data.tar.xz | ||||||
|  | # create deb archive (I really do not know, what argument "sdsd" is for but something is required for ar to create the archive as desired) | ||||||
|  | ar -m -c -a sdsd trilium_${VERSION}_amd64.deb debian-binary control.tar.xz data.tar.xz | ||||||
|  |  | ||||||
|  | rm control* data* debian-binary | ||||||
|  |  | ||||||
|  | echo "Converted to XZ deb" | ||||||
|   | |||||||
| @@ -30,6 +30,9 @@ rm -r $BUILD_DIR/swiftshader | |||||||
| cp bin/tpl/trilium-portable.sh $BUILD_DIR/ | cp bin/tpl/trilium-portable.sh $BUILD_DIR/ | ||||||
| chmod 755 $BUILD_DIR/trilium-portable.sh | chmod 755 $BUILD_DIR/trilium-portable.sh | ||||||
|  |  | ||||||
|  | cp bin/tpl/trilium-safe-mode.sh $BUILD_DIR/ | ||||||
|  | chmod 755 $BUILD_DIR/trilium-safe-mode.sh | ||||||
|  |  | ||||||
| cp bin/tpl/trilium-no-cert-check.sh $BUILD_DIR/ | cp bin/tpl/trilium-no-cert-check.sh $BUILD_DIR/ | ||||||
| chmod 755 $BUILD_DIR/trilium-no-cert-check.sh | chmod 755 $BUILD_DIR/trilium-no-cert-check.sh | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
|  |  | ||||||
| PKG_DIR=dist/trilium-linux-x64-server | PKG_DIR=dist/trilium-linux-x64-server | ||||||
| NODE_VERSION=14.16.1 | NODE_VERSION=16.13.1 | ||||||
|  |  | ||||||
| if [ "$1" != "DONTCOPY" ] | if [ "$1" != "DONTCOPY" ] | ||||||
| then | then | ||||||
|   | |||||||
| @@ -27,6 +27,7 @@ rm -r $BUILD_DIR/swiftshader | |||||||
|  |  | ||||||
| cp bin/tpl/trilium-portable.bat $BUILD_DIR/ | cp bin/tpl/trilium-portable.bat $BUILD_DIR/ | ||||||
| cp bin/tpl/trilium-no-cert-check.bat $BUILD_DIR/ | cp bin/tpl/trilium-no-cert-check.bat $BUILD_DIR/ | ||||||
|  | cp bin/tpl/trilium-safe-mode.bat $BUILD_DIR/ | ||||||
|  |  | ||||||
| echo "Zipping windows x64 electron distribution..." | echo "Zipping windows x64 electron distribution..." | ||||||
| VERSION=`jq -r ".version" package.json` | VERSION=`jq -r ".version" package.json` | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| n exec 12 npm run webpack | n exec 16.13.1 npm run webpack | ||||||
|  |  | ||||||
| DIR=$1 | DIR=$1 | ||||||
|  |  | ||||||
| @@ -27,7 +27,7 @@ cp -r electron.js $DIR/ | |||||||
| cp webpack-* $DIR/ | cp webpack-* $DIR/ | ||||||
|  |  | ||||||
| # run in subshell (so we return to original dir) | # run in subshell (so we return to original dir) | ||||||
| (cd $DIR && n exec 12 npm install --only=prod) | (cd $DIR && n exec 16.13.1 npm install --only=prod) | ||||||
|  |  | ||||||
| # cleanup of useless files in dependencies | # cleanup of useless files in dependencies | ||||||
| rm -r $DIR/node_modules/image-q/demo | rm -r $DIR/node_modules/image-q/demo | ||||||
| @@ -44,7 +44,7 @@ find $DIR/node_modules -name demo -exec rm -rf {} \; | |||||||
|  |  | ||||||
| find $DIR/libraries -name "*.map" -type f -delete | find $DIR/libraries -name "*.map" -type f -delete | ||||||
|  |  | ||||||
| rm -r $DIR/src/public/app | rm -rf $DIR/src/public/app | ||||||
|  |  | ||||||
| sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs | sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs | ||||||
| sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs | sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs | ||||||
|   | |||||||
| @@ -69,13 +69,3 @@ gh release create "$TAG" \ | |||||||
|     "dist/$WINDOWS_X64_BUILD" \ |     "dist/$WINDOWS_X64_BUILD" \ | ||||||
|     "dist/$MAC_X64_BUILD" \ |     "dist/$MAC_X64_BUILD" \ | ||||||
|     "dist/$SERVER_BUILD" |     "dist/$SERVER_BUILD" | ||||||
|  |  | ||||||
| echo "Building docker image" |  | ||||||
|  |  | ||||||
| bin/build-docker.sh $VERSION |  | ||||||
|  |  | ||||||
| echo "Pushing docker image to dockerhub" |  | ||||||
|  |  | ||||||
| bin/push-docker-image.sh $VERSION |  | ||||||
|  |  | ||||||
| echo "Release finished!" |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								bin/tpl/trilium-safe-mode.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								bin/tpl/trilium-safe-mode.bat
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | SET DIR=%~dp0 | ||||||
|  | SET TRILIUM_SAFE_MODE=1 | ||||||
|  | cd %DIR% | ||||||
|  | start trilium.exe | ||||||
							
								
								
									
										7
									
								
								bin/tpl/trilium-safe-mode.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								bin/tpl/trilium-safe-mode.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | #!/usr/bin/env sh | ||||||
|  |  | ||||||
|  | DIR=`dirname "$0"` | ||||||
|  | export TRILIUM_SAFE_MODE=1 | ||||||
|  |  | ||||||
|  | "$DIR/trilium" | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								db/TODO.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								db/TODO.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | - drop branches.utcDateCreated - not used for anything | ||||||
|  | - drop options.utcDateCreated - not used for anything | ||||||
|  | - isDeleted = 0 by default | ||||||
|  | - rename openTabs to openNoteContexts | ||||||
|  | - migrate black theme to dark theme | ||||||
|  | - unify readOnly handling to a single attribute: | ||||||
|  |   * readOnly - like now | ||||||
|  |   * readOnly=auto - like without readOnly (used to override inherited readOnly) | ||||||
|  |   * readOnly=never - like autoReadOnlyDisabled | ||||||
|  | - remove focusOnAttributesKeyboardShortcut | ||||||
|  | - rename white theme to "light" theme (it's not completely white and matches well to dark theme) | ||||||
							
								
								
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -1,5 +0,0 @@ | |||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
| VALUES ('leftPaneMinWidth', '350', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
| VALUES ('leftPaneWidthPercent', '20', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| update branches set parentNoteId = 'none' where branchId = 'root' |  | ||||||
| @@ -1,75 +0,0 @@ | |||||||
| -- first fix deleted status of existing images |  | ||||||
| UPDATE note_images SET isDeleted = 1 WHERE noteId IN (SELECT noteId FROM notes WHERE isDeleted = 1); |  | ||||||
|  |  | ||||||
| -- we don't need set data to null because table is going to be dropped anyway and we want image size into attribute |  | ||||||
| UPDATE images SET isDeleted = 1 WHERE imageId NOT IN (SELECT imageId FROM note_images WHERE isDeleted = 0); |  | ||||||
|  |  | ||||||
| -- allow null for note content (for deleted notes) |  | ||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|   `noteId`	TEXT NOT NULL, |  | ||||||
|   `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|   `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|   `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|   `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|   `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|   `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|   `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|   `dateCreated`	TEXT NOT NULL, |  | ||||||
|   `dateModified`	TEXT NOT NULL, |  | ||||||
|   PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, content, isProtected, isDeleted, dateCreated, dateModified, type, mime, hash) |  | ||||||
| SELECT noteId, title, content, isProtected, isDeleted, dateCreated, dateModified, type, mime, hash FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
|  |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
|  |  | ||||||
| CREATE TABLE "links" ( |  | ||||||
|   `linkId`	TEXT NOT NULL, |  | ||||||
|   `noteId`	TEXT NOT NULL, |  | ||||||
|   `targetNoteId`	TEXT NOT NULL, |  | ||||||
|   `type` TEXT NOT NULL, |  | ||||||
|   `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|   `isDeleted`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|   `dateCreated`	TEXT NOT NULL, |  | ||||||
|   `dateModified`	TEXT NOT NULL, |  | ||||||
|   PRIMARY KEY(`linkId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO links (linkId, noteId, targetNoteId, type, isDeleted, dateCreated, dateModified) |  | ||||||
|   SELECT 'L' || SUBSTR(noteImageId, 2), noteId, imageId, 'image', isDeleted, dateCreated, dateModified FROM note_images; |  | ||||||
|  |  | ||||||
| INSERT INTO branches (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, dateModified, hash, dateCreated) |  | ||||||
|   SELECT 'B' || SUBSTR(noteImageId, 2), imageId, noteId, 100, '', 0, isDeleted, dateModified, hash, dateCreated FROM note_images; |  | ||||||
|  |  | ||||||
| DROP TABLE note_images; |  | ||||||
|  |  | ||||||
| INSERT INTO notes (noteId, title, content, isProtected, isDeleted, dateCreated, dateModified, type, mime, hash) |  | ||||||
|   SELECT imageId, name, data, 0, isDeleted, dateCreated, dateModified, 'image', 'image/' || format, hash FROM images; |  | ||||||
|  |  | ||||||
| INSERT INTO attributes (attributeId, noteId, type, name, value, position, dateCreated, dateModified, isDeleted, hash, isInheritable) |  | ||||||
|   SELECT 'O' || SUBSTR(imageId, 2), imageId, 'label', 'originalFileName', name, 0, dateCreated, dateModified, isDeleted, '', 0 FROM images; |  | ||||||
|  |  | ||||||
| INSERT INTO attributes (attributeId, noteId, type, name, value, position, dateCreated, dateModified, isDeleted, hash, isInheritable) |  | ||||||
| SELECT 'F' || SUBSTR(imageId, 2), imageId, 'label', 'fileSize', LENGTH(data), 0, dateCreated, dateModified, isDeleted, '', 0 FROM images; |  | ||||||
|  |  | ||||||
| DROP TABLE images; |  | ||||||
|  |  | ||||||
| INSERT INTO sync (entityName, entityId, sourceId, syncDate) |  | ||||||
| SELECT 'attributes', 'O' || SUBSTR(entityId, 2), sourceId, syncDate FROM sync WHERE entityName = 'images'; |  | ||||||
|  |  | ||||||
| INSERT INTO sync (entityName, entityId, sourceId, syncDate) |  | ||||||
| SELECT 'attributes', 'F' || SUBSTR(entityId, 2), sourceId, syncDate FROM sync WHERE entityName = 'images'; |  | ||||||
|  |  | ||||||
| UPDATE sync SET entityName = 'notes' WHERE entityName = 'images'; |  | ||||||
|  |  | ||||||
| INSERT INTO sync (entityName, entityId, sourceId, syncDate) |  | ||||||
| SELECT 'links', 'L' || SUBSTR(entityId, 2), sourceId, syncDate FROM sync WHERE entityName = 'note_images'; |  | ||||||
|  |  | ||||||
| INSERT INTO sync (entityName, entityId, sourceId, syncDate) |  | ||||||
|   SELECT 'branches', 'B' || SUBSTR(entityId, 2), sourceId, syncDate FROM sync WHERE entityName = 'note_images'; |  | ||||||
|  |  | ||||||
| DELETE FROM sync WHERE entityName = 'note_images'; |  | ||||||
| DELETE FROM sync WHERE entityName = 'images'; |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| create index IDX_links_noteId_index |  | ||||||
|   on links (noteId); |  | ||||||
|  |  | ||||||
| create index IDX_links_targetNoteId_index |  | ||||||
|   on links (targetNoteId); |  | ||||||
|  |  | ||||||
| create index IDX_attributes_name_index |  | ||||||
|   on attributes (name); |  | ||||||
|  |  | ||||||
| create index IDX_attributes_noteId_index |  | ||||||
|   on attributes (noteId); |  | ||||||
|  |  | ||||||
| create index IDX_attributes_value_index |  | ||||||
|   on attributes (value); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| UPDATE attributes SET isDeleted = 1 WHERE noteId IN (SELECT noteId FROM notes WHERE isDeleted = 1); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| UPDATE attributes SET isDeleted = 1 WHERE type = 'relation' AND value NOT IN (SELECT noteId FROM notes WHERE notes.isDeleted = 0); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| UPDATE attributes SET value = replace(value, 'mirrorRelation', 'inverseRelation') WHERE type = 'relation-definition'; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| UPDATE attributes SET name = 'archived' where name = 'hideInAutocomplete'; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
| VALUES ('hoistedNoteId', 'root', '2018-12-11T18:31:00.874Z', '2018-12-11T18:31:00.874Z', 0); |  | ||||||
| @@ -1,62 +0,0 @@ | |||||||
| const sql = require('../../src/services/sql'); |  | ||||||
|  |  | ||||||
| function prependIv(cipherText, ivText) { |  | ||||||
|     const arr = ivText.split("").map(c => parseInt(c) || 0); |  | ||||||
|     const iv = Buffer.from(arr); |  | ||||||
|     const payload = Buffer.from(cipherText, 'base64'); |  | ||||||
|     const complete = Buffer.concat([iv, payload]); |  | ||||||
|  |  | ||||||
|     return complete.toString('base64'); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| async function updateEncryptedDataKey() { |  | ||||||
|     const encryptedDataKey = await sql.getValue("SELECT value FROM options WHERE name = 'encryptedDataKey'"); |  | ||||||
|     const encryptedDataKeyIv = await sql.getValue("SELECT value FROM options WHERE name = 'encryptedDataKeyIv'"); |  | ||||||
|  |  | ||||||
|     const newEncryptedDataKey = prependIv(encryptedDataKey, encryptedDataKeyIv); |  | ||||||
|  |  | ||||||
|     await sql.execute("UPDATE options SET value = ? WHERE name = 'encryptedDataKey'", [newEncryptedDataKey]); |  | ||||||
|  |  | ||||||
|     await sql.execute("DELETE FROM options WHERE name = 'encryptedDataKeyIv'"); |  | ||||||
|     await sql.execute("DELETE FROM sync WHERE entityName = 'options' AND entityId = 'encryptedDataKeyIv'"); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| async function updateNotes() { |  | ||||||
|     const protectedNotes = await sql.getRows("SELECT noteId, title, content FROM notes WHERE isProtected = 1"); |  | ||||||
|  |  | ||||||
|     for (const note of protectedNotes) { |  | ||||||
|         if (note.title !== null) { |  | ||||||
|             note.title = prependIv(note.title, "0" + note.noteId); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (note.content !== null) { |  | ||||||
|             note.content = prependIv(note.content, "1" + note.noteId); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         await sql.execute("UPDATE notes SET title = ?, content = ? WHERE noteId = ?", [note.title, note.content, note.noteId]); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| async function updateNoteRevisions() { |  | ||||||
|     const protectedNoteRevisions = await sql.getRows("SELECT noteRevisionId, title, content FROM note_revisions WHERE isProtected = 1"); |  | ||||||
|  |  | ||||||
|     for (const noteRevision of protectedNoteRevisions) { |  | ||||||
|         if (noteRevision.title !== null) { |  | ||||||
|             noteRevision.title = prependIv(noteRevision.title, "0" + noteRevision.noteRevisionId); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (noteRevision.content !== null) { |  | ||||||
|             noteRevision.content = prependIv(noteRevision.content, "1" + noteRevision.noteRevisionId); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         await sql.execute("UPDATE note_revisions SET title = ?, content = ? WHERE noteRevisionId = ?", [noteRevision.title, noteRevision.content, noteRevision.noteRevisionId]); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| module.exports = async () => { |  | ||||||
|     await updateEncryptedDataKey(); |  | ||||||
|  |  | ||||||
|     await updateNotes(); |  | ||||||
|  |  | ||||||
|     await updateNoteRevisions(); |  | ||||||
| }; |  | ||||||
| @@ -1,8 +0,0 @@ | |||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
| VALUES ('mainFontSize', '100', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
| VALUES ('treeFontSize', '100', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
| VALUES ('detailFontSize', '110', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0); |  | ||||||
| @@ -1,11 +0,0 @@ | |||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
|   SELECT 'mainFontSize', '100', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0 |  | ||||||
|     WHERE NOT EXISTS (SELECT 1 FROM options WHERE name = 'mainFontSize'); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
|   SELECT 'treeFontSize', '100', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0 |  | ||||||
|     WHERE NOT EXISTS (SELECT 1 FROM options WHERE name = 'treeFontSize'); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, dateCreated, dateModified, isSynced) |  | ||||||
|   SELECT 'detailFontSize', '110', '2019-01-13T18:31:00.874Z', '2019-01-13T18:31:00.874Z', 0 |  | ||||||
|     WHERE NOT EXISTS (SELECT 1 FROM options WHERE name = 'detailFontSize'); |  | ||||||
| @@ -1,35 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "note_contents" ( |  | ||||||
|   `noteContentId`	TEXT NOT NULL, |  | ||||||
|   `noteId`	TEXT NOT NULL, |  | ||||||
|   `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|   `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|   `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|   `dateCreated`	TEXT NOT NULL, |  | ||||||
|   `dateModified` TEXT NOT NULL, |  | ||||||
|   PRIMARY KEY(`noteContentId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_note_contents_noteId` ON `note_contents` (`noteId`); |  | ||||||
|  |  | ||||||
| INSERT INTO note_contents (noteContentId, noteId, isProtected, content, dateCreated, dateModified) |  | ||||||
|   SELECT 'C' || SUBSTR(noteId, 2), noteId, isProtected, content, dateCreated, dateModified FROM notes; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|   `noteId`	TEXT NOT NULL, |  | ||||||
|   `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|   `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|   `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|   `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|   `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|   `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|   `dateCreated`	TEXT NOT NULL, |  | ||||||
|   `dateModified`	TEXT NOT NULL, |  | ||||||
|   PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, isProtected, isDeleted, dateCreated, dateModified, type, mime, hash) |  | ||||||
| SELECT noteId, title, isProtected, isDeleted, dateCreated, dateModified, type, mime, hash FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
|  |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT OR REPLACE INTO sync (entityName, entityId, sourceId, syncDate) |  | ||||||
| SELECT 'note_contents', noteContentId, '', '2019-03-02T18:07:29.182Z' FROM note_contents; |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| UPDATE notes SET title = 'Recovered protected note', isProtected = 0 WHERE noteId IN ( |  | ||||||
|     SELECT noteId FROM notes JOIN note_contents USING(noteId) |  | ||||||
|     WHERE notes.isProtected = 1 |  | ||||||
|       AND note_contents.isProtected = 0 |  | ||||||
|       AND notes.isDeleted = 0 |  | ||||||
| ) |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| module.exports = async () => {}; |  | ||||||
| @@ -1,236 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "sync_mig" ( |  | ||||||
|                                     `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                     `entityName`	TEXT NOT NULL, |  | ||||||
|                                     `entityId`	TEXT NOT NULL, |  | ||||||
|                                     `sourceId` TEXT NOT NULL, |  | ||||||
|                                     `utcSyncDate`	TEXT NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO sync_mig (id, entityName, entityId, sourceId, utcSyncDate) |  | ||||||
|   SELECT id, entityName, entityId, sourceId, REPLACE(syncDate, 'T', ' ') FROM sync; |  | ||||||
|  |  | ||||||
| DROP TABLE sync; |  | ||||||
| ALTER TABLE sync_mig RENAME TO sync; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "source_ids_mig" ( |  | ||||||
|                                           `sourceId`	TEXT NOT NULL, |  | ||||||
|                                           `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                           PRIMARY KEY(`sourceId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO source_ids_mig (sourceId, utcDateCreated) |  | ||||||
|   SELECT sourceId, REPLACE(dateCreated, 'T', ' ') FROM source_ids; |  | ||||||
|  |  | ||||||
| DROP TABLE source_ids; |  | ||||||
| ALTER TABLE source_ids_mig RENAME TO source_ids; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "note_revisions_mig" ( |  | ||||||
|                                               `noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                               `noteId`	TEXT NOT NULL, |  | ||||||
|                                               `title`	TEXT, |  | ||||||
|                                               `content`	TEXT, |  | ||||||
|                                               `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                               `utcDateModifiedFrom` TEXT NOT NULL, |  | ||||||
|                                               `utcDateModifiedTo` TEXT NOT NULL, |  | ||||||
|                                               `dateModifiedFrom` TEXT NOT NULL, |  | ||||||
|                                               `dateModifiedTo` TEXT NOT NULL, |  | ||||||
|                                               type TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                               mime TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                               hash TEXT DEFAULT "" NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO note_revisions_mig (noteRevisionId, noteId, title, content, isProtected, utcDateModifiedFrom, utcDateModifiedTo, dateModifiedFrom, dateModifiedTo, type, mime, hash) |  | ||||||
| SELECT noteRevisionId, noteId, title, content, isProtected, REPLACE(dateModifiedFrom, 'T', ' '), REPLACE(dateModifiedTo, 'T', ' '), REPLACE(REPLACE(dateModifiedFrom, 'T', ' '), 'Z', '+0000'), REPLACE(REPLACE(dateModifiedTo, 'T', ' '), 'Z', '+0000'), type, mime, hash FROM note_revisions; |  | ||||||
|  |  | ||||||
| DROP TABLE note_revisions; |  | ||||||
| ALTER TABLE note_revisions_mig RENAME TO note_revisions; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "api_tokens_mig" |  | ||||||
| ( |  | ||||||
|   apiTokenId TEXT PRIMARY KEY NOT NULL, |  | ||||||
|   token TEXT NOT NULL, |  | ||||||
|   utcDateCreated TEXT NOT NULL, |  | ||||||
|   isDeleted INT NOT NULL DEFAULT 0, |  | ||||||
|   hash TEXT DEFAULT "" NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO api_tokens_mig (apiTokenId, token, utcDateCreated, isDeleted, hash) |  | ||||||
|   SELECT apiTokenId, token, REPLACE(dateCreated, 'T', ' '), isDeleted, hash FROM api_tokens; |  | ||||||
|  |  | ||||||
| DROP TABLE api_tokens; |  | ||||||
| ALTER TABLE api_tokens_mig RENAME TO api_tokens; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "branches_mig" ( |  | ||||||
|                                         `branchId`	TEXT NOT NULL, |  | ||||||
|                                         `noteId`	TEXT NOT NULL, |  | ||||||
|                                         `parentNoteId`	TEXT NOT NULL, |  | ||||||
|                                         `notePosition`	INTEGER NOT NULL, |  | ||||||
|                                         `prefix`	TEXT, |  | ||||||
|                                         `isExpanded`	BOOLEAN, |  | ||||||
|                                         `isDeleted`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                         `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                         utcDateCreated TEXT NOT NULL, |  | ||||||
|                                         hash TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                         PRIMARY KEY(`branchId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO branches_mig (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated, hash) |  | ||||||
|   SELECT branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, REPLACE(dateModified, 'T', ' '), REPLACE(dateCreated, 'T', ' '), hash FROM branches; |  | ||||||
|  |  | ||||||
| DROP TABLE branches; |  | ||||||
| ALTER TABLE branches_mig RENAME TO branches; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "recent_notes_mig" ( |  | ||||||
|                                             `branchId` TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                             `notePath` TEXT NOT NULL, |  | ||||||
|                                             hash TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                             `utcDateCreated` TEXT NOT NULL, |  | ||||||
|                                             isDeleted INT |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO recent_notes_mig (branchId, notePath, hash, utcDateCreated, isDeleted) |  | ||||||
|   SELECT branchId, notePath, hash, REPLACE(dateCreated, 'T', ' '), isDeleted FROM recent_notes; |  | ||||||
|  |  | ||||||
| DROP TABLE recent_notes; |  | ||||||
| ALTER TABLE recent_notes_mig RENAME TO recent_notes; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "event_log_mig" ( |  | ||||||
|                                          `eventId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                          `noteId`	TEXT, |  | ||||||
|                                          `comment`	TEXT, |  | ||||||
|                                          `utcDateCreated`	TEXT NOT NULL |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO event_log_mig (eventId, noteId, comment, utcDateCreated) |  | ||||||
|   SELECT eventId, noteId, comment, REPLACE(dateCreated, 'T', ' ') FROM event_log; |  | ||||||
|  |  | ||||||
| DROP TABLE event_log; |  | ||||||
| ALTER TABLE event_log_mig RENAME TO event_log; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "options_mig" |  | ||||||
| ( |  | ||||||
|   name TEXT not null PRIMARY KEY, |  | ||||||
|   value TEXT, |  | ||||||
|   isSynced INTEGER default 0 not null, |  | ||||||
|   hash TEXT default "" not null, |  | ||||||
|   utcDateCreated TEXT not null, |  | ||||||
|   utcDateModified TEXT NOT NULL |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO options_mig (name, value, isSynced, hash, utcDateCreated, utcDateModified) |  | ||||||
|   SELECT name, value, isSynced, hash, REPLACE(dateCreated, 'T', ' '), REPLACE(dateModified, 'T', ' ') FROM options; |  | ||||||
|  |  | ||||||
| DROP TABLE options; |  | ||||||
| ALTER TABLE options_mig RENAME TO options; |  | ||||||
|  |  | ||||||
| CREATE TABLE attributes_mig |  | ||||||
| ( |  | ||||||
|   attributeId      TEXT not null primary key, |  | ||||||
|   noteId       TEXT not null, |  | ||||||
|   type         TEXT not null, |  | ||||||
|   name         TEXT not null, |  | ||||||
|   value        TEXT default '' not null, |  | ||||||
|   position     INT  default 0 not null, |  | ||||||
|   utcDateCreated  TEXT not null, |  | ||||||
|   utcDateModified TEXT not null, |  | ||||||
|   isDeleted    INT  not null, |  | ||||||
|   hash         TEXT default "" not null, |  | ||||||
|   isInheritable int DEFAULT 0 NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO attributes_mig (attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, hash, isInheritable) |  | ||||||
|   SELECT attributeId, noteId, type, name, value, position, REPLACE(dateCreated, 'T', ' '), REPLACE(dateModified, 'T', ' '), isDeleted, hash, isInheritable FROM attributes; |  | ||||||
|  |  | ||||||
| DROP TABLE attributes; |  | ||||||
| ALTER TABLE attributes_mig RENAME TO attributes; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "links_mig" ( |  | ||||||
|                                      `linkId`	TEXT NOT NULL, |  | ||||||
|                                      `noteId`	TEXT NOT NULL, |  | ||||||
|                                      `targetNoteId`	TEXT NOT NULL, |  | ||||||
|                                      `type` TEXT NOT NULL, |  | ||||||
|                                      `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                      `isDeleted`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                      `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                      `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                      PRIMARY KEY(`linkId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO links_mig (linkId, noteId, targetNoteId, type, hash, isDeleted, utcDateCreated, utcDateModified) |  | ||||||
|   SELECT linkId, noteId, targetNoteId, type, hash, isDeleted, REPLACE(dateCreated, 'T', ' '), REPLACE(dateModified, 'T', ' ') FROM links; |  | ||||||
|  |  | ||||||
| DROP TABLE links; |  | ||||||
| ALTER TABLE links_mig RENAME TO links; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "note_contents_mig" ( |  | ||||||
|                                              `noteContentId`	TEXT NOT NULL, |  | ||||||
|                                              `noteId`	TEXT NOT NULL, |  | ||||||
|                                              `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                              `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|                                              `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                              `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                              `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                              PRIMARY KEY(`noteContentId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO note_contents_mig (noteContentId, noteId, isProtected, content, hash, utcDateCreated, utcDateModified) |  | ||||||
|   SELECT noteContentId, noteId, isProtected, content, hash, REPLACE(dateCreated, 'T', ' '), REPLACE(dateModified, 'T', ' ') FROM note_contents; |  | ||||||
|  |  | ||||||
| DROP TABLE note_contents; |  | ||||||
| ALTER TABLE note_contents_mig RENAME TO note_contents; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|                                      `noteId`	TEXT NOT NULL, |  | ||||||
|                                      `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|                                      `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                      `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|                                      `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|                                      `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                      `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                      `dateCreated`	TEXT NOT NULL, |  | ||||||
|                                      `dateModified`	TEXT NOT NULL, |  | ||||||
|                                      `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                      `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                      PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, isProtected, type, mime, hash, isDeleted, dateCreated, dateModified, utcDateCreated, utcDateModified) |  | ||||||
|   SELECT noteId, title, isProtected, type, mime, hash, isDeleted, REPLACE(REPLACE(dateCreated, 'T', ' '), 'Z', '+0000'), REPLACE(REPLACE(dateModified, 'T', ' '), 'Z', '+0000'), REPLACE(dateCreated, 'T', ' '), REPLACE(dateModified, 'T', ' ') FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` ( |  | ||||||
|                                                               `entityName`, |  | ||||||
|                                                               `entityId` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` ( |  | ||||||
|                                             `utcSyncDate` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` ( |  | ||||||
|                                                               `noteId` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateModifiedFrom` ON `note_revisions` ( |  | ||||||
|                                                                         `utcDateModifiedFrom` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateModifiedTo` ON `note_revisions` ( |  | ||||||
|                                                                       `utcDateModifiedTo` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX `IDX_branches_noteId` ON `branches` ( |  | ||||||
|                                                   `noteId` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` ( |  | ||||||
|                                                                `noteId`, |  | ||||||
|                                                                `parentNoteId` |  | ||||||
|   ); |  | ||||||
| CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId); |  | ||||||
| CREATE INDEX IDX_attributes_name_value |  | ||||||
|   on attributes (name, value); |  | ||||||
| CREATE INDEX IDX_links_noteId_index |  | ||||||
|   on links (noteId); |  | ||||||
| CREATE INDEX IDX_links_targetNoteId_index |  | ||||||
|   on links (targetNoteId); |  | ||||||
| CREATE INDEX IDX_attributes_name_index |  | ||||||
|   on attributes (name); |  | ||||||
| CREATE INDEX IDX_attributes_noteId_index |  | ||||||
|   on attributes (noteId); |  | ||||||
| CREATE INDEX IDX_attributes_value_index |  | ||||||
|   on attributes (value); |  | ||||||
| CREATE UNIQUE INDEX `IDX_note_contents_noteId` ON `note_contents` (`noteId`); |  | ||||||
| @@ -1,13 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "note_contents_mig" ( |  | ||||||
|                                                    `noteId`	TEXT NOT NULL, |  | ||||||
|                                                    `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|                                                    `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                                    `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                                    PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO note_contents_mig (noteId, content, hash, utcDateModified) |  | ||||||
| SELECT noteId, content, hash, utcDateModified FROM note_contents; |  | ||||||
|  |  | ||||||
| DROP TABLE note_contents; |  | ||||||
| ALTER TABLE note_contents_mig RENAME TO note_contents; |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| const syncTableService = require('../../src/services/entity_changes.js'); |  | ||||||
|  |  | ||||||
| module.exports = async () => { |  | ||||||
|     await syncTableService.fillAllSyncRows(); |  | ||||||
| }; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| DROP TABLE IF EXISTS note_fulltext; |  | ||||||
| @@ -1,4 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
|     SELECT 'openTabs', '[{"notePath":"' || value || '","active": true,"tabId":"1111"}]', '2019-05-01T18:31:00.874Z', '2019-05-01T18:31:00.874Z', 0 FROM options WHERE name = 'startNotePath'; |  | ||||||
|  |  | ||||||
| DELETE FROM options WHERE name = 'startNotePath'; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
|     VALUES ('hideTabRowForOneTab', 'false', '2019-05-01T18:31:00.874Z', '2019-05-01T18:31:00.874Z', 0); |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| drop table recent_notes; |  | ||||||
|  |  | ||||||
| create table recent_notes |  | ||||||
| ( |  | ||||||
|     noteId TEXT not null primary key, |  | ||||||
|     notePath TEXT not null, |  | ||||||
|     hash TEXT default "" not null, |  | ||||||
|     utcDateCreated TEXT not null, |  | ||||||
|     isDeleted INT |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| delete from sync where entityName = 'recent_notes'; |  | ||||||
| @@ -1,10 +0,0 @@ | |||||||
| UPDATE links SET type = 'internal-link' WHERE type = 'hyper'; |  | ||||||
| UPDATE links SET type = 'image-link' WHERE type = 'image'; |  | ||||||
| UPDATE links SET type = 'relation-map-link' WHERE type = 'relation-map'; |  | ||||||
|  |  | ||||||
| INSERT INTO attributes (attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, hash, isInheritable) |  | ||||||
| SELECT linkId, noteId, 'relation', type, targetNoteId, 0, utcDateCreated, utcDateModified, isDeleted, hash, 0 FROM links; |  | ||||||
|  |  | ||||||
| UPDATE sync SET entityName = 'attributes' WHERE entityName = 'links'; |  | ||||||
|  |  | ||||||
| DROP TABLE links; |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('sidebarMinWidth', '350', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('sidebarWidthPercent', '25', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('showSidebarInNewTab', 'true', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('noteInfoWidget', '{"enabled":true,"expanded":true,"position":100}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('attributesWidget', '{"enabled":true,"expanded":true,"position":200}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('linkMapWidget', '{"enabled":true,"expanded":true,"position":300}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('noteRevisionsWidget', '{"enabled":true,"expanded":true,"position":400}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('whatLinksHereWidget', '{"enabled":false,"expanded":true,"position":500}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('codeNotesMimeTypes', '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-swift","text/xml","text/x-yaml"]', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 1); |  | ||||||
|  |  | ||||||
| INSERT INTO sync (entityName, entityId, sourceId, utcSyncDate) |  | ||||||
| VALUES ('options' ,'codeNotesMimeTypes', 'SYNC_FILL', '2018-01-01T00:00:00.000Z'); |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('similarNotesWidget', '{"enabled":true,"expanded":true,"position":600}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| DROP TABLE event_log; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('editedNotesWidget', '{"enabled":true,"expanded":true,"position":50}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('calendarWidget', '{"enabled":true,"expanded":true,"position":20}', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('spellCheckEnabled', 'true', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
|  |  | ||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| VALUES ('spellCheckLanguageCode', 'en-US', '2018-07-29T18:31:00.874Z', '2018-07-29T18:31:00.874Z', 0); |  | ||||||
| @@ -1,3 +0,0 @@ | |||||||
| INSERT INTO options (name, value, utcDateCreated, utcDateModified, isSynced) |  | ||||||
| SELECT 'hideTabRowForOneTab', 'false', '2019-05-01T18:31:00.874Z', '2019-05-01T18:31:00.874Z', 0 |  | ||||||
| WHERE NOT EXISTS(SELECT 1 FROM options WHERE name = 'hideTabRowForOneTab'); |  | ||||||
| @@ -1,22 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "mig_branches" ( |  | ||||||
|                                           `branchId`	TEXT NOT NULL, |  | ||||||
|                                           `noteId`	TEXT NOT NULL, |  | ||||||
|                                           `parentNoteId`	TEXT NOT NULL, |  | ||||||
|                                           `notePosition`	INTEGER NOT NULL, |  | ||||||
|                                           `prefix`	TEXT, |  | ||||||
|                                           `isExpanded`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                           `isDeleted`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                           `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                           utcDateCreated TEXT NOT NULL, |  | ||||||
|                                           hash TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                           PRIMARY KEY(`branchId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_branches (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated, hash) |  | ||||||
| SELECT branchId, noteId, parentNoteId, notePosition, prefix, COALESCE(isExpanded, 0), isDeleted, utcDateModified, utcDateCreated, hash FROM branches; |  | ||||||
|  |  | ||||||
| DROP TABLE branches; |  | ||||||
| ALTER TABLE mig_branches RENAME TO branches; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_branches_noteId` ON `branches` (`noteId`); |  | ||||||
| CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`); |  | ||||||
| CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId); |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| UPDATE branches SET notePosition = notePosition * 10; |  | ||||||
| UPDATE attributes SET position = position * 10; |  | ||||||
| @@ -1,36 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "note_revisions_mig" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                                 `noteId`	TEXT NOT NULL, |  | ||||||
|                                                 `title`	TEXT, |  | ||||||
|                                                 `contentLength`	INT NOT NULL, |  | ||||||
|                                                 `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                                 `utcDateLastEdited` TEXT NOT NULL, |  | ||||||
|                                                 `utcDateCreated` TEXT NOT NULL, |  | ||||||
|                                                 `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                                 `dateLastEdited` TEXT NOT NULL, |  | ||||||
|                                                 `dateCreated` TEXT NOT NULL, |  | ||||||
|                                                 type TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                                 mime TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                                 hash TEXT DEFAULT '' NOT NULL); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "note_revision_contents" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                                  `content`	TEXT, |  | ||||||
|                                                  hash TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                                  `utcDateModified` TEXT NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO note_revision_contents (noteRevisionId, content, hash, utcDateModified) |  | ||||||
| SELECT noteRevisionId, content, hash, utcDateModifiedTo FROM note_revisions; |  | ||||||
|  |  | ||||||
| INSERT INTO note_revisions_mig (noteRevisionId, noteId, title, contentLength, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash) |  | ||||||
| SELECT noteRevisionId, noteId, title, COALESCE(LENGTH(content), 0), isProtected, utcDateModifiedFrom, utcDateModifiedTo, utcDateModifiedTo, dateModifiedFrom, dateModifiedTo, type, mime, hash FROM note_revisions; |  | ||||||
|  |  | ||||||
| DROP TABLE note_revisions; |  | ||||||
| ALTER TABLE note_revisions_mig RENAME TO note_revisions; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); |  | ||||||
|  |  | ||||||
| INSERT INTO sync (entityName, entityId, sourceId, utcSyncDate) |  | ||||||
| SELECT 'note_revision_contents', entityId, sourceId, utcSyncDate FROM sync WHERE entityName = 'note_revisions'; |  | ||||||
| @@ -1,31 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|                                        `noteId`	TEXT NOT NULL, |  | ||||||
|                                        `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|                                        `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|                                        `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|                                        `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                        `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `isErased`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `dateCreated`	TEXT NOT NULL, |  | ||||||
|                                        `dateModified`	TEXT NOT NULL, |  | ||||||
|                                        `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                        `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                        PRIMARY KEY(`noteId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, isProtected, type, mime, hash, isDeleted, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified) |  | ||||||
| SELECT noteId, title, isProtected, type, mime, hash, isDeleted, 0, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
|  |  | ||||||
| UPDATE notes SET isErased = 1 WHERE isDeleted = 1 |  | ||||||
| AND 1=(SELECT CASE WHEN content IS NULL THEN 1 ELSE 0 END FROM note_contents WHERE note_contents.noteId = notes.noteId); |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`); |  | ||||||
| CREATE INDEX `IDX_notes_title` ON `notes` (`title`); |  | ||||||
| CREATE INDEX `IDX_notes_type` ON `notes` (`type`); |  | ||||||
| CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); |  | ||||||
| @@ -1,34 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|                                            `noteId`	TEXT NOT NULL, |  | ||||||
|                                            `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|                                            `contentLength`	INT NOT NULL, |  | ||||||
|                                            `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                            `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|                                            `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|                                            `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                            `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                            `isErased`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                            `dateCreated`	TEXT NOT NULL, |  | ||||||
|                                            `dateModified`	TEXT NOT NULL, |  | ||||||
|                                            `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                            `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                            PRIMARY KEY(`noteId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, contentLength, isProtected, type, mime, hash, isDeleted, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified) |  | ||||||
| SELECT noteId, title, -1, isProtected, type, mime, hash, isDeleted, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
|  |  | ||||||
| UPDATE notes SET contentLength = COALESCE((SELECT COALESCE(LENGTH(content), 0) FROM note_contents WHERE note_contents.noteId = notes.noteId), -1); |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`); |  | ||||||
| CREATE INDEX `IDX_notes_title` ON `notes` (`title`); |  | ||||||
| CREATE INDEX `IDX_notes_type` ON `notes` (`type`); |  | ||||||
| CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); |  | ||||||
|  |  | ||||||
| -- should be OK since sync protocol changes so all instances must upgrade |  | ||||||
| UPDATE attributes SET isDeleted = 1 WHERE name = 'fileSize'; |  | ||||||
| @@ -1,28 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "note_revisions_mig" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                                  `noteId`	TEXT NOT NULL, |  | ||||||
|                                                  `title`	TEXT, |  | ||||||
|                                                  `contentLength`	INT NOT NULL, |  | ||||||
|                                                  `isErased`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                                  `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                                  `utcDateLastEdited` TEXT NOT NULL, |  | ||||||
|                                                  `utcDateCreated` TEXT NOT NULL, |  | ||||||
|                                                  `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                                  `dateLastEdited` TEXT NOT NULL, |  | ||||||
|                                                  `dateCreated` TEXT NOT NULL, |  | ||||||
|                                                  type TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                                  mime TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                                  hash TEXT DEFAULT '' NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO note_revisions_mig (noteRevisionId, noteId, title, contentLength, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash) |  | ||||||
| SELECT noteRevisionId, noteId, title, contentLength, 0, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash FROM note_revisions; |  | ||||||
|  |  | ||||||
| DROP TABLE note_revisions; |  | ||||||
| ALTER TABLE note_revisions_mig RENAME TO note_revisions; |  | ||||||
|  |  | ||||||
| UPDATE note_revisions SET isErased = (SELECT isErased FROM notes WHERE notes.noteId = note_revisions.noteId); |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); |  | ||||||
| @@ -1,3 +0,0 @@ | |||||||
| UPDATE attributes SET name = 'internalLink' WHERE name = 'internal-link'; |  | ||||||
| UPDATE attributes SET name = 'imageLink' WHERE name = 'image-link'; |  | ||||||
| UPDATE attributes SET name = 'relationMapLink' WHERE name = 'relation-map-link'; |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| DROP INDEX IF EXISTS IDX_attributes_name_index; |  | ||||||
| DROP INDEX IF EXISTS IDX_branches_noteId; |  | ||||||
|  |  | ||||||
| CREATE INDEX IDX_source_ids_utcDateCreated |  | ||||||
|     on source_ids (utcDateCreated); |  | ||||||
| @@ -1,81 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|                                            `noteId`	TEXT NOT NULL, |  | ||||||
|                                            `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|                                            `contentLength`	INT NOT NULL, |  | ||||||
|                                            `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                            `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|                                            `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|                                            `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                            `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                            `deleteId`   TEXT DEFAULT NULL, |  | ||||||
|                                            `isErased`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                            `dateCreated`	TEXT NOT NULL, |  | ||||||
|                                            `dateModified`	TEXT NOT NULL, |  | ||||||
|                                            `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                            `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                            PRIMARY KEY(`noteId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, contentLength, isProtected, type, mime, hash, isDeleted, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified) |  | ||||||
| SELECT noteId, title, -1, isProtected, type, mime, hash, isDeleted, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`); |  | ||||||
| CREATE INDEX `IDX_notes_title` ON `notes` (`title`); |  | ||||||
| CREATE INDEX `IDX_notes_type` ON `notes` (`type`); |  | ||||||
| CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "branches_mig" ( |  | ||||||
|                                           `branchId`	TEXT NOT NULL, |  | ||||||
|                                           `noteId`	TEXT NOT NULL, |  | ||||||
|                                           `parentNoteId`	TEXT NOT NULL, |  | ||||||
|                                           `notePosition`	INTEGER NOT NULL, |  | ||||||
|                                           `prefix`	TEXT, |  | ||||||
|                                           `isExpanded`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                           `isDeleted`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                           `deleteId`    TEXT DEFAULT NULL, |  | ||||||
|                                           `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                           utcDateCreated TEXT NOT NULL, |  | ||||||
|                                           hash TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                           PRIMARY KEY(`branchId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO branches_mig (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated, hash) |  | ||||||
|     SELECT branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated, hash FROM branches; |  | ||||||
|  |  | ||||||
| DROP TABLE branches; |  | ||||||
| ALTER TABLE branches_mig RENAME TO branches; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`); |  | ||||||
| CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "attributes_mig" |  | ||||||
| ( |  | ||||||
|     attributeId      TEXT not null primary key, |  | ||||||
|     noteId       TEXT not null, |  | ||||||
|     type         TEXT not null, |  | ||||||
|     name         TEXT not null, |  | ||||||
|     value        TEXT default '' not null, |  | ||||||
|     position     INT  default 0 not null, |  | ||||||
|     utcDateCreated  TEXT not null, |  | ||||||
|     utcDateModified TEXT not null, |  | ||||||
|     isDeleted    INT  not null, |  | ||||||
|     `deleteId`    TEXT DEFAULT NULL, |  | ||||||
|     hash         TEXT default "" not null, |  | ||||||
|     isInheritable int DEFAULT 0 NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO attributes_mig (attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, hash, isInheritable) |  | ||||||
| SELECT attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, hash, isInheritable FROM attributes; |  | ||||||
|  |  | ||||||
| DROP TABLE attributes; |  | ||||||
| ALTER TABLE attributes_mig RENAME TO attributes; |  | ||||||
|  |  | ||||||
| CREATE INDEX IDX_attributes_name_value |  | ||||||
|     on attributes (name, value); |  | ||||||
| CREATE INDEX IDX_attributes_noteId_index |  | ||||||
|     on attributes (noteId); |  | ||||||
| CREATE INDEX IDX_attributes_value_index |  | ||||||
|     on attributes (value); |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| UPDATE notes SET contentLength = COALESCE((SELECT COALESCE(LENGTH(content), 0) FROM note_contents WHERE note_contents.noteId = notes.noteId), -1); |  | ||||||
| @@ -1,22 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "sync_mig" ( |  | ||||||
|                                           `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                           `entityName`	TEXT NOT NULL, |  | ||||||
|                                           `entityId`	TEXT NOT NULL, |  | ||||||
|                                           `sourceId` TEXT NOT NULL, |  | ||||||
|                                           `isSynced` INTEGER default 0 not null, |  | ||||||
|                                           `utcSyncDate`	TEXT NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO sync_mig (id, entityName, entityId, sourceId, isSynced, utcSyncDate) |  | ||||||
| SELECT id, entityName, entityId, sourceId, 1, utcSyncDate FROM sync; |  | ||||||
|  |  | ||||||
| DROP TABLE sync; |  | ||||||
|  |  | ||||||
| ALTER TABLE sync_mig RENAME TO sync; |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` ( |  | ||||||
|                                                               `entityName`, |  | ||||||
|                                                               `entityId` |  | ||||||
|     ); |  | ||||||
| CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` ( |  | ||||||
|                                                `utcSyncDate` |  | ||||||
|     ); |  | ||||||
| @@ -1,4 +0,0 @@ | |||||||
| UPDATE sync SET isSynced = 1 WHERE entityName != 'options' OR ( |  | ||||||
|         entityName = 'options' |  | ||||||
|         AND 1 = (SELECT isSynced FROM options WHERE name = sync.entityId) |  | ||||||
|     ) |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| UPDATE attributes SET type = 'label', name = 'label:' || name WHERE type = 'label-definition'; |  | ||||||
| UPDATE attributes SET type = 'label', name = 'relation:' || name WHERE type = 'relation-definition'; |  | ||||||
| @@ -1,79 +0,0 @@ | |||||||
| const sql = require('../../src/services/sql'); |  | ||||||
|  |  | ||||||
| module.exports = () => { |  | ||||||
|     for (const attr of sql.getRows("SELECT * FROM attributes WHERE name LIKE 'label:%'")) { |  | ||||||
|         let obj; |  | ||||||
|  |  | ||||||
|         try { |  | ||||||
|             obj = JSON.parse(attr.value); |  | ||||||
|         } |  | ||||||
|         catch (e) { |  | ||||||
|             console.log(`Parsing attribute definition "${attr.value}" of ${attr.attributeId} failed with error "${e.message}", setting to default value.`); |  | ||||||
|  |  | ||||||
|             sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?', |  | ||||||
|                 ["multi,text", attr.attributeId]); |  | ||||||
|  |  | ||||||
|             continue; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const tokens = []; |  | ||||||
|  |  | ||||||
|         if (obj.isPromoted) { |  | ||||||
|             tokens.push('promoted'); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (obj.multiplicityType === 'singlevalue') { |  | ||||||
|             tokens.push('single'); |  | ||||||
|         } else if (obj.multiplicityType === 'multivalue') { |  | ||||||
|             tokens.push('multi'); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (obj.labelType) { |  | ||||||
|             tokens.push(obj.labelType); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (obj.numberPrecision) { |  | ||||||
|             tokens.push('precision='+obj.numberPrecision); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const newValue = tokens.join(','); |  | ||||||
|  |  | ||||||
|         sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?', [newValue, attr.attributeId]); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     for (const attr of sql.getRows("SELECT * FROM attributes WHERE name LIKE 'relation:%'")) { |  | ||||||
|         let obj; |  | ||||||
|  |  | ||||||
|         try { |  | ||||||
|             obj = JSON.parse(attr.value); |  | ||||||
|         } |  | ||||||
|         catch (e) { |  | ||||||
|             console.log(`Parsing attribute definition "${attr.value}" of ${attr.attributeId} failed with error "${e.message}", setting to default value.`); |  | ||||||
|  |  | ||||||
|             sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?', |  | ||||||
|                 ["multi", attr.attributeId]); |  | ||||||
|  |  | ||||||
|             continue; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const tokens = []; |  | ||||||
|  |  | ||||||
|         if (obj.isPromoted) { |  | ||||||
|             tokens.push('promoted'); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (obj.multiplicityType === 'singlevalue') { |  | ||||||
|             tokens.push('single'); |  | ||||||
|         } else if (obj.multiplicityType === 'multivalue') { |  | ||||||
|             tokens.push('multi'); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (obj.inverseRelation) { |  | ||||||
|             tokens.push('inverse=' + obj.inverseRelation); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         const newValue = tokens.join(','); |  | ||||||
|  |  | ||||||
|         sql.execute('UPDATE attributes SET value = ? WHERE attributeId = ?', [newValue, attr.attributeId]); |  | ||||||
|     } |  | ||||||
| }; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| DROP TABLE source_ids; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| ALTER TABLE sync RENAME TO entity_changes; |  | ||||||
| @@ -1,22 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( |  | ||||||
|                                                 `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                                 `entityName`	TEXT NOT NULL, |  | ||||||
|                                                 `entityId`	TEXT NOT NULL, |  | ||||||
|                                                 `sourceId` TEXT NOT NULL, |  | ||||||
|                                                 `isSynced` INTEGER default 0 not null, |  | ||||||
|                                                 `utcChangedDate`	TEXT NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_entity_changes (id, entityName, entityId, sourceId, isSynced, utcChangedDate) |  | ||||||
|     SELECT id, entityName, entityId, sourceId, isSynced, utcSyncDate FROM entity_changes; |  | ||||||
|  |  | ||||||
| DROP TABLE entity_changes; |  | ||||||
|  |  | ||||||
| ALTER TABLE mig_entity_changes RENAME TO entity_changes; |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" ( |  | ||||||
|                                                                                  `entityName`, |  | ||||||
|                                                                                  `entityId` |  | ||||||
|     ); |  | ||||||
| CREATE INDEX `IDX_entityChanges_utcChangedDate` ON "entity_changes" ( |  | ||||||
|                                                                   `utcChangedDate` |  | ||||||
|     ); |  | ||||||
| @@ -1,55 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "notes_mig" ( |  | ||||||
|                                        `noteId`	TEXT NOT NULL, |  | ||||||
|                                        `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|                                        `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|                                        `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|                                        `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                        `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `deleteId`   TEXT DEFAULT NULL, |  | ||||||
|                                        `isErased`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `dateCreated`	TEXT NOT NULL, |  | ||||||
|                                        `dateModified`	TEXT NOT NULL, |  | ||||||
|                                        `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                        `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                        PRIMARY KEY(`noteId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO notes_mig (noteId, title, isProtected, type, mime, hash, isDeleted, deleteId, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified) |  | ||||||
|     SELECT noteId, title, isProtected, type, mime, hash, isDeleted, deleteId, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
| ALTER TABLE notes_mig RENAME TO notes; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`); |  | ||||||
| CREATE INDEX `IDX_notes_title` ON `notes` (`title`); |  | ||||||
| CREATE INDEX `IDX_notes_type` ON `notes` (`type`); |  | ||||||
| CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "note_revisions_mig" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                              `noteId`	TEXT NOT NULL, |  | ||||||
|                                              `title`	TEXT, |  | ||||||
|                                              `isErased`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                              `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                              `utcDateLastEdited` TEXT NOT NULL, |  | ||||||
|                                              `utcDateCreated` TEXT NOT NULL, |  | ||||||
|                                              `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                              `dateLastEdited` TEXT NOT NULL, |  | ||||||
|                                              `dateCreated` TEXT NOT NULL, |  | ||||||
|                                              type TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                              mime TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                              hash TEXT DEFAULT '' NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO note_revisions_mig (noteRevisionId, noteId, title, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash) |  | ||||||
| SELECT noteRevisionId, noteId, title, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated, type, mime, hash FROM note_revisions; |  | ||||||
|  |  | ||||||
| DROP TABLE note_revisions; |  | ||||||
| ALTER TABLE note_revisions_mig RENAME TO note_revisions; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); |  | ||||||
| @@ -1,20 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "note_contents_mig" ( |  | ||||||
|                                                `noteId`	TEXT NOT NULL, |  | ||||||
|                                                `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|                                                `hash` TEXT DEFAULT "" NOT NULL, |  | ||||||
|                                                `dateModified` TEXT NOT NULL, |  | ||||||
|                                                `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                                PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO note_contents_mig (noteId, content, hash, dateModified, utcDateModified) |  | ||||||
|     SELECT noteId, |  | ||||||
|            content, |  | ||||||
|            hash, |  | ||||||
|            COALESCE((SELECT dateModified FROM notes WHERE noteId = note_contents.noteId), utcDateModified), |  | ||||||
|            utcDateModified |  | ||||||
|     FROM note_contents; |  | ||||||
|  |  | ||||||
| DROP TABLE note_contents; |  | ||||||
|  |  | ||||||
| ALTER TABLE note_contents_mig RENAME TO note_contents; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| DELETE FROM options WHERE name = 'keyboardShortcutsActivateParentNote'; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| UPDATE attributes SET name = 'archived' WHERE name = 'hideInAutocomplete'; |  | ||||||
| @@ -1,20 +0,0 @@ | |||||||
| const repository = require('../../src/services/repository'); |  | ||||||
|  |  | ||||||
| module.exports = () => { |  | ||||||
|     for (const note of repository.getEntities("SELECT * FROM notes WHERE type = 'text' AND isProtected = 0")) { |  | ||||||
|         try { |  | ||||||
|             let origContent = note.getContent(); |  | ||||||
|  |  | ||||||
|             const newContent = origContent |  | ||||||
|                 .replace(/<h1/ig, "<h2") |  | ||||||
|                 .replace(/<\/h1/ig, "</h2"); |  | ||||||
|  |  | ||||||
|             if (newContent !== origContent) { |  | ||||||
|                 note.setContent(newContent); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         catch (e) { |  | ||||||
|             console.log(`Changing note content for note ${note.noteId} failed with: ${e.message} ${e.stack}`); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| }; |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| const repository = require('../../src/services/repository'); |  | ||||||
| const sql = require('../../src/services/sql'); |  | ||||||
|  |  | ||||||
| module.exports = () => { |  | ||||||
|     for (const note of repository.getEntities("SELECT * FROM notes")) { |  | ||||||
|         let position = 0; |  | ||||||
|  |  | ||||||
|         for (const branch of note.getChildBranches()) { |  | ||||||
|             sql.execute(`UPDATE branches SET notePosition = ? WHERE branchId = ?`, [position, branch.branchId]); |  | ||||||
|  |  | ||||||
|             position += 10; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| }; |  | ||||||
| @@ -1,15 +0,0 @@ | |||||||
| DELETE FROM options WHERE name IN ( |  | ||||||
|     'noteInfoWidget', |  | ||||||
|     'attributesWidget', |  | ||||||
|     'linkMapWidget', |  | ||||||
|     'noteRevisionsWidget', |  | ||||||
|     'whatLinksHereWidget', |  | ||||||
|     'codeNotesMimeTypes', |  | ||||||
|     'similarNotesWidget', |  | ||||||
|     'editedNotesWidget', |  | ||||||
|     'calendarWidget', |  | ||||||
|     'sidebarMinWidth', |  | ||||||
|     'sidebarWidthPercent', |  | ||||||
|     'showSidebarInNewTab', |  | ||||||
|     'hoistedNoteId' |  | ||||||
| ); |  | ||||||
| @@ -1,69 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( |  | ||||||
|                                                     `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                                     `entityName`	TEXT NOT NULL, |  | ||||||
|                                                     `entityId`	TEXT NOT NULL, |  | ||||||
|                                                     `hash`	TEXT NOT NULL, |  | ||||||
|                                                     `sourceId` TEXT NOT NULL, |  | ||||||
|                                                     `isErased` INT NOT NULL, |  | ||||||
|                                                     `utcDateChanged` TEXT NOT NULL, |  | ||||||
|                                                     `isSynced` INTEGER NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_entity_changes (id, entityName, entityId, hash, sourceId, isSynced, utcDateChanged, isErased) |  | ||||||
| SELECT id, entityName, entityId, '', sourceId, isSynced, utcChangedDate, 0 FROM entity_changes; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET isErased = (SELECT isErased FROM notes WHERE noteId = entityId) WHERE entityName = 'notes'; |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM notes WHERE noteId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'notes'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET isErased = (SELECT isErased FROM notes WHERE noteId = entityId) WHERE entityName = 'note_contents'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET isErased = ( |  | ||||||
|     SELECT isErased |  | ||||||
|     FROM attributes |  | ||||||
|          JOIN notes USING(noteId) |  | ||||||
|     WHERE attributeId = entityId |  | ||||||
| ) WHERE entityName = 'attributes'; |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM attributes WHERE attributeId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'attributes'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET isErased = ( |  | ||||||
|     SELECT isErased |  | ||||||
|     FROM branches |  | ||||||
|     JOIN notes USING(noteId) |  | ||||||
|     WHERE branchId = entityId |  | ||||||
| ) WHERE entityName = 'branches'; |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM branches WHERE branchId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'branches'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET isErased = ( |  | ||||||
|     SELECT isErased |  | ||||||
|     FROM note_revisions |  | ||||||
|     WHERE noteRevisionId = entityId |  | ||||||
| ) WHERE entityName = 'note_revisions'; |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM note_revisions WHERE noteRevisionId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'note_revisions'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateCreated FROM api_tokens WHERE apiTokenId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'api_tokens'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM note_contents WHERE noteId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'note_contents'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM note_revision_contents WHERE noteRevisionId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'note_revision_contents'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateModified FROM options WHERE name = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'options'; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET utcDateChanged = COALESCE((SELECT utcDateCreated FROM recent_notes WHERE noteId = entityId), '2020-12-14 14:07:05.165Z') WHERE entityName = 'options'; |  | ||||||
|  |  | ||||||
| DROP TABLE entity_changes; |  | ||||||
| ALTER TABLE mig_entity_changes RENAME TO entity_changes; |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" ( |  | ||||||
|                                                                                  `entityName`, |  | ||||||
|                                                                                  `entityId` |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
| DELETE FROM attributes WHERE noteId IN (SELECT noteId FROM notes WHERE isErased = 1); |  | ||||||
| DELETE FROM branches WHERE noteId IN (SELECT noteId FROM notes WHERE isErased = 1); |  | ||||||
| DELETE FROM note_contents WHERE noteId IN (SELECT noteId FROM notes WHERE isErased = 1); |  | ||||||
| DELETE FROM note_revision_contents WHERE noteRevisionId IN ( |  | ||||||
|     SELECT noteRevisionId FROM note_revisions WHERE isErased = 1 |  | ||||||
| ); |  | ||||||
| DELETE FROM note_revisions WHERE isErased = 1; |  | ||||||
| DELETE FROM notes WHERE isErased = 1; |  | ||||||
|  |  | ||||||
| UPDATE entity_changes SET isErased = COALESCE((SELECT isErased FROM entity_changes AS sub WHERE sub.entityId = entity_changes.entityId AND sub.entityName = 'note_revisions'), 0) WHERE entityName = 'note_revision_contents'; |  | ||||||
| @@ -1,198 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( |  | ||||||
|                                                 `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |  | ||||||
|                                                 `entityName`	TEXT NOT NULL, |  | ||||||
|                                                 `entityId`	TEXT NOT NULL, |  | ||||||
|                                                 `hash`	TEXT NOT NULL, |  | ||||||
|                                                 `isErased` INT NOT NULL, |  | ||||||
|                                                 `sourceId` TEXT NOT NULL, |  | ||||||
|                                                 `isSynced` INTEGER NOT NULL, |  | ||||||
|                                                 `utcDateChanged` TEXT NOT NULL |  | ||||||
|                                                 ); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_entity_changes (id, entityName, entityId, hash, sourceId, isSynced, isErased, utcDateChanged) |  | ||||||
|     SELECT id, entityName, entityId, '', sourceId, isSynced, isErased, utcDateChanged FROM entity_changes; |  | ||||||
|  |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM api_tokens WHERE apiTokenId = entityId), '') WHERE entityName = 'api_tokens'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM attributes WHERE attributeId = entityId), '') WHERE entityName = 'attributes'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM branches WHERE branchId = entityId), '') WHERE entityName = 'branches'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM notes WHERE noteId = entityId), '') WHERE entityName = 'notes'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM note_contents WHERE noteId = entityId), '') WHERE entityName = 'note_contents'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM note_revisions WHERE noteRevisionId = entityId), '') WHERE entityName = 'note_revisions'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM note_revision_contents WHERE noteRevisionId = entityId), '') WHERE entityName = 'note_revision_contents'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM options WHERE name = entityId), '') WHERE entityName = 'options'; |  | ||||||
| UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM recent_notes WHERE noteId = entityId), '') WHERE entityName = 'recent_notes'; |  | ||||||
|  |  | ||||||
| DROP TABLE entity_changes; |  | ||||||
| ALTER TABLE mig_entity_changes RENAME TO entity_changes; |  | ||||||
|  |  | ||||||
| CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" ( |  | ||||||
|                                                                                  `entityName`, |  | ||||||
|                                                                                  `entityId` |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_api_tokens" |  | ||||||
| ( |  | ||||||
|     apiTokenId TEXT PRIMARY KEY NOT NULL, |  | ||||||
|     token TEXT NOT NULL, |  | ||||||
|     utcDateCreated TEXT NOT NULL, |  | ||||||
|     isDeleted INT NOT NULL DEFAULT 0); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_api_tokens (apiTokenId, token, utcDateCreated, isDeleted) |  | ||||||
| SELECT apiTokenId, token, utcDateCreated, isDeleted FROM api_tokens; |  | ||||||
|  |  | ||||||
| DROP TABLE api_tokens; |  | ||||||
| ALTER TABLE mig_api_tokens RENAME TO api_tokens; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_attributes" |  | ||||||
| ( |  | ||||||
|     attributeId      TEXT not null primary key, |  | ||||||
|     noteId       TEXT not null, |  | ||||||
|     type         TEXT not null, |  | ||||||
|     name         TEXT not null, |  | ||||||
|     value        TEXT default '' not null, |  | ||||||
|     position     INT  default 0 not null, |  | ||||||
|     utcDateCreated  TEXT not null, |  | ||||||
|     utcDateModified TEXT not null, |  | ||||||
|     isDeleted    INT  not null, |  | ||||||
|     `deleteId`    TEXT DEFAULT NULL, |  | ||||||
|     isInheritable int DEFAULT 0 NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_attributes (attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, deleteId, isInheritable) |  | ||||||
| SELECT attributeId, noteId, type, name, value, position, utcDateCreated, utcDateModified, isDeleted, deleteId, isInheritable FROM attributes; |  | ||||||
|  |  | ||||||
| DROP TABLE attributes; |  | ||||||
| ALTER TABLE mig_attributes RENAME TO attributes; |  | ||||||
|  |  | ||||||
| CREATE INDEX IDX_attributes_name_value |  | ||||||
|     on attributes (name, value); |  | ||||||
| CREATE INDEX IDX_attributes_noteId_index |  | ||||||
|     on attributes (noteId); |  | ||||||
| CREATE INDEX IDX_attributes_value_index |  | ||||||
|     on attributes (value); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_branches" ( |  | ||||||
|                                           `branchId`	TEXT NOT NULL, |  | ||||||
|                                           `noteId`	TEXT NOT NULL, |  | ||||||
|                                           `parentNoteId`	TEXT NOT NULL, |  | ||||||
|                                           `notePosition`	INTEGER NOT NULL, |  | ||||||
|                                           `prefix`	TEXT, |  | ||||||
|                                           `isExpanded`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                           `isDeleted`	INTEGER NOT NULL DEFAULT 0, |  | ||||||
|                                           `deleteId`    TEXT DEFAULT NULL, |  | ||||||
|                                           `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                           utcDateCreated TEXT NOT NULL, |  | ||||||
|                                           PRIMARY KEY(`branchId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_branches (branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, deleteId, utcDateModified, utcDateCreated) |  | ||||||
| SELECT branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, deleteId, utcDateModified, utcDateCreated FROM branches; |  | ||||||
|  |  | ||||||
| DROP TABLE branches; |  | ||||||
| ALTER TABLE mig_branches RENAME TO branches; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_branches_noteId_parentNoteId` ON `branches` (`noteId`,`parentNoteId`); |  | ||||||
| CREATE INDEX IDX_branches_parentNoteId ON branches (parentNoteId); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_notes" ( |  | ||||||
|                                        `noteId`	TEXT NOT NULL, |  | ||||||
|                                        `title`	TEXT NOT NULL DEFAULT "note", |  | ||||||
|                                        `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `type` TEXT NOT NULL DEFAULT 'text', |  | ||||||
|                                        `mime` TEXT NOT NULL DEFAULT 'text/html', |  | ||||||
|                                        `isDeleted`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                        `deleteId`   TEXT DEFAULT NULL, |  | ||||||
|                                        `dateCreated`	TEXT NOT NULL, |  | ||||||
|                                        `dateModified`	TEXT NOT NULL, |  | ||||||
|                                        `utcDateCreated`	TEXT NOT NULL, |  | ||||||
|                                        `utcDateModified`	TEXT NOT NULL, |  | ||||||
|                                        PRIMARY KEY(`noteId`)); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_notes (noteId, title, isProtected, type, mime, isDeleted, deleteId, dateCreated, dateModified, utcDateCreated, utcDateModified) |  | ||||||
| SELECT noteId, title, isProtected, type, mime, isDeleted, deleteId, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes; |  | ||||||
|  |  | ||||||
| DROP TABLE notes; |  | ||||||
| ALTER TABLE mig_notes RENAME TO notes; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`); |  | ||||||
| CREATE INDEX `IDX_notes_title` ON `notes` (`title`); |  | ||||||
| CREATE INDEX `IDX_notes_type` ON `notes` (`type`); |  | ||||||
| CREATE INDEX `IDX_notes_dateCreated` ON `notes` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_notes_dateModified` ON `notes` (`dateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateModified` ON `notes` (`utcDateModified`); |  | ||||||
| CREATE INDEX `IDX_notes_utcDateCreated` ON `notes` (`utcDateCreated`); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_note_contents" ( |  | ||||||
|                                                `noteId`	TEXT NOT NULL, |  | ||||||
|                                                `content`	TEXT NULL DEFAULT NULL, |  | ||||||
|                                                `dateModified` TEXT NOT NULL, |  | ||||||
|                                                `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                                PRIMARY KEY(`noteId`) |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_note_contents (noteId, content, dateModified, utcDateModified) |  | ||||||
| SELECT noteId, content, dateModified, utcDateModified FROM note_contents; |  | ||||||
|  |  | ||||||
| DROP TABLE note_contents; |  | ||||||
| ALTER TABLE mig_note_contents RENAME TO note_contents; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_note_revisions" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                              `noteId`	TEXT NOT NULL, |  | ||||||
|                                              type TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                              mime TEXT DEFAULT '' NOT NULL, |  | ||||||
|                                              `title`	TEXT, |  | ||||||
|                                              `isProtected`	INT NOT NULL DEFAULT 0, |  | ||||||
|                                              `utcDateLastEdited` TEXT NOT NULL, |  | ||||||
|                                              `utcDateCreated` TEXT NOT NULL, |  | ||||||
|                                              `utcDateModified` TEXT NOT NULL, |  | ||||||
|                                              `dateLastEdited` TEXT NOT NULL, |  | ||||||
|                                              `dateCreated` TEXT NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_note_revisions (noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated) |  | ||||||
| SELECT noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated FROM note_revisions; |  | ||||||
|  |  | ||||||
| DROP TABLE note_revisions; |  | ||||||
| ALTER TABLE mig_note_revisions RENAME TO note_revisions; |  | ||||||
|  |  | ||||||
| CREATE INDEX `IDX_note_revisions_noteId` ON `note_revisions` (`noteId`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); |  | ||||||
| CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_note_revision_contents" (`noteRevisionId`	TEXT NOT NULL PRIMARY KEY, |  | ||||||
|                                                      `content`	TEXT, |  | ||||||
|                                                      `utcDateModified` TEXT NOT NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_note_revision_contents (noteRevisionId, content, utcDateModified) |  | ||||||
| SELECT noteRevisionId, content, utcDateModified FROM note_revision_contents; |  | ||||||
|  |  | ||||||
| DROP TABLE note_revision_contents; |  | ||||||
| ALTER TABLE mig_note_revision_contents RENAME TO note_revision_contents; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_options" |  | ||||||
| ( |  | ||||||
|     name TEXT not null PRIMARY KEY, |  | ||||||
|     value TEXT, |  | ||||||
|     isSynced INTEGER default 0 not null, |  | ||||||
|     utcDateCreated TEXT not null, |  | ||||||
|     utcDateModified TEXT NOT NULL |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_options (name, value, isSynced, utcDateCreated, utcDateModified) |  | ||||||
| SELECT name, value, isSynced, utcDateCreated, utcDateModified FROM options; |  | ||||||
|  |  | ||||||
| DROP TABLE options; |  | ||||||
| ALTER TABLE mig_options RENAME TO options; |  | ||||||
|  |  | ||||||
| CREATE TABLE mig_recent_notes |  | ||||||
| ( |  | ||||||
|     noteId TEXT not null primary key, |  | ||||||
|     notePath TEXT not null, |  | ||||||
|     utcDateCreated TEXT not null, |  | ||||||
|     isDeleted INT NOT NULL DEFAULT 0 |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_recent_notes (noteId, notePath, utcDateCreated, isDeleted) |  | ||||||
| SELECT noteId, notePath, utcDateCreated, isDeleted FROM recent_notes; |  | ||||||
|  |  | ||||||
| DROP TABLE recent_notes; |  | ||||||
| ALTER TABLE mig_recent_notes RENAME TO recent_notes; |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| UPDATE options SET name = 'eraseEntitiesAfterTimeInSeconds' WHERE name = 'eraseNotesAfterTimeInSeconds'; |  | ||||||
| UPDATE entity_changes SET entityId = 'eraseEntitiesAfterTimeInSeconds' WHERE entityName = 'options' AND entityId = 'eraseNotesAfterTimeInSeconds'; |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| CREATE TABLE IF NOT EXISTS "mig_attributes" |  | ||||||
| ( |  | ||||||
|     attributeId      TEXT not null primary key, |  | ||||||
|     noteId       TEXT not null, |  | ||||||
|     type         TEXT not null, |  | ||||||
|     name         TEXT not null, |  | ||||||
|     value        TEXT default '' not null, |  | ||||||
|     position     INT  default 0 not null, |  | ||||||
|     utcDateModified TEXT not null, |  | ||||||
|     isDeleted    INT  not null, |  | ||||||
|     `deleteId`    TEXT DEFAULT NULL, |  | ||||||
|     isInheritable int DEFAULT 0 NULL); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_attributes (attributeId, noteId, type, name, value, position, utcDateModified, isDeleted, deleteId, isInheritable) |  | ||||||
| SELECT attributeId, noteId, type, name, value, position, utcDateModified, isDeleted, deleteId, isInheritable FROM attributes; |  | ||||||
|  |  | ||||||
| DROP TABLE attributes; |  | ||||||
| ALTER TABLE mig_attributes RENAME TO attributes; |  | ||||||
|  |  | ||||||
| CREATE INDEX IDX_attributes_name_value |  | ||||||
|     on attributes (name, value); |  | ||||||
| CREATE INDEX IDX_attributes_noteId_index |  | ||||||
|     on attributes (noteId); |  | ||||||
| CREATE INDEX IDX_attributes_value_index |  | ||||||
|     on attributes (value); |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| DELETE FROM options WHERE name = 'keyboardShortcutsCreateNoteIntoInbox'; -- in case there is already one which shouldn't (except for in-dev documents) |  | ||||||
| UPDATE options SET name = 'keyboardShortcutsCreateNoteIntoInbox' WHERE name = 'keyboardShortcutsCreateNoteIntoDayNote'; |  | ||||||
|  |  | ||||||
| DELETE FROM options WHERE name = 'keyboardShortcutsShowAttributes'; |  | ||||||
| DELETE FROM entity_changes WHERE entityName = 'options' AND entityId = 'keyboardShortcutsShowAttributes'; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| DROP INDEX IDX_notes_isDeleted; |  | ||||||
| @@ -1 +0,0 @@ | |||||||
| VACUUM |  | ||||||
| @@ -1,2 +0,0 @@ | |||||||
| UPDATE options SET name = 'keyboardShortcutsQuickSearch' WHERE name = 'keyboardShortcutsSearchNotes'; |  | ||||||
| UPDATE entity_changes SET entityId = 'keyboardShortcutsQuickSearch' WHERE entityId = 'keyboardShortcutsSearchNotes' AND entityName = 'options'; |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| UPDATE entity_changes SET isSynced = COALESCE(( |  | ||||||
|     SELECT options.isSynced |  | ||||||
|     FROM options |  | ||||||
|     WHERE options.name = entity_changes.entityId |  | ||||||
| ), 0) WHERE entityName = 'options'; |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| DELETE FROM entity_changes WHERE entityName = 'recent_notes'; |  | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_recent_notes" |  | ||||||
| ( |  | ||||||
|     noteId TEXT not null primary key, |  | ||||||
|     notePath TEXT not null, |  | ||||||
|     utcDateCreated TEXT not null |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| INSERT INTO mig_recent_notes (noteId, notePath, utcDateCreated) |  | ||||||
|     SELECT noteId, notePath, utcDateCreated FROM recent_notes; |  | ||||||
|  |  | ||||||
| DROP TABLE recent_notes; |  | ||||||
| ALTER TABLE mig_recent_notes RENAME TO recent_notes; |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| const repository = require('../../src/services/repository'); |  | ||||||
|  |  | ||||||
| module.exports = () => { |  | ||||||
|     for (const note of repository.getEntities("SELECT * FROM notes WHERE type = 'search' AND isProtected = 0 AND isDeleted = 0")) { |  | ||||||
|         try { |  | ||||||
|             let origContent = note.getJsonContent(); |  | ||||||
|  |  | ||||||
|             if (!origContent) { |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             note.addLabel('searchString', origContent.searchString); |  | ||||||
|  |  | ||||||
|             note.setContent(''); |  | ||||||
|  |  | ||||||
|             note.mime = 'text/plain'; |  | ||||||
|             note.save(); |  | ||||||
|  |  | ||||||
|             console.log(`Migrated search note ${note.noteId}`); |  | ||||||
|         } |  | ||||||
|         catch (e) { |  | ||||||
|             console.log(`Changing note content for note ${note.noteId} failed with: ${e.message} ${e.stack}`); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| }; |  | ||||||
							
								
								
									
										1
									
								
								db/migrations/0184__NOOP.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0184__NOOP.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | module.exports = () => console.log("NOOP, moved to migration 0189"); | ||||||
							
								
								
									
										4
									
								
								db/migrations/0185__migrate_black_theme_to_dark.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								db/migrations/0185__migrate_black_theme_to_dark.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | -- black theme has been removed, dark is closest replacement | ||||||
|  | UPDATE options SET value = 'dark' WHERE name = 'theme' AND value = 'black'; | ||||||
|  |  | ||||||
|  | UPDATE options SET value = 'light' WHERE name = 'theme' AND value = 'white'; | ||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | ALTER TABLE branches DROP COLUMN utcDateCreated; | ||||||
|  | ALTER TABLE options DROP COLUMN utcDateCreated; | ||||||
							
								
								
									
										33
									
								
								db/migrations/0187__add_changeId_to_entity_changes.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								db/migrations/0187__add_changeId_to_entity_changes.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( | ||||||
|  |                                                 `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||||||
|  |                                                 `entityName`	TEXT NOT NULL, | ||||||
|  |                                                 `entityId`	TEXT NOT NULL, | ||||||
|  |                                                 `hash`	TEXT NOT NULL, | ||||||
|  |                                                 `isErased` INT NOT NULL, | ||||||
|  |                                                 `changeId` TEXT NOT NULL, | ||||||
|  |                                                 `sourceId` TEXT NOT NULL, | ||||||
|  |                                                 `isSynced` INTEGER NOT NULL, | ||||||
|  |                                                 `utcDateChanged` TEXT NOT NULL | ||||||
|  | ); | ||||||
|  |  | ||||||
|  | INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) | ||||||
|  |     SELECT id, entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes; | ||||||
|  |  | ||||||
|  | -- delete duplicates https://github.com/zadam/trilium/issues/2534 | ||||||
|  | DELETE FROM mig_entity_changes WHERE isErased = 0 AND id IN ( | ||||||
|  |     SELECT id FROM mig_entity_changes ec | ||||||
|  |     WHERE ( | ||||||
|  |               SELECT COUNT(*) FROM mig_entity_changes | ||||||
|  |               WHERE ec.entityName = mig_entity_changes.entityName | ||||||
|  |                 AND ec.entityId = mig_entity_changes.entityId | ||||||
|  |           ) > 1 | ||||||
|  | ); | ||||||
|  |  | ||||||
|  | DROP TABLE entity_changes; | ||||||
|  |  | ||||||
|  | ALTER TABLE mig_entity_changes RENAME TO entity_changes; | ||||||
|  |  | ||||||
|  | CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" ( | ||||||
|  |                                                                                  `entityName`, | ||||||
|  |                                                                                  `entityId` | ||||||
|  |     ); | ||||||
							
								
								
									
										8
									
								
								db/migrations/0188__set_hidden_branchId.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								db/migrations/0188__set_hidden_branchId.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | UPDATE branches SET branchId = 'hidden' where branchId = ( | ||||||
|  |     SELECT branchId FROM branches | ||||||
|  |     WHERE parentNoteId = 'root' | ||||||
|  |       AND noteId = 'hidden' | ||||||
|  |       AND isDeleted = 0 | ||||||
|  |     ORDER BY utcDateModified | ||||||
|  |     LIMIT 1 | ||||||
|  | ); | ||||||
							
								
								
									
										15
									
								
								db/migrations/0189__add_excludeFromNoteMap_to_journal.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								db/migrations/0189__add_excludeFromNoteMap_to_journal.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | const becca = require('../../src/becca/becca'); | ||||||
|  | const beccaLoader = require('../../src/becca/becca_loader'); | ||||||
|  | const cls = require('../../src/services/cls'); | ||||||
|  |  | ||||||
|  | module.exports = () => { | ||||||
|  |     cls.init(() => { | ||||||
|  |         beccaLoader.load(); | ||||||
|  |  | ||||||
|  |         for (const note of Object.values(becca.notes)) { | ||||||
|  |             if (note.hasLabel('calendarRoot')) { | ||||||
|  |                 note.addLabel('excludeFromNoteMap', "", true); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }; | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user