-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
chromadb/migrations/sysdb/00004-tenants-databases.sqlite.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE tenants ( | ||
id TEXT PRIMARY KEY, | ||
name TEXT NOT NULL, | ||
UNIQUE (name) | ||
); | ||
|
||
CREATE TABLE databases ( | ||
id TEXT PRIMARY KEY, | ||
name TEXT NOT NULL, | ||
tenant_id TEXT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, | ||
UNIQUE (name) | ||
); | ||
|
||
ALTER TABLE collections | ||
ADD COLUMN database_id TEXT NOT NULL REFERENCES databases(id); -- ON DELETE CASCADE not supported by sqlite in ALTER TABLE | ||
|
||
-- Create default tenant and database | ||
INSERT INTO tenants (id, name) VALUES ('default', 'default'); | ||
INSERT INTO databases (id, name, tenant_id) VALUES ('default', 'default', 'default'); |