Skip to content
migrating-to-db logo

Migrating to Logseq DB

migrating-to-db

Expert guidance for migrating Logseq graphs from Markdown (MD) format to the new Database (DB) format. Auto-invokes when users ask about MD to DB migration, converting graphs, import options, data transformation, or compatibility between Logseq versions. Covers migration strategies, common issues...

SKILL.md

Full skill instructions

Migrating to Logseq DB

When to Use This Skill

This skill auto-invokes when:

  • User asks about migrating from Logseq MD to DB version
  • Converting markdown graphs to database format
  • Import/​export between Logseq versions
  • Questions about what transfers during migration
  • Namespace handling during migration
  • Tag-to-class conversion decisions
  • Property type inference during import
  • User mentions "migrate", "convert", "MD to DB", "markdown to database"

You are an expert in migrating Logseq graphs from MD (Markdown) format to DB (Database) format.

Migration Overview

Why Migrate?

FeatureMD VersionDB Version
StorageMarkdown filesSQLite database
TagsPage referencesClasses with properties
PropertiesText stringsTyped values
QueriesLimitedFull Datalog
SyncFile-basedReal-time (subscription)
PerformanceFile I/​O dependentOptimized queries

Current Status (2024-2025)

Important: Logseq DB is still in alpha. Consider:

  • Data loss risk exists
  • Some features not yet available (whiteboards)
  • Plugin compatibility varies
  • Requires subscription for sync

Pre-Migration Checklist

Before migrating, assess your graph:

1. Backup Everything

# Create timestamped backup
cp -r ~/​logseq/​my-graph ~/​logseq/​my-graph-backup-$(date +%Y%m%d)

# Or compress
tar -czvf my-graph-backup.tar.gz ~/​logseq/​my-graph

2. Audit Current Structure

Pages to review:

  • Namespaced pages (a/​b/​c) → May become separate pages
  • Pages with same name, different namespaces
  • Template pages
  • Query pages

Properties to review:

  • Property formats (key:: value)
  • Multi-value properties
  • Date properties
  • Linked properties ([[page]])

Tags to review:

  • Simple tags (#tag)
  • Page tags ([[tag]])
  • Nested tags (#parent/​child)

3. Identify Migration Decisions

MD PatternDB OptionsDecision Needed
#tagClass or page refWhich tags become classes?
[[page]]Node referenceKeep as reference
property:: valueTyped propertyWhat type?
namespace/​pageSeparate page or hierarchyFlatten or nest?

Migration Process

Step 1: Export from MD Version

  1. Open your MD graph in Logseq
  2. Go to Settings → Export
  3. Choose Export to EDN (for full data)
  4. Save the export file

Step 2: Prepare Import Settings

When importing to DB, you'll choose:

Tag Handling:

  • Convert to classes: Tags become proper classes with inherited properties
  • Keep as references: Tags remain simple page links

Namespace Handling:

  • Flatten: a/​b/​c → single page "a/​b/​c"
  • Hierarchical: Creates page hierarchy

Property Handling:

  • Infer types: Logseq guesses types (number, date, etc.)
  • All as text: Everything stays as strings

Step 3: Create New DB Graph

  1. Create new DB-based graph in Logseq
  2. Use Import feature
  3. Select your exported data
  4. Configure migration options
  5. Review and confirm

Step 4: Post-Migration Validation

;; Check page count matches
[:find (count ?p)
 :where [?p :block/​tags ?t]
        [?t :db/​ident :logseq.class/​Page]]

;; Check for orphaned blocks
[:find (pull ?b [:block/​title])
 :where [?b :block/​title _]
        (not [?b :block/​page _])
        (not [?b :block/​tags ?t]
             [?t :db/​ident :logseq.class/​Page])]

;; Verify properties migrated
[:find ?prop-name (count ?b)
 :where [?b ?prop _]
        [?p :db/​ident ?prop]
        [?p :block/​title ?prop-name]
        [(clojure.string/​starts-with? (str ?prop) ":user.property")]]

Common Migration Issues

Issue 1: Lost Property Types

Symptom: Numbers/​dates stored as strings

Solution: Manually update property types

;; In DB, update property type
{:db/​ident :user.property/​rating
 :logseq.property/​type :number}  ; was :default

Issue 2: Tag/​Class Confusion

Symptom: Tags didn't become proper classes

Solution: Convert pages to classes

  1. Open the tag page
  2. Add #Tag to make it a class
  3. Define properties on the class

Issue 3: Broken References

Symptom: [[page]] links not working

Cause: Page names changed during migration

Solution: Use find/​replace or query to identify broken refs

[:find ?ref-text
 :where
 [?b :block/​title ?title]
 [(re-find #"\[\[.*?\]\]" ?title) ?ref-text]
 (not [_ :block/​title ?ref-text])]

Issue 4: Namespace Flattening

Symptom: project/​tasks and project/​notes merged

Solution: Pre-migration, rename pages to avoid conflicts

Issue 5: Query Compatibility

Symptom: Old queries don't work

Reason: Different attribute names

MD AttributeDB Attribute
:block/​content:block/​title
:block/​name:block/​title
:page/​tags:block/​tags

Migration Strategies

Strategy 1: Big Bang Migration

  • Migrate entire graph at once
  • Best for: Small graphs, simple structure
  • Risk: All-or-nothing

Strategy 2: Parallel Operation

  • Keep MD graph active
  • Create DB graph for new content
  • Gradually move old content
  • Best for: Large graphs, active use

Strategy 3: Selective Migration

  • Export specific pages/​areas
  • Import into new DB graph
  • Best for: Messy graphs needing cleanup

Best Practices

Before Migration

  1. Clean up your graph

    • Remove unused pages
    • Standardize property names
    • Fix broken links
  2. Document your structure

    • List all tags and their purposes
    • Document property meanings
    • Map namespaces
  3. Plan your classes

    • Which tags become classes?
    • What properties do they need?
    • Define inheritance hierarchy

During Migration

  1. Start small - Test with a subset
  2. Compare counts - Pages, blocks, properties
  3. Check critical pages - Most important content first
  4. Verify queries - Update and test all queries

After Migration

  1. Don't delete MD graph - Keep as backup
  2. Monitor for issues - Note problems for feedback
  3. Update workflows - Adapt to new features
  4. Explore new capabilities - Classes, typed properties

Feature Comparison

Available in DB Version

  • ✅ Typed properties (number, date, checkbox)
  • ✅ Class inheritance
  • ✅ Property schemas
  • ✅ Full Datalog queries
  • ✅ Real-time collaboration (Pro)
  • ✅ Library view

Not Yet Available (Alpha)

  • ⏳ Whiteboards
  • ⏳ Some plugins
  • ⏳ Full export options
  • ⏳ Advanced templates

Different Behavior

  • 📝 Tags = Classes (more powerful but different)
  • 📝 Sync requires subscription
  • 📝 File access limited (SQLite, not .md)

Resources

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View