16 lines
370 B
MySQL
16 lines
370 B
MySQL
|
CREATE TABLE IF NOT EXISTS documents (
|
||
|
id TEXT PRIMARY KEY,
|
||
|
collection TEXT NOT NULL,
|
||
|
data TEXT,
|
||
|
created_at TIMESTAMP NOT NULL,
|
||
|
updated_at TIMESTAMP NOT NULL,
|
||
|
UNIQUE(id, collection) ON CONFLICT REPLACE
|
||
|
);
|
||
|
|
||
|
---
|
||
|
|
||
|
CREATE INDEX IF NOT EXISTS collection_idx ON documents (collection);
|
||
|
|
||
|
---
|
||
|
|
||
|
ALTER TABLE documents ADD COLUMN revision INTEGER DEFAULT 0;
|