SeleBase
Migrations, import and export
Overview · SQL console · Limits · Migrations · Errors · Examples
Run each migration as its own request with a migrate or admin key. Make migrations safe to repeat:
sql
CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, body TEXT NOT NULL);
-- send as separate requests:
CREATE INDEX IF NOT EXISTS notes_body ON notes (body);
ALTER TABLE notes ADD COLUMN created_at TEXT;
Allowed schema statements: CREATE TABLE | INDEX | VIEW, ALTER TABLE, DROP TABLE | INDEX | VIEW.
Export
shell
curl -H "Authorization: Bearer $SELEBASE_KEY" https://<host>/v1/databases/main/export > main.sql
The dump contains tables, rows (as INSERT statements), then indexes and views. Reading rows counts against your monthly read allowance.
Import
shell
curl -X POST --data-binary @main.sql -H "Authorization: Bearer $SELEBASE_KEY" https://<host>/v1/databases/other/import
Every statement is checked against the same allow-list before anything runs, so a dump with a blocked statement changes nothing. Statements then run one by one and count against your write allowance; an import is not atomic once it starts.