1 -- Database should be in this folder, and named 'vchess.sqlite'
3 create table Variants (
4 id integer primary key,
13 id integer primary key,
24 create table Problems (
25 id integer primary key,
32 foreign key (uid
) references Users(id),
33 foreign key (vid
) references Variants(id)
36 create table Challenges (
37 id integer primary key,
45 foreign key (uid
) references Users(id),
46 foreign key (vid
) references Variants(id)
49 create table GameStat (
51 total
integer default 0,
52 foreign key (vid
) references Variants(id)
56 id integer primary key,
58 fenStart
varchar, --initial state
59 fen
varchar, --current state
62 score
varchar default '*',
65 options varchar, --for rematch
67 drawOffer
character default '',
68 rematchOffer
character default '',
69 deletedByWhite
boolean,
70 deletedByBlack
boolean,
71 chatReadWhite datetime
,
72 chatReadBlack datetime
,
73 foreign key (vid
) references Variants(id),
74 foreign key (white
) references Users(id),
75 foreign key (black
) references Users(id)
87 squares
varchar, --description, appear/vanish/from/to
88 played datetime
, --when was this move played?
89 idx
integer, --index of the move in the game
90 foreign key (gid
) references Games(id)
93 create index scoreIdx
on Games(score
);
95 pragma foreign_keys
= on;