was trying to implement FTS but when ever I try to...
# squarelibraries
y
was trying to implement FTS but when ever I try to insert a row I get this warning I the table doesn't get inserted android.database.sqlite.SQLiteConstraintException: constraint failed (code 19 SQLITE_CONSTRAINT)
Copy code
DROP TABLE IF EXISTS ayahEntity;

CREATE TABLE IF NOT EXISTS ayahEntity (
    ayahId TEXT NOT NULL PRIMARY KEY,
    ayahIndex INTEGER NOT NULL,
    pageIndex INTEGER NOT NULL,
    surahIndex INTEGER NOT NULL,
    simpleText TEXT NOT NULL
);

CREATE VIRTUAL TABLE AyhaFTS USING fts4(
    content='ayahEntity',
    ayahId INTEGER,
    pageIndex INTEGER,
    surahIndex INTEGER,
    ayahIndex INTEGER,
    simpleText TEXT,
    tokenize = 'unicode61'
);

CREATE TRIGGER launch_after_insert_location
AFTER INSERT ON ayahEntity
BEGIN
    INSERT INTO AyhaFTS(ayahId, pageIndex, surahIndex, ayahIndex, simpleText)
    VALUES (new.ayahId, new.pageIndex, new.surahIndex, new.ayahIndex, new.simpleText);
END;