aboutsummaryrefslogtreecommitdiffstats
path: root/db_creation
blob: 9fc44e0ac47a0ac5de32460ad09812396890cce4 (plain) (blame)
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
CREATE TABLE "companies" (
	"id"	INTEGER,
	"ico"	TEXT NOT NULL UNIQUE,
	"nazev"	TEXT,
	"zapis"	DATE,
	"sidlo"	TEXT,
	"oddil"	TEXT,
	"vlozka"	TEXT,
	"soud"	TEXT,
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "insolvency_events" (
	"id"	INTEGER NOT NULL UNIQUE,
	"company_id"	TEXT NOT NULL,
	"insolvency_event"	TEXT UNIQUE,
	FOREIGN KEY("company_id") REFERENCES "companies"("id"),
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "obce" (
	"id"	INTEGER NOT NULL,
	"obec_jmeno"	TEXT NOT NULL UNIQUE,
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "obce_relation" (
	"company_id"	INTEGER NOT NULL UNIQUE,
	"obec_id"	INTEGER NOT NULL,
	FOREIGN KEY("obec_id") REFERENCES "obce"("id"),
	FOREIGN KEY("company_id") REFERENCES "companies"("id")
)

CREATE TABLE "osoby" (
	"id"	INTEGER NOT NULL,
	"osoba_jmeno"	TEXT UNIQUE,
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "pravni_formy" (
	"id"	INTEGER NOT NULL,
	"pravni_forma"	TEXT NOT NULL UNIQUE,
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "pravni_formy_relation" (
	"company_id"	INTEGER NOT NULL UNIQUE,
	"pravni_forma_id"	INTEGER NOT NULL,
	FOREIGN KEY("pravni_forma_id") REFERENCES "pravni_formy"("id"),
	FOREIGN KEY("company_id") REFERENCES "companies"("id")
)

CREATE TABLE sqlite_sequence(name,seq)

CREATE TABLE "ulice" (
	"id"	INTEGER NOT NULL,
	"ulice_jmeno"	TEXT NOT NULL UNIQUE,
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "ulice_relation" (
	"company_id"	INTEGER NOT NULL UNIQUE,
	"ulice_id"	INTEGER NOT NULL,
	FOREIGN KEY("company_id") REFERENCES "companies"("id"),
	FOREIGN KEY("ulice_id") REFERENCES "ulice"("id")
)

CREATE TABLE "predmety_cinnosti_relation" (
	"company_id"	INTEGER NOT NULL,
	"predmet_cinnosti_id"	INTEGER NOT NULL,
	"zapis_datum"	DATE,
	"vymaz_datum"	DATE,
	FOREIGN KEY("company_id") REFERENCES "companies"("id"),
	FOREIGN KEY("predmet_cinnosti_id") REFERENCES "predmety_cinnosti"("id")
)

CREATE TABLE "predmety_podnikani_relation" (
	"company_id"	INTEGER NOT NULL,
	"predmet_podnikani_id"	INTEGER NOT NULL,
	"zapis_datum"	DATE,
	"vymaz_datum"	DATE,
	FOREIGN KEY("company_id") REFERENCES "companies"("id"),
	FOREIGN KEY("predmet_podnikani_id") REFERENCES "predmety_podnikani"("id")
)

CREATE TABLE "predmety_cinnosti" (
	"id"	INTEGER NOT NULL,
	"predmet_cinnosti"	TEXT NOT NULL UNIQUE,
	PRIMARY KEY("id" AUTOINCREMENT)
)

CREATE TABLE "predmety_podnikani" (
	"id"	INTEGER NOT NULL,
	"predmet_podnikani"	TEXT NOT NULL UNIQUE,
	PRIMARY KEY("id" AUTOINCREMENT)
)