Projekt

Obecné

Profil

Stáhnout (2.29 KB) Statistiky
| Větev: | Tag: | Revize:
1 46867cf8 David Friesecký
/* ---------------------------------------------------- */
2
/*  Generated by Enterprise Architect Version 13.5 		*/
3 0e7c3096 David Friesecký
/*  Created On : 29-dub-2021 11:55:46 				*/
4 46867cf8 David Friesecký
/*  DBMS       : SQLite 								*/
5
/* ---------------------------------------------------- */
6
7
/* Drop Tables */
8
9 6425fa36 David Friesecký
DROP TABLE IF EXISTS 'Certificates'
10 46867cf8 David Friesecký
;
11
12 e88c2086 David Friesecký
DROP TABLE IF EXISTS 'CertificateTypes'
13 46867cf8 David Friesecký
;
14
15 e88c2086 David Friesecký
DROP TABLE IF EXISTS 'CertificateUsages'
16 46867cf8 David Friesecký
;
17
18 6425fa36 David Friesecký
DROP TABLE IF EXISTS 'PrivateKeys'
19 46867cf8 David Friesecký
;
20
21 6425fa36 David Friesecký
DROP TABLE IF EXISTS 'UsageTypes'
22 46867cf8 David Friesecký
;
23
24 6425fa36 David Friesecký
/* Create Tables with Primary and Foreign Keys, Check and Unique Constraints */
25 46867cf8 David Friesecký
26 e88c2086 David Friesecký
CREATE TABLE 'Certificates'
27 46867cf8 David Friesecký
(
28 e88c2086 David Friesecký
	'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
29 46867cf8 David Friesecký
	'valid_from' TEXT NOT NULL,
30
	'valid_to' TEXT NOT NULL,
31
	'pem_data' TEXT NOT NULL,
32 0e7c3096 David Friesecký
	'common_name' TEXT NOT NULL,
33
	'country_code' TEXT NULL,
34
	'locality' TEXT NULL,
35
	'province' TEXT NULL,
36
	'organization' TEXT NULL,
37
	'organizational_unit' TEXT NULL,
38
	'email_address' TEXT NULL,
39 1f75a8f5 David Friesecký
	'revocation_date' TEXT NULL,
40
	'revocation_reason' TEXT NULL,
41 6425fa36 David Friesecký
	'deletion_date' TEXT NULL,
42 e88c2086 David Friesecký
	'certificate_type_id' INTEGER NOT NULL,
43
	'parent_certificate_id' INTEGER NOT NULL,
44 0e7c3096 David Friesecký
	'private_key_id' INTEGER NOT NULL,
45 e88c2086 David Friesecký
	CONSTRAINT 'FK_Certificates' FOREIGN KEY ('parent_certificate_id') REFERENCES 'Certificates' ('id') ON DELETE No Action ON UPDATE No Action,
46
	CONSTRAINT 'FK_CertificateTypes' FOREIGN KEY ('certificate_type_id') REFERENCES 'CertificateTypes' ('id') ON DELETE No Action ON UPDATE No Action,
47
	CONSTRAINT 'FK_PrivateKeys' FOREIGN KEY ('private_key_id') REFERENCES 'PrivateKeys' ('id') ON DELETE No Action ON UPDATE No Action
48
)
49
;
50
51 6425fa36 David Friesecký
CREATE TABLE 'CertificateTypes'
52
(
53
	'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
54
	'certificate_type' TEXT NOT NULL
55
)
56
;
57
58 e88c2086 David Friesecký
CREATE TABLE 'CertificateUsages'
59
(
60
	'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
61
	'certificate_id' INTEGER NOT NULL,
62
	'usage_type_id' INTEGER NOT NULL,
63
	CONSTRAINT 'FK_Certificates' FOREIGN KEY ('certificate_id') REFERENCES 'Certificates' ('id') ON DELETE Cascade ON UPDATE No Action,
64
	CONSTRAINT 'FK_UsageTypes' FOREIGN KEY ('usage_type_id') REFERENCES 'UsageTypes' ('id') ON DELETE No Action ON UPDATE No Action
65 46867cf8 David Friesecký
)
66
;
67 6425fa36 David Friesecký
68
CREATE TABLE 'PrivateKeys'
69
(
70
	'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
71
	'private_key' TEXT NOT NULL,
72
	'password' TEXT NULL
73
)
74
;
75
76
CREATE TABLE 'UsageTypes'
77
(
78
	'id' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
79
	'usage_type' TEXT NOT NULL
80
)
81
;