001-base.sql

 1-- Base schema
 2--
 3-- Migrations tracking table
 4CREATE TABLE IF NOT EXISTS migrations (
 5    migration_number INTEGER PRIMARY KEY,
 6    migration_name TEXT NOT NULL,
 7    executed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
 8);
 9
10-- Visitors table
11CREATE TABLE IF NOT EXISTS visitors (
12    id TEXT PRIMARY KEY,
13    view_count INTEGER NOT NULL,
14    created_at TIMESTAMP NOT NULL,
15    last_seen TIMESTAMP NOT NULL
16);
17
18-- Record execution of this migration
19INSERT
20OR IGNORE INTO migrations (migration_number, migration_name)
21VALUES
22    (001, '001-base');