This repository was archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdistribution.sql
More file actions
73 lines (62 loc) · 2.02 KB
/
Copy pathdistribution.sql
File metadata and controls
73 lines (62 loc) · 2.02 KB
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
64
65
66
67
68
69
70
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
device_address CHAR(33) NOT NULL UNIQUE,
payout_address CHAR(32),
member_id INTEGER UNIQUE,
account_name CHAR (30),
salt CHAR(5),
lang CHAR (20) DEFAULT 'unknown',
has_crawl_error TINYINT DEFAULT 0,
creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (device_address) REFERENCES correspondent_devices(device_address)
);
CREATE TABLE honorific_asset (
unit CHAR(44),
creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE distributions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
is_crawled TINYINT DEFAULT 0,
is_authorized TINYINT DEFAULT 0,
is_completed TINYINT DEFAULT 0,
creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO distributions (is_crawled,is_completed,is_authorized) VALUES (1,1,1); -- insert a first dummy distribution
CREATE TABLE wcg_scores (
distribution_id INTEGER,
device_address CHAR(33) NOT NULL,
payout_address CHAR(32),
member_id INTEGER,
score FLOAT,
diff_from_previous FLOAT,
payment_unit CHAR(44),
bytes_reward INTEGER DEFAULT 0,
PRIMARY KEY (distribution_id, member_id),
UNIQUE(distribution_id, device_address),
FOREIGN KEY (distribution_id) REFERENCES distributions(id),
FOREIGN KEY (device_address) REFERENCES users(device_address)
);
CREATE TABLE wcg_meta_infos(
distribution_id INTEGER,
device_address CHAR(33) NOT NULL,
member_id INTEGER,
nb_devices INTEGER,
run_time_per_day FLOAT,
run_time_per_result FLOAT,
points_per_hour_runtime FLOAT,
points_per_day FLOAT,
points_per_result FLOAT,
PRIMARY KEY (distribution_id, member_id),
UNIQUE(distribution_id, device_address),
FOREIGN KEY (distribution_id) REFERENCES distributions(id),
FOREIGN KEY (device_address) REFERENCES users(device_address)
);
CREATE TABLE initial_rewards(
member_id INTEGER UNIQUE,
device_address CHAR(33) NOT NULL,
bytes_reward INTEGER DEFAULT 0,
assets_reward INTEGER DEFAULT 0,
payout_address CHAR(32),
payment_unit CHAR(44),
creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);