|
47 | 47 | drop table if exists jas.products; |
48 | 48 | go |
49 | 49 | create table jas.products( |
50 | | - p_id bigint identity(1,1) constraint pk_products unique not null, |
| 50 | + p_id bigint identity(1,1) constraint pk_products primary key not null, |
51 | 51 | product_name nvarchar(20) unique not null, |
52 | 52 | created_dt datetime2 not null); |
53 | 53 | go |
54 | 54 |
|
55 | 55 | drop table if exists jas.options; |
56 | 56 | go |
57 | 57 | create table jas.options( |
58 | | - o_id bigint identity(1,1) constraint pk_ingredients unique not null, |
| 58 | + o_id bigint identity(1,1) constraint pk_ingredients primary key not null, |
59 | 59 | option_name nvarchar(20) unique not null, |
60 | 60 | created_dt datetime2 not null); |
61 | 61 | go |
62 | 62 |
|
63 | 63 | drop table if exists jas.product_options; |
64 | 64 | go |
65 | 65 | create table jas.product_options( |
66 | | - po_id bigint identity(1,1) constraint pk_products_options unique not null, |
| 66 | + po_id bigint identity(1,1) constraint pk_products_options primary key not null, |
67 | 67 | p_id bigint constraint fk_products references jas.products(p_id) not null, |
68 | 68 | o_id bigint constraint fk_options references jas.options(o_id) not null, |
69 | 69 | product_option nvarchar(20) null, |
@@ -107,21 +107,6 @@ set xact_abort on; |
107 | 107 |
|
108 | 108 | begin transaction |
109 | 109 | begin try |
110 | | - declare |
111 | | - @check_isjson int=nullif(json_value(@headers, N'$.check_isjson'), 0); |
112 | | - |
113 | | - if @check_isjson=1 |
114 | | - begin |
115 | | - if isjson(@headers)=0 |
116 | | - throw 50000, 'The headers json is invalid', 1; |
117 | | - |
118 | | - if isjson(@params)=0 |
119 | | - throw 50000, 'The parameters json is invalid', 1; |
120 | | - |
121 | | - if isjson(@body)=0 |
122 | | - throw 50000, 'The request body json is invalid', 1; |
123 | | - end |
124 | | - |
125 | 110 | declare |
126 | 111 | @p_id bigint, |
127 | 112 | @p_count bigint; |
@@ -164,21 +149,6 @@ set xact_abort on; |
164 | 149 |
|
165 | 150 | begin transaction |
166 | 151 | begin try |
167 | | - declare |
168 | | - @check_isjson int=nullif(json_value(@headers, N'$.check_isjson'), 0); |
169 | | - |
170 | | - if @check_isjson=1 |
171 | | - begin |
172 | | - if isjson(@headers)=0 |
173 | | - throw 50000, 'The headers json is invalid', 1; |
174 | | - |
175 | | - if isjson(@params)=0 |
176 | | - throw 50000, 'The parameters json is invalid', 1; |
177 | | - |
178 | | - if isjson(@body)=0 |
179 | | - throw 50000, 'The request body json is invalid', 1; |
180 | | - end |
181 | | - |
182 | 152 | declare |
183 | 153 | @o table(o_id bigint unique not null, |
184 | 154 | product_name nvarchar(20)); |
|
0 commit comments