# migrations

dir: embeddings_queue
filename: 00001-embeddings.sqlite.sql
hash: d3755dfd232be8e8301f4d7fcfb3a486
sql:
CREATE TABLE embeddings_queue (
    seq_id INTEGER PRIMARY KEY,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    operation INTEGER NOT NULL,
    topic TEXT NOT NULL,
    id TEXT NOT NULL,
    vector BLOB,
    encoding TEXT,
    metadata TEXT
);


dir: sysdb
filename: 00001-collections.sqlite.sql
hash: 38352d725ad1c16074fac420b22b4633
sql:
CREATE TABLE collections (
    id TEXT PRIMARY KEY,
    name TEXT NOT NULL,
    topic TEXT NOT NULL,
    UNIQUE (name)
);

CREATE TABLE collection_metadata (
    collection_id TEXT REFERENCES collections(id) ON DELETE CASCADE,
    key TEXT NOT NULL,
    str_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (collection_id, key)
);


dir: sysdb
filename: 00002-segments.sqlite.sql
hash: 2913cb6a503055a95f625448037e8912
sql:
CREATE TABLE segments (
    id TEXT PRIMARY KEY,
    type TEXT NOT NULL,
    scope TEXT NOT NULL,
    topic TEXT,
    collection TEXT REFERENCES collection(id)
);

CREATE TABLE segment_metadata (
    segment_id TEXT  REFERENCES segments(id) ON DELETE CASCADE,
    key TEXT NOT NULL,
    str_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (segment_id, key)
);


dir: sysdb
filename: 00004-tenants-databases.sqlite.sql
hash: 048867ce8fcdefe4023c7110e4433591
sql:
CREATE TABLE IF NOT EXISTS tenants (
    id TEXT PRIMARY KEY,
    UNIQUE (id)
);

CREATE TABLE IF NOT EXISTS databases (
    id TEXT PRIMARY KEY, -- unique globally
    name TEXT NOT NULL, -- unique per tenant
    tenant_id TEXT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
    UNIQUE (tenant_id, name) -- Ensure that a tenant has only one database with a given name
);

CREATE TABLE IF NOT EXISTS collections_tmp (
    id TEXT PRIMARY KEY, -- unique globally
    name TEXT NOT NULL, -- unique per database
    topic TEXT NOT NULL,
    dimension INTEGER,
    database_id TEXT NOT NULL REFERENCES databases(id) ON DELETE CASCADE,
    UNIQUE (name, database_id)
);

-- Create default tenant and database
INSERT OR REPLACE INTO tenants (id) VALUES ('default_tenant'); -- The default tenant id is 'default_tenant' others are UUIDs
INSERT OR REPLACE INTO databases (id, name, tenant_id) VALUES ('00000000-0000-0000-0000-000000000000', 'default_database', 'default_tenant');

INSERT OR REPLACE INTO collections_tmp (id, name, topic, dimension, database_id)
    SELECT id, name, topic, dimension, '00000000-0000-0000-0000-000000000000' FROM collections;
DROP TABLE collections;
ALTER TABLE collections_tmp RENAME TO collections;


dir: sysdb
filename: 00005-remove-topic.sqlite.sql
hash: b1367c826b8fba5f96f27befdc1d42d2
sql:
-- Remove the topic column from the Collections and Segments tables

ALTER TABLE collections DROP COLUMN topic;
ALTER TABLE segments DROP COLUMN topic;


dir: metadb
filename: 00001-embedding-metadata.sqlite.sql
hash: 2b4cf52c4bb2676e21d6860a4409f856
sql:
CREATE TABLE embeddings (
    id INTEGER PRIMARY KEY,
    segment_id TEXT NOT NULL,
    embedding_id TEXT NOT NULL,
    seq_id BLOB NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE (segment_id, embedding_id)
);

CREATE TABLE embedding_metadata (
    id INTEGER REFERENCES embeddings(id),
    key TEXT NOT NULL,
    string_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (id, key)
);

CREATE TABLE max_seq_id (
    segment_id TEXT PRIMARY KEY,
    seq_id BLOB NOT NULL
);

CREATE VIRTUAL TABLE embedding_fulltext USING fts5(id, string_value);


dir: metadb
filename: 00002-embedding-metadata.sqlite.sql
hash: 12a570f7121b3a8ce750a2a7c36da20f
sql:
-- SQLite does not support adding check with alter table, as a result, adding a check
-- involve creating a new table and copying the data over. It is over kill with adding
-- a boolean type column. The application write to the table needs to ensure the data
-- integrity.
ALTER TABLE embedding_metadata ADD COLUMN bool_value INTEGER


dir: metadb
filename: 00003-full-text-tokenize.sqlite.sql
hash: f97ad6334aeaa8f419f01110b648b97a
sql:
CREATE VIRTUAL TABLE embedding_fulltext_search USING fts5(string_value, tokenize='trigram');
INSERT INTO embedding_fulltext_search (rowid, string_value) SELECT rowid, string_value FROM embedding_metadata;
DROP TABLE embedding_fulltext;


