summaryrefslogtreecommitdiff
path: root/sql/login.sql
blob: 0ada1146337b3e9a02a9771d03607f6095af929a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
drop table if exists servers;
create table servers (
   id integer primary key autoincrement,
   name char(15not null,
   host char(15not null,
   port smallint not null,
   -- 0: MAINTENANCE
   -- 1: GOOD
   -- 2: NORMAL
   -- 3: OVERLOADED
   -- 4: QUEUE
   status tinyint not null check (status <= 4)
);

insert into servers values (null"login""84.248.5.167"100001);
insert into servers values (null"BENIS""84.248.5.167"101001);
insert into servers values (null"maintenance""84.248.5.167"101000);
insert into servers values (null"normal""84.248.5.167"101002);
insert into servers values (null"overloaded""84.248.5.167"101003);
insert into servers values (null"queue""84.248.5.167"101004);

drop table if exists accounts;
create table accounts (
   id integer primary key autoincrement,
   username varchar(16not null,
   password varchar(64not null,
   email varchar(64not null,
   last_login datetime default null,
   created datetime not null default current_timestamp
);

insert into accounts values (null"benis""benis"""nullcurrent_timestamp);

drop table if exists sessions;
create table sessions (
   id integer primary key not null check (id < 0xffffffff),
   account_id integer not null,
   char_id integer,
   server char(15not null,
   created datetime not null default current_timestamp
);

drop table if exists characters;
create table characters (
   id integer primary key autoincrement check (id < 0xffffffff),
   account_id integer not null,
   last_login datetime,
   created datetime not null default current_timestamp,
   -- 1: Haru
   -- 2: Ed
   -- 3: Lily
   -- 4: Jin
   -- 5: Stella
   -- 6: Iris
   -- 7: Chi
   model tinyint not null check (id > 0 and id <= 7),
   name char(12not null,
   evolution tinyint not null default 0,
   lvl tinyint not null default 1 check (lvl > 0)
);

insert into characters values (null1nullcurrent_timestamp6"Iris"1255);
insert into characters values (null1nullcurrent_timestamp3"Lily"1255);