Skip to content
This repository was archived by the owner on Sep 14, 2024. It is now read-only.

Commit 642177e

Browse files
committed
feat: new DB schema for updated backend
1 parent aea2dd2 commit 642177e

File tree

1 file changed

+57
-20
lines changed

1 file changed

+57
-20
lines changed

dump.example.sql

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@
99
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
1010
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
1111

12+
--
13+
-- Table structure for table `changevalue`
14+
--
15+
16+
DROP TABLE IF EXISTS `changevalue`;
17+
/*!40101 SET @saved_cs_client = @@character_set_client */;
18+
/*!40101 SET character_set_client = utf8 */;
19+
CREATE TABLE `changevalue` (
20+
`hash_value` varchar(255) NOT NULL,
21+
`location` varchar(255) DEFAULT NULL,
22+
PRIMARY KEY (`hash_value`)
23+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
24+
/*!40101 SET character_set_client = @saved_cs_client */;
25+
1226
--
1327
-- Table structure for table `dispense`
1428
--
@@ -17,14 +31,14 @@ DROP TABLE IF EXISTS `dispense`;
1731
/*!40101 SET @saved_cs_client = @@character_set_client */;
1832
/*!40101 SET character_set_client = utf8 */;
1933
CREATE TABLE `dispense` (
34+
`previous_sku` int(11) DEFAULT NULL,
2035
`id` bigint(20) NOT NULL AUTO_INCREMENT,
2136
`modify_date` datetime(6) DEFAULT NULL,
22-
`previous_sku` int(11) DEFAULT NULL,
37+
`dispense_reason` varchar(255) DEFAULT NULL,
2338
PRIMARY KEY (`id`)
2439
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2540
/*!40101 SET character_set_client = @saved_cs_client */;
2641

27-
2842
--
2943
-- Table structure for table `eye`
3044
--
@@ -33,16 +47,15 @@ DROP TABLE IF EXISTS `eye`;
3347
/*!40101 SET @saved_cs_client = @@character_set_client */;
3448
/*!40101 SET character_set_client = utf8 */;
3549
CREATE TABLE `eye` (
50+
`additional` decimal(38,2) DEFAULT NULL,
51+
`axis` int(11) DEFAULT NULL CHECK (`axis` <= 180),
52+
`cylinder` decimal(38,2) DEFAULT NULL,
53+
`sphere` decimal(38,2) DEFAULT NULL,
3654
`id` bigint(20) NOT NULL AUTO_INCREMENT,
37-
`additional` float DEFAULT NULL,
38-
`axis` int(11) DEFAULT NULL,
39-
`cylinder` float DEFAULT NULL,
40-
`sphere` float DEFAULT NULL,
4155
PRIMARY KEY (`id`)
4256
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4357
/*!40101 SET character_set_client = @saved_cs_client */;
4458

45-
4659
--
4760
-- Table structure for table `glasses`
4861
--
@@ -51,19 +64,19 @@ DROP TABLE IF EXISTS `glasses`;
5164
/*!40101 SET @saved_cs_client = @@character_set_client */;
5265
/*!40101 SET character_set_client = utf8 */;
5366
CREATE TABLE `glasses` (
54-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
55-
`appearance` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
56-
`creation_date` datetime(6) DEFAULT NULL,
5767
`dispensed` bit(1) DEFAULT NULL,
58-
`glasses_size` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
59-
`glasses_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
60-
`location` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
6168
`sku` int(11) DEFAULT NULL,
69+
`creation_date` datetime(6) DEFAULT NULL,
6270
`dispense_id` bigint(20) DEFAULT NULL,
71+
`id` bigint(20) NOT NULL AUTO_INCREMENT,
6372
`od_id` bigint(20) DEFAULT NULL,
6473
`os_id` bigint(20) DEFAULT NULL,
74+
`appearance` varchar(255) DEFAULT NULL,
75+
`glasses_size` varchar(255) DEFAULT NULL,
76+
`glasses_type` varchar(255) DEFAULT NULL,
77+
`location` varchar(255) DEFAULT NULL,
6578
PRIMARY KEY (`id`),
66-
KEY `FKn7g5jsbuiwnmpeh90i89y4gv0` (`dispense_id`),
79+
UNIQUE KEY `UK_3lcjb01rnq2hn89tl7v1k7yld` (`dispense_id`),
6780
KEY `FKovw8a7k5pow8in36qh2k3t0ja` (`od_id`),
6881
KEY `FKnnd7mfxvhrbjwv8p5xiswnai8` (`os_id`),
6982
KEY `sku` (`sku`),
@@ -82,11 +95,35 @@ DROP TABLE IF EXISTS `roles`;
8295
/*!40101 SET character_set_client = utf8 */;
8396
CREATE TABLE `roles` (
8497
`id` int(11) NOT NULL AUTO_INCREMENT,
85-
`name` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
98+
`name` varchar(20) DEFAULT NULL,
8699
PRIMARY KEY (`id`)
87100
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
88101
/*!40101 SET character_set_client = @saved_cs_client */;
89102

103+
--
104+
-- Table structure for table `unsuccessful_search`
105+
--
106+
107+
DROP TABLE IF EXISTS `unsuccessful_search`;
108+
/*!40101 SET @saved_cs_client = @@character_set_client */;
109+
/*!40101 SET character_set_client = utf8 */;
110+
CREATE TABLE `unsuccessful_search` (
111+
`increase_search_tolerance` bit(1) DEFAULT NULL,
112+
`id` bigint(20) NOT NULL AUTO_INCREMENT,
113+
`od_id` bigint(20) DEFAULT NULL,
114+
`os_id` bigint(20) DEFAULT NULL,
115+
`search_date` datetime(6) DEFAULT NULL,
116+
`bal_lens` varchar(255) DEFAULT NULL,
117+
`glasses_type` varchar(255) DEFAULT NULL,
118+
`location` varchar(255) DEFAULT NULL,
119+
PRIMARY KEY (`id`),
120+
KEY `FK7t97hwa6fd36m3mobo5bfgxk3` (`od_id`),
121+
KEY `FK2jxxit8euqbtutk6vmrs1pb6l` (`os_id`),
122+
CONSTRAINT `FK2jxxit8euqbtutk6vmrs1pb6l` FOREIGN KEY (`os_id`) REFERENCES `eye` (`id`),
123+
CONSTRAINT `FK7t97hwa6fd36m3mobo5bfgxk3` FOREIGN KEY (`od_id`) REFERENCES `eye` (`id`)
124+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
125+
/*!40101 SET character_set_client = @saved_cs_client */;
126+
90127
--
91128
-- Table structure for table `user_roles`
92129
--
@@ -95,10 +132,10 @@ DROP TABLE IF EXISTS `user_roles`;
95132
/*!40101 SET @saved_cs_client = @@character_set_client */;
96133
/*!40101 SET character_set_client = utf8 */;
97134
CREATE TABLE `user_roles` (
98-
`user_id` bigint(20) NOT NULL,
99135
`role_id` int(11) NOT NULL,
100-
PRIMARY KEY (`user_id`,`role_id`),
101-
KEY `FKh8ciramu9cc9q3qcqiv4ue8a6` (`role_id`),
136+
`user_id` bigint(20) NOT NULL,
137+
PRIMARY KEY (`role_id`,`user_id`),
138+
KEY `FKhfh9dx7w3ubf1co1vdev94g3f` (`user_id`),
102139
CONSTRAINT `FKh8ciramu9cc9q3qcqiv4ue8a6` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
103140
CONSTRAINT `FKhfh9dx7w3ubf1co1vdev94g3f` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
104141
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -114,8 +151,8 @@ DROP TABLE IF EXISTS `users`;
114151
/*!40101 SET character_set_client = utf8 */;
115152
CREATE TABLE `users` (
116153
`id` bigint(20) NOT NULL AUTO_INCREMENT,
117-
`password` varchar(120) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
118-
`username` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
154+
`username` varchar(20) DEFAULT NULL,
155+
`password` varchar(120) DEFAULT NULL,
119156
PRIMARY KEY (`id`),
120157
UNIQUE KEY `UKr43af9ap4edm43mmtq01oddj6` (`username`)
121158
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

0 commit comments

Comments
 (0)