Projekt

Obecné

Profil

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