1 -- Database should be in this folder, and named 'vchess.sqlite'
3 create table Variants (
4 id integer primary key,
11 id integer primary key,
22 create table Problems (
23 id integer primary key,
30 foreign key (uid
) references Users(id),
31 foreign key (vid
) references Variants(id)
34 create table Challenges (
35 id integer primary key,
43 foreign key (uid
) references Users(id),
44 foreign key (vid
) references Variants(id)
47 create table GameStat (
49 total
integer default 0,
50 foreign key (vid
) references Variants(id)
54 id integer primary key,
56 fenStart
varchar, --initial state
57 fen
varchar, --current state
60 score
varchar default '*',
63 randomness
integer, --for rematch
65 drawOffer
character default '',
66 rematchOffer
character default '',
67 deletedByWhite
boolean,
68 deletedByBlack
boolean,
69 chatReadWhite datetime
,
70 chatReadBlack datetime
,
71 foreign key (vid
) references Variants(id),
72 foreign key (white
) references Users(id),
73 foreign key (black
) references Users(id)
85 squares
varchar, --description, appear/vanish/from/to
86 played datetime
, --when was this move played?
87 idx
integer, --index of the move in the game
88 foreign key (gid
) references Games(id)
91 create index scoreIdx
on Games(score
);
93 pragma foreign_keys
= on;