# embeddings_queue

created_at: 2024-05-04 07:01:44
topic: persistent://default/default/418c742e-79aa-49fd-ab3c-b45116382694
id: 4277913c-5fba-4cca-bac8-ac2d56bd70fc
encoding: FLOAT32
metadata:
{"source": "0-pl", "chroma:document": "Fina l Term  \nClass \u2013 4                                                                                                                                                 F.M. \u2013 50 m \nSection A \nOnce a woodcutter  climbed up a tree to cut wood. The tree  stood on the bank of a river. As he w as \ncutting the  wood, suddenly his axe fell into the river. He  tried  to get it back bu t faile d. He bega n to \nweep. A Goddess emerged from the r iver and asked him why he  was weeping. Th e woodcutter to ld \nher everyth ing. The Goddess dived into the r iver and brought out a golden axe. She asked the \nwoo dcutter, \u201cIs this your axe? Take it. \u201d The woodcutter said, \u201cNo, this axe is not mine. \u201d The G oddess \nagain dived , this time she a ppeared with a silver axe. The woodcutter again refused to accept the silver \none. The Goddess di ved once again and brought out an iron axe. The woodcutter recognised his axe"}


created_at: 2024-05-04 07:01:44
topic: persistent://default/default/418c742e-79aa-49fd-ab3c-b45116382694
id: 9c8ba7a3-9610-4009-a931-39bf85eec581
encoding: FLOAT32
metadata:
{"source": "1-pl", "chroma:document": "one. The Goddess di ved once again and brought out an iron axe. The woodcutter recognised his axe \nand took it. The Goddess was pleas ed w ith the woodcutter \u2019s honesty. She gave him  all the t hree axes \nas a reward.  \n1. Answer the following questions: (5 m) \na.  What happened to the woodcutter \u2019s axe?  (2) \nb. Which on e did the woodcutter accept ? (1)  \nc. Write the antonym of stand and f ailed . (2) \n \nSection B  (10m)  \nYou are the head bo y/ head girl of ABC Public School, Siliguri. Write a notice inviting the students to \nshowc ase the ir talents in the science exhibition.  \nOR \nWrite an app lication for remission of fine.  \nSection C  \nA. Fill in the blan ks with the correct form of the ten ses:     (5 x 2 = 10)  \n1. The porte r ____________________ ________  a heavy box. (c arry) (past continuous)  \n2. I ___________________ ________  all the books. (t ake) (present perfect)  \n3. I ___________________ ________  of a plan . (think) (s imple pas t)"}


created_at: 2024-05-04 07:01:44
topic: persistent://default/default/418c742e-79aa-49fd-ab3c-b45116382694
id: f1f933a4-8675-41b4-bc61-080464d1f97a
encoding: FLOAT32
metadata:
{"source": "2-pl", "chroma:document": "2. I ___________________ ________  all the books. (t ake) (present perfect)  \n3. I ___________________ ________  of a plan . (think) (s imple pas t) \n4. The stars _______________________ in the sky. (twinkle) (present co ntinuous)  \n5. I _________________________ the lett er. (write) (past perfect)  \n \nB. Underlin e the adjective and write its kind:           2 \n1. I stood  first in class.  \n2. I have bought some biscu it packet s. \n \nC. Fill in the blanks with p repositions :           3 \n1. Father opened the car __________________________ a screwd river.  \n2. I stay ________________________ Hyderabad.  \n3. Mohan is sitting ___________ ___________ Vikas and Rina.  \n \n Section D  (20 m)  \nA. Write the meanings:                              (2 x 2 = 4)  \n1. Gazed  \n2. Lurch  \n \nB. Answer  the following questions:                                                                                                        (9)"}


created_at: 2024-05-04 07:01:44
topic: persistent://default/default/418c742e-79aa-49fd-ab3c-b45116382694
id: 5c19ec52-a774-45dd-a47d-0ac8b844b4ca
encoding: FLOAT32
metadata:
{"source": "3-pl", "chroma:document": "1. Gazed  \n2. Lurch  \n \nB. Answer  the following questions:                                                                                                        (9) \n1. What do you think  \u201cThe oak smiled a knowing  smile\u201d mean?                                               (3) \n2. What do you think was written in th e note that Mrs. Sharma sent to Nandini \u2019s parents ? (2) \n3. What dis Guru Gamphor t ell them to do ne xt time?                                                               (2) \n4. Write the fi rst two lines of the poem \u2018Acro n and Oak \u2019                                                                            (2) \n \nC. Fill in the blanks:                                                                                                                                   (3) \n1. Guru Gamphor live d in ____________________________.  \n2. Nandini \u2019s father had an ____________________________ . \n3. Nandini was happy to get a pair of _________________________."}


