213 | | |
214 | | |
| 213 | Wymagana struktura tabeli powinna być następująca: |
| 214 | ||Kolumna||Typ danych||NULL?||Klucz główny||Auto increment||Default|| |
| 215 | ||exp_id||bigint||NOT NULL||Tak||Tak ||-|| |
| 216 | ||keyval||int||NULL||Nie||-||-|| |
| 217 | ||clsnam||varchar(32)||NULL||Nie||-||-|| |
| 218 | ||chadat||timestamp with time zone / datetime ||NULL||Nie||-||GETDATE()|| |
| 219 | |
| 220 | Przykładowe skrypty tworzące tabelę: |
| 221 | {{{ |
| 222 | #!sql |
| 223 | |
| 224 | -- dla SZBD Ms SQL Server |
| 225 | USE <nazwa_bazy_danych> |
| 226 | GO |
| 227 | |
| 228 | /****** Object: Table sage.bs_export_queue Script Date: 11/25/2013 09:35:06 ******/ |
| 229 | SET ANSI_NULLS ON |
| 230 | GO |
| 231 | |
| 232 | SET QUOTED_IDENTIFIER ON |
| 233 | GO |
| 234 | |
| 235 | SET ANSI_PADDING ON |
| 236 | |
| 237 | GO |
| 238 | |
| 239 | IF OBJECT_ID('edokumenty.bs_export_queue') IS NOT NULL |
| 240 | BEGIN |
| 241 | DROP TABLE edokumenty.bs_export_queue |
| 242 | END |
| 243 | GO |
| 244 | |
| 245 | CREATE TABLE edokumenty.bs_export_queue( |
| 246 | exp_id bigint IDENTITY(1,1) NOT NULL, |
| 247 | keyval int NULL, |
| 248 | clsnam varchar(32) NULL, |
| 249 | chadat datetime NULL, |
| 250 | CONSTRAINT pk_exp_id PRIMARY KEY CLUSTERED (exp_id ASC) |
| 251 | ) ; |
| 252 | |
| 253 | GO |
| 254 | |
| 255 | ALTER TABLE edokumenty.bs_export_queue ADD DEFAULT (getdate()) FOR chadat |
| 256 | GO |
| 257 | |
| 258 | -- PostgreSQL -- |
| 259 | DROP TABLE IF EXISTS edokumenty.bs_export_queue CASCADE; |
| 260 | |
| 261 | CREATE TABLE edokumenty.bs_export_queue ( |
| 262 | exp_id bigint NOT NULL PRIMARY KEY, |
| 263 | keyval int NULL, |
| 264 | clsnam varchar(32) NULL, |
| 265 | chadat timestamp with time zone DEFAULT current_timestamp |
| 266 | ); |
| 267 | |
| 268 | |
| 269 | DROP SEQUENCE IF EXISTS edokumenty.bs_export_queue_seq CASCADE; |
| 270 | |
| 271 | CREATE SEQUENCE edokumenty.bs_export_queue_seq |
| 272 | INCREMENT BY 1 |
| 273 | START 1 |
| 274 | NO MAXVALUE |
| 275 | OWNED BY edokumenty.bs_export_queue.exp_id; |
| 276 | |
| 277 | ALTER TABLE edokumenty.bs_export_queue |
| 278 | ALTER COLUMN exp_id SET DEFAULT nextval('edokumenty.bs_export_queue_seq'); |
| 279 | |
| 280 | ALTER TABLE edokumenty.bs_export_queue |
| 281 | OWNER TO edokumenty; |
| 282 | GRANT ALL ON TABLE edokumenty.bs_export_queue TO edokumenty; |
| 283 | GRANT ALL ON TABLE edokumenty.bs_export_queue TO http; |
| 284 | |
| 285 | -- MySQL -- |
| 286 | |
| 287 | DROP TABLE IF EXISTS bs_export_queue; |
| 288 | |
| 289 | CREATE TABLE bs_export_queue( |
| 290 | exp_id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 291 | keyval INT NULL, |
| 292 | clsnam VARCHAR(32) NULL, |
| 293 | chadat TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
| 294 | ); |
| 295 | |
| 296 | |
| 297 | }}} |