Move uhabits-core to top level; all Java files to uhabits-core:jvmMain/jvmTest

This commit is contained in:
2021-01-03 13:21:02 -06:00
parent 1137088e20
commit 9fd36d8d53
225 changed files with 444 additions and 116 deletions

View File

@@ -0,0 +1,41 @@
create table Habits (
id integer primary key autoincrement,
archived integer,
color integer,
description text,
freq_den integer,
freq_num integer,
highlight integer,
name text,
position integer,
reminder_hour integer,
reminder_min integer
);
create table Checkmarks (
id integer primary key autoincrement,
habit integer references habits(id),
timestamp integer,
value integer
);
create table Repetitions (
id integer primary key autoincrement,
habit integer references habits(id),
timestamp integer
);
create table Streak (
id integer primary key autoincrement,
end integer,
habit integer references habits(id),
length integer,
start integer
);
create table Score (
id integer primary key autoincrement,
habit integer references habits(id),
score integer,
timestamp integer
);

View File

@@ -0,0 +1,3 @@
delete from Score;
delete from Streak;
delete from Checkmarks;

View File

@@ -0,0 +1 @@
alter table Habits add column reminder_days integer not null default 127;

View File

@@ -0,0 +1,3 @@
delete from Score;
delete from Streak;
delete from Checkmarks;

View File

@@ -0,0 +1,4 @@
create index idx_score_habit_timestamp on Score(habit, timestamp);
create index idx_checkmark_habit_timestamp on Checkmarks(habit, timestamp);
create index idx_repetitions_habit_timestamp on Repetitions(habit, timestamp);
create index idx_streak_habit_end on Streak(habit, end);

View File

@@ -0,0 +1,14 @@
update habits set color=0 where color=-2937041;
update habits set color=1 where color=-1684967;
update habits set color=2 where color=-415707;
update habits set color=3 where color=-5262293;
update habits set color=4 where color=-13070788;
update habits set color=5 where color=-16742021;
update habits set color=6 where color=-16732991;
update habits set color=7 where color=-16540699;
update habits set color=8 where color=-10603087;
update habits set color=9 where color=-7461718;
update habits set color=10 where color=-2614432;
update habits set color=11 where color=-13619152;
update habits set color=12 where color=-5592406;
update habits set color=0 where color<0 or color>12;

View File

@@ -0,0 +1,3 @@
delete from Score;
delete from Streak;
delete from Checkmarks;

View File

@@ -0,0 +1,2 @@
alter table Habits add column type integer not null default 0;
alter table Repetitions add column value integer not null default 2;

View File

@@ -0,0 +1,11 @@
drop table Score;
create table Score (
id integer primary key autoincrement,
habit integer references habits(id),
score real,
timestamp integer);
create index idx_score_habit_timestamp on Score(habit, timestamp);
delete from streak;
delete from checkmarks;

View File

@@ -0,0 +1,3 @@
alter table Habits add column target_type integer not null default 0;
alter table Habits add column target_value real not null default 0;
alter table Habits add column unit text not null default "";

View File

@@ -0,0 +1,6 @@
create table Events (
id integer primary key autoincrement,
timestamp integer,
message text,
server_id integer
);

View File

@@ -0,0 +1,3 @@
drop table checkmarks;
drop table streak;
drop table score;

View File

@@ -0,0 +1,12 @@
update habits set color=19 where color=12;
update habits set color=17 where color=11;
update habits set color=15 where color=10;
update habits set color=14 where color=9;
update habits set color=13 where color=8;
update habits set color=10 where color=7;
update habits set color=9 where color=6;
update habits set color=8 where color=5;
update habits set color=7 where color=4;
update habits set color=5 where color=3;
update habits set color=4 where color=2;
update habits set color=0 where color<0 or color>19;

View File

@@ -0,0 +1,24 @@
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
);
begin transaction;
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;
commit;
pragma foreign_keys=ON;

View File

@@ -0,0 +1,5 @@
alter table Habits add column question text;
update Habits set question = description;
update Habits set description = "";

View File

@@ -0,0 +1,2 @@
alter table habits add column uuid text;
update habits set uuid = lower(hex(randomblob(16) || id));