Files
marqdo/tests/ext/web-db-w6-smoke.mq.md
T
cflmyandCursor abcb141737 refactor: prefer link-index get across examples and tests
Migrate remaining footnote-style collection access in examples,
public/structure, and ext/lib smokes to [key](base); teach link-index in
structure pages and use bracket calls in the cafe journal example.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 12:54:38 +08:00

1.9 KiB


title: web db W6 smoke — migrate / FTS5 / published filter import web:ext/web/web.mq.md

main

store = > web.db url="sqlite:web-fixtures/data/w6-smoke.db"

steps =

版本 SQL
1 CREATE TABLE IF NOT EXISTS posts (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, body TEXT, status TEXT NOT NULL DEFAULT 'draft')
2 CREATE TABLE IF NOT EXISTS comments (id INTEGER PRIMARY KEY AUTOINCREMENT, post_id INTEGER NOT NULL, body TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'pending')

m1 = > store.migrate steps=steps a1 = applied n1 = > len value=a1

  1. n1 == 2

print text=migrate-ok

print text=migrate-fail

m2 = > store.migrate steps=steps a2 = applied n2 = > len value=a2

  1. n2 == 0

print text=migrate-idempotent-ok

print text=migrate-idempotent-fail

rows =

title body status
Alpha note hello world search published
Beta draft secret draft body draft
Gamma published another hello published

store.insert table=posts rows=rows

pub =

字段 操作 值
status = published

pc = > store.count table="posts" where=pub

  1. pc == 2

print text=published-filter-ok

print text=published-filter-fail

comments =

post_id body status
1 nice post approved
1 spam pending

store.insert table=comments rows=comments cc = > store.count table="comments"

  1. cc == 2

print text=comments-ok

print text=comments-fail

store.fts table="posts" columns="title,body" hit = > store.search table="posts" q="hello" limit=10 hn = count

  1. hn >= 1

print text=fts-ok

print text=fts-fail

rows2 = rows first = 1 ft = title

  1. ft

print text=fts-row-ok

print text=fts-row-fail