mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -06:00
Reorganize top level directory
This commit is contained in:
11
uhabits-core-legacy/assets/main/migrations/022.sql
Normal file
11
uhabits-core-legacy/assets/main/migrations/022.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
delete from repetitions where habit not in (select id from habits)
|
||||
delete from repetitions where timestamp is null
|
||||
delete from repetitions where habit is null
|
||||
delete from repetitions where rowid not in ( select min(rowid) from repetitions group by habit, timestamp )
|
||||
alter table Repetitions rename to RepetitionsBak
|
||||
create table Repetitions ( id integer primary key autoincrement, habit integer not null references habits(id), timestamp integer not null, value integer not null)
|
||||
drop index if exists idx_repetitions_habit_timestamp
|
||||
create unique index idx_repetitions_habit_timestamp on Repetitions( habit, timestamp)
|
||||
insert into Repetitions select * from RepetitionsBak
|
||||
drop table RepetitionsBak
|
||||
pragma foreign_keys=ON
|
||||
Reference in New Issue
Block a user