SQL schema string creates all tables for a worker-room-entity system, ready to run idempotently.
// Source: https://github.com/quoroom-ai/room | License: MIT | Copyright 2026 Quoroom
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Database schema — creates all tables idempotently.
* Uses CREATE TABLE IF NOT EXISTS so it's safe to run on any database.
*
* IMPORTANT: Table order matters because PRAGMA foreign_keys = ON.
* Tables must be created before any table that REFERENCES them.
* Order: settings → workers → rooms → entities → everything else
*/
export const SCHEMA = `
PRAGMA journal_mode = WAL;
PRAGMA foreign_keys = ON;
-- Settings (no dependencies)
CREATE TABLE IF NOT EXISTS settings (
key TEXT PRIMARY KEY,
value TEXT,
updated_at DATETIME DEFAULT (datetime('now','localtime'))
);
-- Workers (no FK dependencies)
CREATE TABLE IF NOT EXISTS
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key