@@ 9,7 9,7 @@ CREATE TABLE Client (
id INTEGER PRIMARY KEY,
client_id TEXT NOT NULL UNIQUE,
client_secret_hash BLOB,
- owner INTEGER REFERENCES User(id),
+ owner INTEGER REFERENCES User(id) ON DELETE CASCADE,
redirect_uris TEXT,
client_name TEXT,
client_uri TEXT
@@ 18,8 18,8 @@ CREATE TABLE Client (
CREATE TABLE AccessToken (
id INTEGER PRIMARY KEY,
hash BLOB NOT NULL UNIQUE,
- user INTEGER NOT NULL REFERENCES User(id),
- client INTEGER REFERENCES Client(id),
+ user INTEGER NOT NULL REFERENCES User(id) ON DELETE CASCADE,
+ client INTEGER REFERENCES Client(id) ON DELETE CASCADE,
scope TEXT,
issued_at datetime NOT NULL,
expires_at datetime NOT NULL,
@@ 31,8 31,8 @@ CREATE TABLE AuthCode (
id INTEGER PRIMARY KEY,
hash BLOB NOT NULL UNIQUE,
created_at datetime NOT NULL,
- user INTEGER NOT NULL REFERENCES User(id),
- client INTEGER NOT NULL REFERENCES Client(id),
+ user INTEGER NOT NULL REFERENCES User(id) ON DELETE CASCADE,
+ client INTEGER NOT NULL REFERENCES Client(id) ON DELETE CASCADE,
redirect_uri TEXT,
scope TEXT
);