Fix blueprints
This commit is contained in:
parent
8a11275849
commit
1bfe7e3437
4 changed files with 79 additions and 16 deletions
|
|
@ -112,7 +112,7 @@ const runMigrations = () => {
|
|||
const quizTableInfo = db.prepare("PRAGMA table_info(quizzes)").all() as { name: string }[];
|
||||
const hasShareToken = quizTableInfo.some(col => col.name === "share_token");
|
||||
if (!hasShareToken) {
|
||||
db.exec("ALTER TABLE quizzes ADD COLUMN share_token TEXT UNIQUE");
|
||||
db.exec("ALTER TABLE quizzes ADD COLUMN share_token TEXT");
|
||||
console.log("Migration: Added share_token to quizzes");
|
||||
}
|
||||
|
||||
|
|
@ -124,8 +124,8 @@ const runMigrations = () => {
|
|||
|
||||
const shareTokenIndex = db.prepare("SELECT name FROM sqlite_master WHERE type='index' AND name='idx_quizzes_share_token'").get();
|
||||
if (!shareTokenIndex) {
|
||||
db.exec("CREATE INDEX idx_quizzes_share_token ON quizzes(share_token)");
|
||||
console.log("Migration: Created index on quizzes.share_token");
|
||||
db.exec("CREATE UNIQUE INDEX idx_quizzes_share_token ON quizzes(share_token)");
|
||||
console.log("Migration: Created unique index on quizzes.share_token");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,5 @@ CREATE TABLE IF NOT EXISTS game_sessions (
|
|||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_quizzes_user ON quizzes(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_quizzes_share_token ON quizzes(share_token);
|
||||
CREATE INDEX IF NOT EXISTS idx_questions_quiz ON questions(quiz_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_options_question ON answer_options(question_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_game_sessions_updated ON game_sessions(updated_at);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue