Make sure workouts table has all names from sets
This commit is contained in:
parent
eddad49719
commit
562ee4f43e
5
db.ts
5
db.ts
|
@ -75,6 +75,10 @@ const addSteps = `
|
|||
ALTER TABLE workouts ADD COLUMN steps TEXT NULL;
|
||||
`;
|
||||
|
||||
const insertWorkouts = `
|
||||
INSERT INTO workouts (name) SELECT DISTINCT name FROM sets;
|
||||
`;
|
||||
|
||||
export let db: SQLiteDatabase;
|
||||
|
||||
export const migrations = async () => {
|
||||
|
@ -89,6 +93,7 @@ export const migrations = async () => {
|
|||
await db.executeSql(addImage).catch(() => null);
|
||||
await db.executeSql(addImages).catch(() => null);
|
||||
await db.executeSql(addSteps).catch(() => null);
|
||||
await db.executeSql(insertWorkouts).catch(() => null);
|
||||
const [result] = await db.executeSql(selectSettings);
|
||||
if (result.rows.length === 0) await db.executeSql(insertSettings);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user