created_at: 2024-05-04 07:01:44
topic: persistent://default/default/418c742e-79aa-49fd-ab3c-b45116382694
id: 0ec5ee02-29eb-4654-9ef8-66fdca883e83
encoding: FLOAT32
metadata:
{"source": "4-pl", "chroma:document": "1. Guru Gamphor live d in ____________________________.  \n2. Nandini \u2019s father had an ____________________________ . \n3. Nandini was happy to get a pair of _________________________.  \n \nD. Write True or False:                                                                                                                               (4) \n1. \u201cOh I\u2019ll never be bi g\u201d the old tree said \u2013  \n2. Nandini loved danc ing the most \u2013 \n3. Nandini \u2019s mo ther was relaxed \u2013  \n4. Guru Gramphor fell asleep in  the bu llock cart \u2013"}


# embedding_metadata

key: chroma:document
string_value:
Fina l Term  
Class – 4                                                                                                                                                 F.M. – 50 m 
Section A 
Once a woodcutter  climbed up a tree to cut wood. The tree  stood on the bank of a river. As he w as 
cutting the  wood, suddenly his axe fell into the river. He  tried  to get it back bu t faile d. He bega n to 
weep. A Goddess emerged from the r iver and asked him why he  was weeping. Th e woodcutter to ld 
her everyth ing. The Goddess dived into the r iver and brought out a golden axe. She asked the 
woo dcutter, “Is this your axe? Take it. ” The woodcutter said, “No, this axe is not mine. ” The G oddess 
again dived , this time she a ppeared with a silver axe. The woodcutter again refused to accept the silver 
one. The Goddess di ved once again and brought out an iron axe. The woodcutter recognised his axe


key: chroma:document
string_value:
one. The Goddess di ved once again and brought out an iron axe. The woodcutter recognised his axe 
and took it. The Goddess was pleas ed w ith the woodcutter ’s honesty. She gave him  all the t hree axes 
as a reward.  
1. Answer the following questions: (5 m) 
a.  What happened to the woodcutter ’s axe?  (2) 
b. Which on e did the woodcutter accept ? (1)  
c. Write the antonym of stand and f ailed . (2) 
 
Section B  (10m)  
You are the head bo y/ head girl of ABC Public School, Siliguri. Write a notice inviting the students to 
showc ase the ir talents in the science exhibition.  
OR 
Write an app lication for remission of fine.  
Section C  
A. Fill in the blan ks with the correct form of the ten ses:     (5 x 2 = 10)  
1. The porte r ____________________ ________  a heavy box. (c arry) (past continuous)  
2. I ___________________ ________  all the books. (t ake) (present perfect)  
3. I ___________________ ________  of a plan . (think) (s imple pas t)


key: chroma:document
string_value:
2. I ___________________ ________  all the books. (t ake) (present perfect)  
3. I ___________________ ________  of a plan . (think) (s imple pas t) 
4. The stars _______________________ in the sky. (twinkle) (present co ntinuous)  
5. I _________________________ the lett er. (write) (past perfect)  
 
B. Underlin e the adjective and write its kind:           2 
1. I stood  first in class.  
2. I have bought some biscu it packet s. 
 
C. Fill in the blanks with p repositions :           3 
1. Father opened the car __________________________ a screwd river.  
2. I stay ________________________ Hyderabad.  
3. Mohan is sitting ___________ ___________ Vikas and Rina.  
 
 Section D  (20 m)  
A. Write the meanings:                              (2 x 2 = 4)  
1. Gazed  
2. Lurch  
 
B. Answer  the following questions:                                                                                                        (9)


key: chroma:document
string_value:
1. Gazed  
2. Lurch  
 
B. Answer  the following questions:                                                                                                        (9) 
1. What do you think  “The oak smiled a knowing  smile” mean?                                               (3) 
2. What do you think was written in th e note that Mrs. Sharma sent to Nandini ’s parents ? (2) 
3. What dis Guru Gamphor t ell them to do ne xt time?                                                               (2) 
4. Write the fi rst two lines of the poem ‘Acro n and Oak ’                                                                            (2) 
 
C. Fill in the blanks:                                                                                                                                   (3) 
1. Guru Gamphor live d in ____________________________.  
2. Nandini ’s father had an ____________________________ . 
3. Nandini was happy to get a pair of _________________________.


key: chroma:document
string_value:
1. Guru Gamphor live d in ____________________________.  
2. Nandini ’s father had an ____________________________ . 
3. Nandini was happy to get a pair of _________________________.  
 
D. Write True or False:                                                                                                                               (4) 
1. “Oh I’ll never be bi g” the old tree said –  
2. Nandini loved danc ing the most – 
3. Nandini ’s mo ther was relaxed –  
4. Guru Gramphor fell asleep in  the bu llock cart –


