migrations/001_schema.sql (excerpt)
CREATE TABLE books (
id INTEGER PRIMARY KEY,
slug TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
author_id INTEGER NOT NULL REFERENCES authors(id),
year INTEGER NOT NULL,
genre TEXT NOT NULL,
available INTEGER NOT NULL DEFAULT 1,
summary TEXT NOT NULL
);
migrations/002_library.sql (first lines)
INSERT INTO books (slug, title, author_id, year, genre, available, summary) VALUES
('pride-and-prejudice', 'Pride and Prejudice', 1, 1813, 'novel', 1, 'Five sisters, one estate and a first impression that turns out to be wrong.'),
('emma', 'Emma', 1, 1815, 'novel', 0, 'A young woman arranges everyone''s marriages except, for a long time, her own.'),
('persuasion', 'Persuasion', 1, 1817, 'novel', 1, 'A broken engagement, eight years later, in Bath.'),
content/alcoves/demo_books/alcove.yaml
query: |
SELECT b.title, a.name AS author, b.year, b.genre
FROM books b
JOIN authors a ON a.id = b.author_id
ORDER BY b.year
content/alcoves/demo_books/blueprint.html
<table class="books">
<thead><tr><th>Title</th><th>Author</th><th>Year</th><th>Genre</th></tr></thead>
<tbody>{{ tiles }}</tbody>
</table>
content/alcoves/demo_books/tile.html
<tr><td>{{ title }}</td><td>{{ author }}</td><td>{{ year }}</td><td>{{ genre }}</td></tr>