Collecting my attempts to improve at tech, art, and life

MarkdownDB

Does any of this enlighten, entertain, or otherwise please you? Please consider a Tip. Every little bit helps!

MarkdownDB

Looks like a product, but more of a proof of concept for feeding Markdown file metadata into a SQLite database.

https://markdowndb.com

Issues

Link detection misses links from folders. Say for example linking to this page from 2025-08-11.

https://github.com/datopian/markdowndb/issues/124

The MarkdownDB schema

Tables generated via stupid Nushell trick:

Code Sample
    (
 open markdown.db
 | schema
 | get tables
 | transpose name info
 | each { |t| $"### ($t.name)\n\n($t.col | to md)\n" }
 | to text
 | pbcopy
)
  

files

cid name type notnull default pk
0 _id varchar(255) 0 1
1 file_path varchar(255) 1 0
2 extension varchar(255) 1 0
3 url_path varchar(255) 0 0
4 filetype varchar(255) 0 0
5 metadata varchar(255) 0 0
6 tasks varchar(255) 0 0
Code Sample
    CREATE TABLE `files` (
	`_id`       varchar(255),
	`file_path` varchar(255) not null,
	`extension` varchar(255) not null,
	`url_path`  varchar(255),
	`filetype`  varchar(255),
	`metadata`  varchar(255),
	`tasks`     varchar(255),

	primary key (`_id`)
);

CREATE UNIQUE INDEX `files_file_path_unique` on `files` (`file_path`);
  

tasks

cid name type notnull default pk
0 description varchar(255) 1 0
1 checked boolean 1 0
2 file varchar(255) 1 0
3 due varchar(255) 0 0
4 completion varchar(255) 0 0
5 created varchar(255) 0 0
6 start varchar(255) 0 0
7 scheduled varchar(255) 0 0
8 metadata varchar(255) 0 0
Code Sample
    CREATE TABLE `tasks` (
	`description` varchar(255) not null,
	`checked`     boolean not null,
	`file`        varchar(255) not null,
	`due`         varchar(255),
	`completion`  varchar(255),
	`created`     varchar(255),
	`start`       varchar(255),
	`scheduled`   varchar(255),
	`metadata`    varchar(255)
);
  
cid name type notnull default pk
0 link_type TEXT 1 0
1 from varchar(255) 1 0
2 to varchar(255) 1 0
Code Sample
    CREATE TABLE `links` (
	`link_type` text
		check (`link_type` in ('normal', 'embed')) not null,
	`from`      varchar(255) not null,
	`to`        varchar(255) not null,
	
	foreign key(`from`)
		references `files`(`_id`) on delete CASCADE,
	foreign key(`to`)
		references `files`(`_id`) on delete CASCADE
);
  

tags

cid name type notnull default pk
0 name varchar(255) 0 1
Code Sample
    CREATE TABLE `tags` (
	`name` varchar(255),
	
	primary key (`name`)
);
  

file_tags

cid name type notnull default pk
0 tag varchar(255) 1 0
1 file varchar(255) 1 0
Code Sample
    
CREATE TABLE `file_tags` (
	`tag`  varchar(255) not null,
	`file` varchar(255) not null,
	
	foreign key(`tag`)
		references `tags`(`name`) on delete CASCADE,
	foreign key(`file`)
		references `files`(`_id`) on delete CASCADE
);