Fix system info DDL typo and modifiedAt login

This commit is contained in:
2024-08-13 23:26:07 +02:00
parent ac091b1dc9
commit e8aaa328e6

View File

@@ -41,7 +41,7 @@ export const DatabaseLive = (filePath: string = "db.sqlite3") => Layer.effect(Da
createdBy TEXT REFERENCES User (userId) ON DELETE SET NULL ON UPDATE CASCADE, createdBy TEXT REFERENCES User (userId) ON DELETE SET NULL ON UPDATE CASCADE,
createdAt TEXT NOT NULL, createdAt TEXT NOT NULL,
modifiedBy TEXT REFERENCES User (userId) ON DELETE SET NULL ON UPDATE CASCADE, modifiedBy TEXT REFERENCES User (userId) ON DELETE SET NULL ON UPDATE CASCADE,
modifiedAt TEXT NUL NULL modifiedAt TEXT
`; `;
db.exec("PRAGMA foreign_keys = ON"); db.exec("PRAGMA foreign_keys = ON");
@@ -104,7 +104,7 @@ export const DatabaseLive = (filePath: string = "db.sqlite3") => Layer.effect(Da
const createPiece = db.prepare< const createPiece = db.prepare<
never, never,
[pieceId: PieceId, name: string, composer: string | null, lyricist: string | null, arranger: string | null, user: UserId] [pieceId: PieceId, name: string, composer: string | null, lyricist: string | null, arranger: string | null, user: UserId]
>("INSERT INTO Piece (pieceId, name, composer, lyricist, arranger, createdBy, createdAt, modifiedBy, modifiedAt) VALUES (?1, ?2, ?3, ?4, ?5, ?6, datetime(), ?6, datetime())"); >("INSERT INTO Piece (pieceId, name, composer, lyricist, arranger, createdBy, createdAt, modifiedBy, modifiedAt) VALUES (?1, ?2, ?3, ?4, ?5, ?6, datetime(), ?6, NULL)");
const getPieces = db.prepare< const getPieces = db.prepare<
typeof Piece.Encoded, typeof Piece.Encoded,
[] []