Skip to content

Commit

Permalink
Use TEXT instead of STRING to define column type.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Feb 20, 2024
1 parent cc4a1b8 commit 95f73ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sqlite/createTables.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export function createTables(db) {
db.prepare("CREATE TABLE versions (vid INTEGER PRIMARY KEY, project STRING NOT NULL, asset STRING NOT NULL, version STRING NOT NULL, latest INTEGER NOT NULL)").run();
db.prepare("CREATE TABLE versions (vid INTEGER PRIMARY KEY, project TEXT NOT NULL, asset TEXT NOT NULL, version TEXT NOT NULL, latest INTEGER NOT NULL)").run();
db.prepare("CREATE INDEX index_versions1 ON versions(project, asset, version)").run();
db.prepare("CREATE INDEX index_versions2 ON versions(latest, project, asset)").run();

db.prepare("CREATE TABLE paths (pid INTEGER PRIMARY KEY, vid INTEGER NOT NULL, path STRING NOT NULL, metadata BLOB NOT NULL, FOREIGN KEY(vid) REFERENCES versions(vid) ON DELETE CASCADE)").run();
db.prepare("CREATE TABLE paths (pid INTEGER PRIMARY KEY, vid INTEGER NOT NULL, path TEXT NOT NULL, metadata BLOB NOT NULL, FOREIGN KEY(vid) REFERENCES versions(vid) ON DELETE CASCADE)").run();
db.prepare("CREATE INDEX index_paths ON paths(path)").run();

db.prepare("CREATE TABLE tokens (tid INTEGER PRIMARY KEY, token STRING NOT NULL UNIQUE)").run();
db.prepare("CREATE TABLE tokens (tid INTEGER PRIMARY KEY, token TEXT NOT NULL UNIQUE)").run();
db.prepare("CREATE INDEX index_tokens ON tokens(token)").run();

db.prepare("CREATE TABLE fields (fid INTEGER PRIMARY KEY, field STRING NOT NULL UNIQUE)").run();
db.prepare("CREATE TABLE fields (fid INTEGER PRIMARY KEY, field TEXT NOT NULL UNIQUE)").run();
db.prepare("CREATE INDEX index_fields ON fields(field)").run();

db.prepare("CREATE TABLE links (pid INTEGER NOT NULL, fid INTEGER NOT NULL, tid INTEGER NOT NULL, FOREIGN KEY(pid) REFERENCES paths(pid) ON DELETE CASCADE)").run();
Expand Down

0 comments on commit 95f73ce

Please sign in to comment.