|
1
|
use salarymarket;
|
|
2
|
|
|
3
|
CREATE TABLE solution_setting_country (
|
|
4
|
id INT AUTO_INCREMENT,
|
|
5
|
code TEXT NOT NULL PRIMARY KEY,
|
|
6
|
active boolean,
|
|
7
|
);
|
|
8
|
|
|
9
|
CREATE TABLE solution_setting_country_translate (
|
|
10
|
id TEXT NOT NULL PRIMARY KEY,
|
|
11
|
code TEXT,
|
|
12
|
Libele TEXT,
|
|
13
|
languageCode INT NOT NULL,
|
|
14
|
FOREIGN KEY (code) REFERENCES solution_setting_country(code) ON DELETE CASCADE
|
|
15
|
);
|
|
16
|
|
|
17
|
--solution_setting_country
|
|
18
|
(1, 'TN', NULL, 1),
|
|
19
|
(1, 'FR', NULL, 1),
|
|
20
|
--solution_setting_country_translate
|
|
21
|
('TN1' ,'TN', 'TUNISIE', 1),
|
|
22
|
('TN2' ,'TN', 'TUNISIA', 2),
|
|
23
|
('FR1' ,'FR', 'FRANCE', 1),
|
|
24
|
('FR2' ,'FR', 'FRANCE', 2),
|
|
25
|
|
|
26
|
|
|
27
|
SELECT p.code, t.Libele
|
|
28
|
FROM solution_setting_country p
|
|
29
|
JOIN solution_setting_country_translate t ON p.code = t.code
|
|
30
|
WHERE t.LanguageCode = 'fr';
|
|
31
|
|
|
32
|
|
|
33
|
|
|
34
|
CREATE TABLE solution_setting_town(
|
|
35
|
id INT AUTO_INCREMENT,
|
|
36
|
code TEXT NOT NULL PRIMARY KEY,
|
|
37
|
countryCode TEXT NOT NULL,
|
|
38
|
FOREIGN KEY (code) REFERENCES solution_setting_country(countryCode) ON DELETE CASCADE
|
|
39
|
);
|
|
40
|
|
|
41
|
CREATE TABLE solution_setting_town_translate (
|
|
42
|
id TEXT NOT NULL PRIMARY KEY,
|
|
43
|
code TEXT,
|
|
44
|
Libele TEXT,
|
|
45
|
languageCode INT NOT NULL,
|
|
46
|
FOREIGN KEY (code) REFERENCES solution_setting_country(code) ON DELETE CASCADE
|
|
47
|
);
|
|
48
|
|
|
49
|
|
|
50
|
--solution_setting_country_town
|
|
51
|
(2, 'TUNIS', 'TN', 1),
|
|
52
|
(2, 'PARIS', 'FR', 1),
|
|
53
|
|
|
54
|
--solution_setting_country_town_translate
|
|
55
|
('TUNIS1' ,'TUNIS', 'TUNIS', 1),
|
|
56
|
('TUNIS2' ,'TUNIS', 'TUNIS', 2),
|
|
57
|
('PARIS1' ,'PARIS', 'PARIS', 1),
|
|
58
|
('PARIS2' ,'PARIS', 'PARIS', 2),
|
|
59
|
|
|
60
|
SELECT p.code, t.Libele
|
|
61
|
FROM solution_setting_town p
|
|
62
|
JOIN solution_setting_town_translate t ON p.code = t.code
|
|
63
|
WHERE t.LanguageCode = 'fr'
|
|
64
|
AND p.countrycode = 'TN';
|