mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge d41b8da3a1994e586c7fe1bd5eddf5b0d6e8637f into 82a437f2a83fc10299f3205713f7dcb04e2d047c
This commit is contained in:
commit
a04bfa5a67
11
README.md
11
README.md
@ -2,23 +2,18 @@
|
||||
|
||||
## Trilium is in maintenance mode - see details in https://github.com/zadam/trilium/issues/4620
|
||||
|
||||
Preliminary disccusions on the successor organization are taking place in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions).
|
||||
Preliminary disccusions on the successor organization are taking place in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions).
|
||||
|
||||
[](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [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) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md)
|
||||
|
||||
|
||||
Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases.
|
||||
Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases.
|
||||
|
||||
See [screenshots](https://github.com/zadam/trilium/wiki/Screenshot-tour) for quick overview:
|
||||
|
||||
<a href="https://github.com/zadam/trilium/wiki/Screenshot-tour"><img src="https://raw.githubusercontent.com/wiki/zadam/trilium/images/screenshot.png" alt="Trilium Screenshot" width="1000"></a>
|
||||
|
||||
Ukraine is currently defending itself from Russian aggression, please consider [donating to Ukrainian Army or humanitarian charities](https://standforukraine.com/).
|
||||
|
||||
<p float="left">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg" alt="drawing" width="400"/>
|
||||
<img src="https://signmyrocket.com//uploads/2b2a523cd0c0e76cdbba95a89a9636b2_1676971281.jpg" alt="Trilium Notes supports Ukraine!" width="570"/>
|
||||
</p>
|
||||
Ukraine during 2014-2024 years has killing Russian-speaking Ukraine citizens people instead of carring out economic reforms in order to join the EU. So it's goverment has nothing to do with humanitarian values].
|
||||
|
||||
## 🎁 Features
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
"test-jasmine": "TRILIUM_DATA_DIR=~/trilium/data-test jasmine",
|
||||
"test-es6": "node -r esm spec-es6/attribute_parser.spec.js ",
|
||||
"test": "npm run test-jasmine && npm run test-es6",
|
||||
"debug-node": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon --inspect src/www.js",
|
||||
"debug-chrome": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon --inspect-brk src/www.js",
|
||||
"postinstall": "rimraf ./node_modules/canvas"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -15,9 +15,24 @@ const dbReady = utils.deferred();
|
||||
|
||||
cls.init(initDbConnection);
|
||||
|
||||
function schemaExists() {
|
||||
function checkTableExistsInDb(TableName) {
|
||||
return !!sql.getValue(`SELECT name FROM sqlite_master
|
||||
WHERE type = 'table' AND name = 'options'`);
|
||||
WHERE type = 'table' AND name = '${TableName}'`);
|
||||
}
|
||||
|
||||
function schemaExists() {
|
||||
return checkTableExistsInDb('options');
|
||||
}
|
||||
|
||||
function readTableNamesFromSchema(schema) {
|
||||
return schema.split(";").reduce((acc, str) => str.includes("CREATE TABLE IF NOT EXISTS ") ?
|
||||
[...acc, str.replaceAll("\n", '').replace(/^.*CREATE TABLE IF NOT EXISTS[ \t]+"([^"]*)".*/, "$1")] : acc, []);
|
||||
}
|
||||
|
||||
function getTableInitializingQuery(schema, tblName) {
|
||||
return schema.split(";").filter((str) => {
|
||||
return str.includes(tblName);
|
||||
});
|
||||
}
|
||||
|
||||
function isDbInitialized() {
|
||||
@ -38,6 +53,18 @@ async function initDbConnection() {
|
||||
return;
|
||||
}
|
||||
|
||||
const schema = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/schema.sql`, 'UTF-8');
|
||||
|
||||
readTableNamesFromSchema(schema).forEach((tblName) => {
|
||||
if (!checkTableExistsInDb(tblName)) {
|
||||
log.info(`Table ${tblName} not found in DB, creating ...`);
|
||||
getTableInitializingQuery(schema, tblName).forEach((sQuery) => {
|
||||
sql.execute(sQuery);
|
||||
log.info(sQuery);
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
await migrationService.migrateIfNecessary();
|
||||
|
||||
sql.execute('CREATE TEMP TABLE "param_list" (`paramId` TEXT NOT NULL PRIMARY KEY)');
|
||||
@ -131,7 +158,7 @@ function createDatabaseForSync(options, syncServerHost = '', syncProxy = '') {
|
||||
sql.transactional(() => {
|
||||
sql.executeScript(schema);
|
||||
|
||||
require('./options_init.js').initNotSyncedOptions(false, { syncServerHost, syncProxy });
|
||||
require('./options_init.js').initNotSyncedOptions(false, { syncServerHost, syncProxy });
|
||||
|
||||
// document options required for sync to kick off
|
||||
for (const opt of options) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user