aboutsummaryrefslogtreecommitdiffstats
path: root/chocula_schema.sql
blob: 2db1065eeb2279609a8d29057863227adcb41637 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

CREATE TABLE IF NOT EXISTS journal
    (issnl TEXT NOT NULL PRIMARY KEY,
     issne TEXT,
     issnp TEXT,
     fatcat_ident TEXT,
     wikidata_qid TEXT,
     name TEXT,
     publisher TEXT,
     country TEXT,
     lang TEXT,

     release_count INTEGER,
     ia_count INTEGER,
     ia_frac FLOAT,
     kbart_count INTEGER,
     kbart_frac FLOAT,
     preserved_count INTEGER,
     preserved_frac FLOAT,

     publisher_type TEXT,
     is_active BOOLEAN,
     is_oa BOOLEAN default false,
     is_longtail BOOLEAN default false,
     sherpa_color TEXT,
     --vor_pdf BOOLEAN,
     --vor_html BOOLEAN,
     --vor_jats BOOLEAN,
     has_dois BOOLEAN,
     any_homepage BOOLEAN,
     any_live_homepage BOOLEAN,
     any_gwb_homepage BOOLEAN,
     known_issnl BOOLEAN,
     valid_issnl BOOLEAN
    );

CREATE TABLE IF NOT EXISTS directory
    (issnl TEXT NOT NULL,
     slug TEXT NOT NULL,
     identifier TEXT,
     name TEXT,
     extra TEXT,
     PRIMARY KEY(issnl, slug)
    );

CREATE TABLE IF NOT EXISTS fatcat_container
    (ident TEXT NOT NULL PRIMARY KEY,
     revision TEXT NOT NULL,
     issnl TEXT,
     issne TEXT,
     issnp TEXT,
     wikidata_qid TEXT,
     name TEXT,
     container_type TEXT,
     publisher TEXT,
     country TEXT,
     lang TEXT,
     release_count INTEGER,
     ia_count INTEGER,
     ia_frac FLOAT,
     kbart_count INTEGER,
     kbart_frac FLOAT,
     preserved_count INTEGER,
     preserved_frac FLOAT
    );
CREATE INDEX IF NOT EXISTS fatcat_container_issnl_idx ON fatcat_container(issnl);

CREATE TABLE IF NOT EXISTS homepage
    (id INTEGER PRIMARY KEY,
     issnl TEXT NOT NULL,
     surt TEXT NOT NULL,
     url TEXT NOT NULL,
     host TEXT,
     domain TEXT,
     suffix TEXT,
     status_code INTEGER,
     crawl_error TEXT,
     terminal_url TEXT,
     terminal_status_code INTEGER,
     platform_software TEXT,
     issnl_in_body BOOLEAN,
     blocked BOOLEAN,
     gwb_url_success_dt TEXT,
     gwb_terminal_url_success_dt TEXT,
     UNIQUE(issnl, surt)
    );
CREATE INDEX IF NOT EXISTS homepage_url_idx ON homepage(url);

-- CREATE TABLE IF NOT EXISTS name
--     (id INTEGER PRIMARY KEY,
--      issnl TEXT NOT NULL,
--      name TEXT NOT NULL
--      -- sluggy (lower-case, no special chars)
--     );
    
-- CREATE TABLE IF NOT EXISTS fulltext_pattern
--     (id INTEGER PRIMARY KEY,
--      issnl TEXT NOT NULL,
--      surt_glob TEXT,
--      mimetype TEXT,
--      state_date TEXT,
--      end_date TEXT
--     );