-- Schema de base de données pour ObsiViewer
-- Ce fichier est utilisé pour la compatibilité Docker

CREATE TABLE IF NOT EXISTS notes (
  id TEXT PRIMARY KEY,
  title TEXT NOT NULL,
  content TEXT,
  tags TEXT, -- JSON array
  frontmatter TEXT, -- JSON object
  created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
  updated_at INTEGER DEFAULT (strftime('%s', 'now') * 1000)
);

CREATE TABLE IF NOT EXISTS settings (
  key TEXT PRIMARY KEY,
  value TEXT
);

-- Insert some demo data if table is empty
INSERT OR IGNORE INTO notes (id, title, content, tags)
VALUES (
  'welcome',
  'Welcome to Your Second Brain',
  '# Welcome to Your Second Brain

This is a demo of an Obsidian-like note-taking app built with Angular.

## Features

- Markdown rendering
- [[features/internal-links|Internal Links]]
- [[features/graph-view|Graph View]]
- Tagging
- File explorer

Check out the other notes to see how things work.',
  '["getting-started", "welcome"]'
);
