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)
48 id integer primary key,
50 fenStart
varchar, --initial state
51 fen
varchar, --current state
54 score
varchar default '*',
57 randomness
integer, --for rematch
59 drawOffer
character default '',
60 rematchOffer
character default '',
61 deletedByWhite
boolean,
62 deletedByBlack
boolean,
63 chatReadWhite datetime
,
64 chatReadBlack datetime
,
65 foreign key (vid
) references Variants(id),
66 foreign key (white
) references Users(id),
67 foreign key (black
) references Users(id)
79 squares
varchar, --description, appear/vanish/from/to
80 played datetime
, --when was this move played?
81 idx
integer, --index of the move in the game
82 foreign key (gid
) references Games(id)
85 create index scoreIdx
on Games(score
);
87 pragma foreign_keys
= on;