Completed
Pull Request — master (#79)
by René
17:59
created

PropelMigration_1570542683::getUpSQL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
use Propel\Generator\Manager\MigrationManager;
4
5
/**
6
 * Data object containing the SQL and PHP code to migrate the database
7
 * up to version 1570542683.
8
 * Generated on 2019-10-08 13:51:23 by vagrant
9
 */
10
class PropelMigration_1570542683
11
{
12
    public $comment = '';
13
14
    public function preUp(MigrationManager $manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

14
    public function preUp(/** @scrutinizer ignore-unused */ MigrationManager $manager)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
15
    {
16
        // add the pre-migration code here
17
    }
18
19
    public function postUp(MigrationManager $manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
    public function postUp(/** @scrutinizer ignore-unused */ MigrationManager $manager)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
    {
21
        // add the post-migration code here
22
    }
23
24
    public function preDown(MigrationManager $manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function preDown(/** @scrutinizer ignore-unused */ MigrationManager $manager)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        // add the pre-migration code here
27
    }
28
29
    public function postDown(MigrationManager $manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function postDown(/** @scrutinizer ignore-unused */ MigrationManager $manager)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        // add the post-migration code here
32
    }
33
34
    /**
35
     * Get the SQL statements for the Up migration
36
     *
37
     * @return array list of the SQL strings to execute for the Up migration
38
     *               the keys being the datasources
39
     */
40
    public function getUpSQL()
41
    {
42
        return array (
43
  'zed' => '
44
BEGIN;
45
46
CREATE SEQUENCE "spy_acl_role_pk_seq";
47
48
CREATE TABLE "spy_acl_role"
49
(
50
    "id_acl_role" INTEGER NOT NULL,
51
    "name" VARCHAR(255) NOT NULL,
52
    "created_at" TIMESTAMP,
53
    "updated_at" TIMESTAMP,
54
    PRIMARY KEY ("id_acl_role"),
55
    CONSTRAINT "spy_acl_role-name" UNIQUE ("name")
56
);
57
58
CREATE SEQUENCE "spy_acl_rule_pk_seq";
59
60
CREATE TABLE "spy_acl_rule"
61
(
62
    "id_acl_rule" INTEGER NOT NULL,
63
    "fk_acl_role" INTEGER NOT NULL,
64
    "bundle" VARCHAR(45) NOT NULL,
65
    "controller" VARCHAR(45) NOT NULL,
66
    "action" VARCHAR(45) NOT NULL,
67
    "type" INT2 NOT NULL,
68
    "created_at" TIMESTAMP,
69
    "updated_at" TIMESTAMP,
70
    PRIMARY KEY ("id_acl_rule")
71
);
72
73
CREATE SEQUENCE "spy_acl_group_pk_seq";
74
75
CREATE TABLE "spy_acl_group"
76
(
77
    "id_acl_group" INTEGER NOT NULL,
78
    "name" VARCHAR(255) NOT NULL,
79
    "created_at" TIMESTAMP,
80
    "updated_at" TIMESTAMP,
81
    PRIMARY KEY ("id_acl_group"),
82
    CONSTRAINT "spy_acl_group-name" UNIQUE ("name")
83
);
84
85
CREATE TABLE "spy_acl_user_has_group"
86
(
87
    "fk_user" INTEGER NOT NULL,
88
    "fk_acl_group" INTEGER NOT NULL,
89
    PRIMARY KEY ("fk_user","fk_acl_group")
90
);
91
92
CREATE TABLE "spy_acl_groups_has_roles"
93
(
94
    "fk_acl_role" INTEGER NOT NULL,
95
    "fk_acl_group" INTEGER NOT NULL,
96
    PRIMARY KEY ("fk_acl_role","fk_acl_group")
97
);
98
99
CREATE SEQUENCE "spy_auth_reset_password_pk_seq";
100
101
CREATE TABLE "spy_auth_reset_password"
102
(
103
    "id_auth_reset_password" INTEGER NOT NULL,
104
    "fk_user" INTEGER NOT NULL,
105
    "code" VARCHAR(35) NOT NULL,
106
    "status" INT2 NOT NULL,
107
    "created_at" TIMESTAMP,
108
    "updated_at" TIMESTAMP,
109
    PRIMARY KEY ("id_auth_reset_password","fk_user"),
110
    CONSTRAINT "spy_auth_reset_password-code" UNIQUE ("code")
111
);
112
113
CREATE SEQUENCE "spy_availability_abstract_pk_seq";
114
115
CREATE TABLE "spy_availability_abstract"
116
(
117
    "id_availability_abstract" INTEGER NOT NULL,
118
    "fk_store" INTEGER,
119
    "abstract_sku" VARCHAR(255) NOT NULL,
120
    "quantity" INTEGER DEFAULT 0 NOT NULL,
121
    PRIMARY KEY ("id_availability_abstract"),
122
    CONSTRAINT "spy_availability_abstract-sku" UNIQUE ("abstract_sku","fk_store")
123
);
124
125
CREATE INDEX "index-spy_availability_abstract-fk_store" ON "spy_availability_abstract" ("fk_store");
126
127
CREATE SEQUENCE "spy_availability_pk_seq";
128
129
CREATE TABLE "spy_availability"
130
(
131
    "id_availability" INTEGER NOT NULL,
132
    "fk_availability_abstract" INTEGER NOT NULL,
133
    "fk_store" INTEGER,
134
    "is_never_out_of_stock" BOOLEAN DEFAULT \'f\',
135
    "quantity" INTEGER NOT NULL,
136
    "sku" VARCHAR(255) NOT NULL,
137
    PRIMARY KEY ("id_availability"),
138
    CONSTRAINT "spy_availability-sku" UNIQUE ("sku","fk_store")
139
);
140
141
CREATE INDEX "index-spy_availability-fk_availability_abstract" ON "spy_availability" ("fk_availability_abstract");
142
143
CREATE INDEX "index-spy_availability-fk_store" ON "spy_availability" ("fk_store");
144
145
CREATE SEQUENCE "spy_availability_storage_pk_seq";
146
147
CREATE TABLE "spy_availability_storage"
148
(
149
    "id_availability_storage" INT8 NOT NULL,
150
    "fk_product_abstract" INTEGER NOT NULL,
151
    "fk_availability_abstract" INTEGER NOT NULL,
152
    "data" TEXT,
153
    "store" VARCHAR(128),
154
    "key" VARCHAR,
155
    "created_at" TIMESTAMP,
156
    "updated_at" TIMESTAMP,
157
    PRIMARY KEY ("id_availability_storage"),
158
    CONSTRAINT "spy_availability_storage-unique-key" UNIQUE ("key")
159
);
160
161
CREATE INDEX "spy_availability_storage-fk_product_abstract" ON "spy_availability_storage" ("fk_product_abstract");
162
163
CREATE INDEX "spy_availability_storage-fk_availability_abstract" ON "spy_availability_storage" ("fk_availability_abstract");
164
165
CREATE SEQUENCE "id_availability_notification_subscription_pk_seq";
166
167
CREATE TABLE "spy_availability_notification_subscription"
168
(
169
    "id_availability_notification_subscription" INTEGER NOT NULL,
170
    "fk_locale" INTEGER NOT NULL,
171
    "fk_store" INTEGER NOT NULL,
172
    "customer_reference" VARCHAR(255),
173
    "email" VARCHAR(255) NOT NULL,
174
    "sku" VARCHAR(255) NOT NULL,
175
    "subscription_key" VARCHAR(150) NOT NULL,
176
    "created_at" TIMESTAMP,
177
    "updated_at" TIMESTAMP,
178
    PRIMARY KEY ("id_availability_notification_subscription"),
179
    CONSTRAINT "spy_availability_notification_subscription-sku-email-store" UNIQUE ("email","sku","fk_store"),
180
    CONSTRAINT "spy_availability_notification_subscription-unq-subscription_key" UNIQUE ("subscription_key")
181
);
182
183
CREATE INDEX "spy_availability_notification_subscription-subscription_key" ON "spy_availability_notification_subscription" ("subscription_key");
184
185
CREATE INDEX "spy_availability_notification_subscription-sku" ON "spy_availability_notification_subscription" ("email","sku","fk_store");
186
187
CREATE INDEX "index-spy_availability_notification_subscription-fk_locale" ON "spy_availability_notification_subscription" ("fk_locale");
188
189
CREATE SEQUENCE "spy_category_pk_seq";
190
191
CREATE TABLE "spy_category"
192
(
193
    "id_category" INTEGER NOT NULL,
194
    "fk_category_template" INTEGER,
195
    "category_key" VARCHAR(255) NOT NULL,
196
    "is_active" BOOLEAN DEFAULT \'t\',
197
    "is_clickable" BOOLEAN DEFAULT \'t\',
198
    "is_in_menu" BOOLEAN DEFAULT \'t\',
199
    "is_searchable" BOOLEAN DEFAULT \'t\',
200
    PRIMARY KEY ("id_category"),
201
    CONSTRAINT "spy_category-category_key" UNIQUE ("category_key")
202
);
203
204
CREATE INDEX "index-spy_category-fk_category_template" ON "spy_category" ("fk_category_template");
205
206
CREATE SEQUENCE "spy_category_attribute_pk_seq";
207
208
CREATE TABLE "spy_category_attribute"
209
(
210
    "id_category_attribute" INTEGER NOT NULL,
211
    "fk_category" INTEGER NOT NULL,
212
    "fk_locale" INTEGER NOT NULL,
213
    "category_image_name" VARCHAR(255),
214
    "meta_description" TEXT,
215
    "meta_keywords" TEXT,
216
    "meta_title" TEXT,
217
    "name" VARCHAR(255) NOT NULL,
218
    "created_at" TIMESTAMP,
219
    "updated_at" TIMESTAMP,
220
    PRIMARY KEY ("id_category_attribute")
221
);
222
223
CREATE INDEX "index-spy_category_attribute-fk_locale" ON "spy_category_attribute" ("fk_locale");
224
225
CREATE INDEX "index-spy_category_attribute-fk_category" ON "spy_category_attribute" ("fk_category");
226
227
CREATE SEQUENCE "spy_category_node_pk_seq";
228
229
CREATE TABLE "spy_category_node"
230
(
231
    "id_category_node" INTEGER NOT NULL,
232
    "fk_category" INTEGER NOT NULL,
233
    "fk_parent_category_node" INTEGER,
234
    "is_main" BOOLEAN DEFAULT \'f\',
235
    "is_root" BOOLEAN DEFAULT \'f\',
236
    "node_order" INTEGER DEFAULT 0,
237
    PRIMARY KEY ("id_category_node")
238
);
239
240
CREATE INDEX "spy_category_node_i_8f153e" ON "spy_category_node" ("node_order");
241
242
CREATE INDEX "index-spy_category_node-fk_parent_category_node" ON "spy_category_node" ("fk_parent_category_node");
243
244
CREATE INDEX "index-spy_category_node-fk_category" ON "spy_category_node" ("fk_category");
245
246
CREATE SEQUENCE "spy_category_closure_table_pk_seq";
247
248
CREATE TABLE "spy_category_closure_table"
249
(
250
    "id_category_closure_table" INTEGER NOT NULL,
251
    "fk_category_node" INTEGER NOT NULL,
252
    "fk_category_node_descendant" INTEGER NOT NULL,
253
    "depth" INTEGER NOT NULL,
254
    PRIMARY KEY ("id_category_closure_table")
255
);
256
257
CREATE INDEX "index-spy_category_closure_table-fk_category_node" ON "spy_category_closure_table" ("fk_category_node");
258
259
CREATE INDEX "index-spy_category_closure_table-fk_category_node_descendant" ON "spy_category_closure_table" ("fk_category_node_descendant");
260
261
CREATE SEQUENCE "spy_category_image_set_pk_seq";
262
263
CREATE TABLE "spy_category_image_set"
264
(
265
    "id_category_image_set" INTEGER NOT NULL,
266
    "fk_category" INTEGER,
267
    "fk_locale" INTEGER,
268
    "name" VARCHAR(255),
269
    "created_at" TIMESTAMP,
270
    "updated_at" TIMESTAMP,
271
    PRIMARY KEY ("id_category_image_set")
272
);
273
274
CREATE INDEX "spy_category_image_set-index-fk_category" ON "spy_category_image_set" ("fk_category");
275
276
CREATE INDEX "index-spy_category_image_set-fk_locale" ON "spy_category_image_set" ("fk_locale");
277
278
CREATE SEQUENCE "spy_category_image_pk_seq";
279
280
CREATE TABLE "spy_category_image"
281
(
282
    "id_category_image" INTEGER NOT NULL,
283
    "external_url_large" VARCHAR(2048),
284
    "external_url_small" VARCHAR(2048),
285
    "created_at" TIMESTAMP,
286
    "updated_at" TIMESTAMP,
287
    PRIMARY KEY ("id_category_image")
288
);
289
290
CREATE SEQUENCE "spy_category_image_set_to_category_image_pk_seq";
291
292
CREATE TABLE "spy_category_image_set_to_category_image"
293
(
294
    "id_category_image_set_to_category_image" INTEGER NOT NULL,
295
    "fk_category_image" INTEGER NOT NULL,
296
    "fk_category_image_set" INTEGER NOT NULL,
297
    "sort_order" INTEGER NOT NULL,
298
    PRIMARY KEY ("id_category_image_set_to_category_image"),
299
    CONSTRAINT "fk_category_image_set-fk_category_image" UNIQUE ("fk_category_image_set","fk_category_image")
300
);
301
302
CREATE INDEX "index-spy_category_image_set_to_category_image-fk_-85872f21dafe" ON "spy_category_image_set_to_category_image" ("fk_category_image_set");
303
304
CREATE INDEX "index-spy_category_image_set_to_category_image-fk_-7c0ba662126c" ON "spy_category_image_set_to_category_image" ("fk_category_image");
305
306
CREATE SEQUENCE "spy_category_image_storage_pk_seq";
307
308
CREATE TABLE "spy_category_image_storage"
309
(
310
    "id_category_image_storage" INT8 NOT NULL,
311
    "fk_category" INTEGER NOT NULL,
312
    "data" TEXT,
313
    "key" VARCHAR NOT NULL,
314
    "locale" VARCHAR NOT NULL,
315
    "created_at" TIMESTAMP,
316
    "updated_at" TIMESTAMP,
317
    PRIMARY KEY ("id_category_image_storage")
318
);
319
320
CREATE INDEX "spy_category_image_storage-fk_category" ON "spy_category_image_storage" ("fk_category");
321
322
CREATE SEQUENCE "spy_category_node_page_search_pk_seq";
323
324
CREATE TABLE "spy_category_node_page_search"
325
(
326
    "id_category_node_page_search" INT8 NOT NULL,
327
    "fk_category_node" INTEGER NOT NULL,
328
    "structured_data" TEXT NOT NULL,
329
    "data" TEXT,
330
    "locale" VARCHAR(16) NOT NULL,
331
    "key" VARCHAR,
332
    "created_at" TIMESTAMP,
333
    "updated_at" TIMESTAMP,
334
    PRIMARY KEY ("id_category_node_page_search"),
335
    CONSTRAINT "spy_category_node_page_search-unique-key" UNIQUE ("key")
336
);
337
338
CREATE INDEX "spy_category_node_page_search-fk_category_node" ON "spy_category_node_page_search" ("fk_category_node");
339
340
CREATE SEQUENCE "spy_category_tree_storage_pk_seq";
341
342
CREATE TABLE "spy_category_tree_storage"
343
(
344
    "id_category_tree_storage" INT8 NOT NULL,
345
    "data" TEXT,
346
    "locale" VARCHAR(16) NOT NULL,
347
    "key" VARCHAR,
348
    "created_at" TIMESTAMP,
349
    "updated_at" TIMESTAMP,
350
    PRIMARY KEY ("id_category_tree_storage"),
351
    CONSTRAINT "spy_category_tree_storage-unique-key" UNIQUE ("key")
352
);
353
354
CREATE SEQUENCE "spy_category_node_storage_pk_seq";
355
356
CREATE TABLE "spy_category_node_storage"
357
(
358
    "id_category_node_storage" INT8 NOT NULL,
359
    "fk_category_node" INTEGER NOT NULL,
360
    "data" TEXT,
361
    "locale" VARCHAR(16) NOT NULL,
362
    "key" VARCHAR,
363
    "created_at" TIMESTAMP,
364
    "updated_at" TIMESTAMP,
365
    PRIMARY KEY ("id_category_node_storage"),
366
    CONSTRAINT "spy_category_node_storage-unique-key" UNIQUE ("key")
367
);
368
369
CREATE INDEX "spy_category_node_storage-fk_category_node" ON "spy_category_node_storage" ("fk_category_node");
370
371
CREATE SEQUENCE "spy_category_template_pk_seq";
372
373
CREATE TABLE "spy_category_template"
374
(
375
    "id_category_template" INTEGER NOT NULL,
376
    "name" VARCHAR(255) NOT NULL,
377
    "template_path" VARCHAR(255) NOT NULL,
378
    PRIMARY KEY ("id_category_template"),
379
    CONSTRAINT "spy_category_template-template_path" UNIQUE ("template_path")
380
);
381
382
CREATE SEQUENCE "spy_cms_template_pk_seq";
383
384
CREATE TABLE "spy_cms_template"
385
(
386
    "id_cms_template" INTEGER NOT NULL,
387
    "template_name" VARCHAR(255) NOT NULL,
388
    "template_path" VARCHAR(255) NOT NULL,
389
    PRIMARY KEY ("id_cms_template"),
390
    CONSTRAINT "spy_cms_template-unique-template_path" UNIQUE ("template_path")
391
);
392
393
CREATE INDEX "spy_cms_template-template_path" ON "spy_cms_template" ("template_path");
394
395
CREATE SEQUENCE "spy_cms_page_pk_seq";
396
397
CREATE TABLE "spy_cms_page"
398
(
399
    "id_cms_page" INTEGER NOT NULL,
400
    "fk_template" INTEGER NOT NULL,
401
    "is_active" BOOLEAN DEFAULT \'f\' NOT NULL,
402
    "is_searchable" BOOLEAN DEFAULT \'f\' NOT NULL,
403
    "page_key" VARCHAR(32),
404
    "valid_from" TIMESTAMP,
405
    "valid_to" TIMESTAMP,
406
    PRIMARY KEY ("id_cms_page")
407
);
408
409
CREATE INDEX "spy_cms_page_i_615cb5" ON "spy_cms_page" ("page_key");
410
411
CREATE INDEX "index-spy_cms_page-fk_template" ON "spy_cms_page" ("fk_template");
412
413
CREATE SEQUENCE "spy_cms_page_localized_attributes_pk_seq";
414
415
CREATE TABLE "spy_cms_page_localized_attributes"
416
(
417
    "id_cms_page_localized_attributes" INTEGER NOT NULL,
418
    "fk_cms_page" INTEGER NOT NULL,
419
    "fk_locale" INTEGER NOT NULL,
420
    "meta_description" TEXT,
421
    "meta_keywords" TEXT,
422
    "meta_title" VARCHAR(255),
423
    "name" VARCHAR NOT NULL,
424
    "created_at" TIMESTAMP,
425
    "updated_at" TIMESTAMP,
426
    PRIMARY KEY ("id_cms_page_localized_attributes"),
427
    CONSTRAINT "spy_cms_page_localized_attributes-unique-fk_cms_page" UNIQUE ("fk_cms_page","fk_locale")
428
);
429
430
CREATE INDEX "index-spy_cms_page_localized_attributes-fk_cms_page" ON "spy_cms_page_localized_attributes" ("fk_cms_page");
431
432
CREATE INDEX "index-spy_cms_page_localized_attributes-fk_locale" ON "spy_cms_page_localized_attributes" ("fk_locale");
433
434
CREATE SEQUENCE "spy_cms_glossary_key_mapping_pk_seq";
435
436
CREATE TABLE "spy_cms_glossary_key_mapping"
437
(
438
    "id_cms_glossary_key_mapping" INTEGER NOT NULL,
439
    "fk_glossary_key" INTEGER NOT NULL,
440
    "fk_page" INTEGER NOT NULL,
441
    "placeholder" VARCHAR NOT NULL,
442
    PRIMARY KEY ("id_cms_glossary_key_mapping"),
443
    CONSTRAINT "spy_cms_glossary_key_mapping-unique-fk_page" UNIQUE ("fk_page","placeholder")
444
);
445
446
CREATE INDEX "spy_cms_glossary_key_mapping-fk_page" ON "spy_cms_glossary_key_mapping" ("fk_page","placeholder");
447
448
CREATE INDEX "index-spy_cms_glossary_key_mapping-fk_glossary_key" ON "spy_cms_glossary_key_mapping" ("fk_glossary_key");
449
450
CREATE SEQUENCE "spy_cms_version_pk_seq";
451
452
CREATE TABLE "spy_cms_version"
453
(
454
    "id_cms_version" INTEGER NOT NULL,
455
    "fk_cms_page" INTEGER NOT NULL,
456
    "fk_user" INTEGER,
457
    "data" TEXT,
458
    "version" INTEGER NOT NULL,
459
    "version_name" VARCHAR(255),
460
    "created_at" TIMESTAMP,
461
    "updated_at" TIMESTAMP,
462
    PRIMARY KEY ("id_cms_version")
463
);
464
465
CREATE INDEX "spy_cms_version-index-fk_cms_page_version" ON "spy_cms_version" ("fk_cms_page","version");
466
467
CREATE INDEX "index-spy_cms_version-fk_user" ON "spy_cms_version" ("fk_user");
468
469
CREATE SEQUENCE "id_cms_page_store_pk_seq";
470
471
CREATE TABLE "spy_cms_page_store"
472
(
473
    "id_cms_page_store" INTEGER NOT NULL,
474
    "fk_cms_page" INTEGER NOT NULL,
475
    "fk_store" INTEGER NOT NULL,
476
    PRIMARY KEY ("id_cms_page_store"),
477
    CONSTRAINT "spy_cms_page_store-fk_cms_page-fk_store" UNIQUE ("fk_cms_page","fk_store")
478
);
479
480
CREATE INDEX "index-spy_cms_page_store-fk_cms_page" ON "spy_cms_page_store" ("fk_cms_page");
481
482
CREATE INDEX "index-spy_cms_page_store-fk_store" ON "spy_cms_page_store" ("fk_store");
483
484
CREATE SEQUENCE "spy_cms_block_template_pk_seq";
485
486
CREATE TABLE "spy_cms_block_template"
487
(
488
    "id_cms_block_template" INTEGER NOT NULL,
489
    "template_name" VARCHAR(255) NOT NULL,
490
    "template_path" VARCHAR(255) NOT NULL,
491
    PRIMARY KEY ("id_cms_block_template"),
492
    CONSTRAINT "spy_cms_block_template-unique-template_path" UNIQUE ("template_path")
493
);
494
495
CREATE SEQUENCE "spy_cms_block_glossary_key_mapping_pk_seq";
496
497
CREATE TABLE "spy_cms_block_glossary_key_mapping"
498
(
499
    "id_cms_block_glossary_key_mapping" INTEGER NOT NULL,
500
    "fk_cms_block" INTEGER NOT NULL,
501
    "fk_glossary_key" INTEGER NOT NULL,
502
    "placeholder" VARCHAR NOT NULL,
503
    PRIMARY KEY ("id_cms_block_glossary_key_mapping"),
504
    CONSTRAINT "spy_cms_block_glossary_key_mapping-unique-fk_cms_block" UNIQUE ("fk_cms_block","placeholder")
505
);
506
507
CREATE INDEX "index-spy_cms_block_glossary_key_mapping-fk_cms_block" ON "spy_cms_block_glossary_key_mapping" ("fk_cms_block");
508
509
CREATE INDEX "index-spy_cms_block_glossary_key_mapping-fk_glossary_key" ON "spy_cms_block_glossary_key_mapping" ("fk_glossary_key");
510
511
CREATE SEQUENCE "spy_cms_block_pk_seq";
512
513
CREATE TABLE "spy_cms_block"
514
(
515
    "id_cms_block" INTEGER NOT NULL,
516
    "fk_page" INTEGER,
517
    "fk_template" INTEGER,
518
    "is_active" BOOLEAN DEFAULT \'f\' NOT NULL,
519
    "name" VARCHAR(255) NOT NULL,
520
    "type" VARCHAR(255),
521
    "valid_from" TIMESTAMP,
522
    "valid_to" TIMESTAMP,
523
    "value" INTEGER,
524
    PRIMARY KEY ("id_cms_block"),
525
    CONSTRAINT "spy_cms_block-name-uq" UNIQUE ("name")
526
);
527
528
COMMENT ON COLUMN "spy_cms_block"."fk_page" IS \'Deprecated\';
529
530
COMMENT ON COLUMN "spy_cms_block"."type" IS \'Deprecated\';
531
532
COMMENT ON COLUMN "spy_cms_block"."value" IS \'Deprecated\';
533
534
CREATE INDEX "index-spy_cms_block-fk_template" ON "spy_cms_block" ("fk_template");
535
536
CREATE SEQUENCE "id_cms_block_store_pk_seq";
537
538
CREATE TABLE "spy_cms_block_store"
539
(
540
    "id_cms_block_store" INTEGER NOT NULL,
541
    "fk_cms_block" INTEGER NOT NULL,
542
    "fk_store" INTEGER NOT NULL,
543
    PRIMARY KEY ("id_cms_block_store"),
544
    CONSTRAINT "spy_cms_block_store-fk_cms_block-fk_store" UNIQUE ("fk_cms_block","fk_store")
545
);
546
547
CREATE INDEX "index-spy_cms_block_store-fk_cms_block" ON "spy_cms_block_store" ("fk_cms_block");
548
549
CREATE INDEX "index-spy_cms_block_store-fk_store" ON "spy_cms_block_store" ("fk_store");
550
551
CREATE SEQUENCE "spy_cms_block_category_connector_pk_seq";
552
553
CREATE TABLE "spy_cms_block_category_connector"
554
(
555
    "id_cms_block_category_connector" INTEGER NOT NULL,
556
    "fk_category" INTEGER NOT NULL,
557
    "fk_category_template" INTEGER NOT NULL,
558
    "fk_cms_block" INTEGER NOT NULL,
559
    "fk_cms_block_category_position" INTEGER,
560
    PRIMARY KEY ("id_cms_block_category_connector")
561
);
562
563
CREATE INDEX "spy_cms_block_category-connector-fk_cms_block" ON "spy_cms_block_category_connector" ("fk_cms_block");
564
565
CREATE INDEX "spy_cms_block_category-connector-fk_category" ON "spy_cms_block_category_connector" ("fk_category");
566
567
CREATE INDEX "index-spy_cms_block_category_connector-fk_category_template" ON "spy_cms_block_category_connector" ("fk_category_template");
568
569
CREATE INDEX "index-spy_cms_block_category_connector-fk_cms_bloc-c9abf4e4f9b3" ON "spy_cms_block_category_connector" ("fk_cms_block_category_position");
570
571
CREATE SEQUENCE "spy_cms_block_category_position_pk_seq";
572
573
CREATE TABLE "spy_cms_block_category_position"
574
(
575
    "id_cms_block_category_position" INTEGER NOT NULL,
576
    "name" VARCHAR(255) NOT NULL,
577
    PRIMARY KEY ("id_cms_block_category_position")
578
);
579
580
CREATE SEQUENCE "spy_cms_block_category_storage_pk_seq";
581
582
CREATE TABLE "spy_cms_block_category_storage"
583
(
584
    "id_cms_block_category_storage" INT8 NOT NULL,
585
    "fk_category" INTEGER NOT NULL,
586
    "data" TEXT,
587
    "key" VARCHAR,
588
    "created_at" TIMESTAMP,
589
    "updated_at" TIMESTAMP,
590
    PRIMARY KEY ("id_cms_block_category_storage"),
591
    CONSTRAINT "spy_cms_block_category_storage-unique-key" UNIQUE ("key")
592
);
593
594
CREATE INDEX "spy_cms_block_category_storage-fk_category" ON "spy_cms_block_category_storage" ("fk_category");
595
596
CREATE SEQUENCE "spy_cms_block_product_connector_pk_seq";
597
598
CREATE TABLE "spy_cms_block_product_connector"
599
(
600
    "id_cms_block_product_connector" INTEGER NOT NULL,
601
    "fk_cms_block" INTEGER NOT NULL,
602
    "fk_product_abstract" INTEGER NOT NULL,
603
    PRIMARY KEY ("id_cms_block_product_connector")
604
);
605
606
CREATE INDEX "spy_cms_block_product_connector-fk_cms_block" ON "spy_cms_block_product_connector" ("fk_cms_block");
607
608
CREATE INDEX "spy_cms_block_product_connector-fk_product_abstract" ON "spy_cms_block_product_connector" ("fk_product_abstract");
609
610
CREATE SEQUENCE "spy_cms_block_product_storage_pk_seq";
611
612
CREATE TABLE "spy_cms_block_product_storage"
613
(
614
    "id_cms_block_product_storage" INT8 NOT NULL,
615
    "fk_product_abstract" INTEGER NOT NULL,
616
    "data" TEXT,
617
    "key" VARCHAR,
618
    "created_at" TIMESTAMP,
619
    "updated_at" TIMESTAMP,
620
    PRIMARY KEY ("id_cms_block_product_storage"),
621
    CONSTRAINT "spy_cms_block_product_storage-unique-key" UNIQUE ("key")
622
);
623
624
CREATE INDEX "spy_cms_block_product_storage-fk_product_abstract" ON "spy_cms_block_product_storage" ("fk_product_abstract");
625
626
CREATE SEQUENCE "spy_cms_block_storage_pk_seq";
627
628
CREATE TABLE "spy_cms_block_storage"
629
(
630
    "id_cms_block_storage" INT8 NOT NULL,
631
    "fk_cms_block" INTEGER NOT NULL,
632
    "name" VARCHAR NOT NULL,
633
    "data" TEXT,
634
    "store" VARCHAR(128),
635
    "locale" VARCHAR(16) NOT NULL,
636
    "key" VARCHAR,
637
    "created_at" TIMESTAMP,
638
    "updated_at" TIMESTAMP,
639
    PRIMARY KEY ("id_cms_block_storage"),
640
    CONSTRAINT "spy_cms_block_storage-unique-key" UNIQUE ("key")
641
);
642
643
CREATE INDEX "spy_cms_block_storage-fk_cms_block" ON "spy_cms_block_storage" ("fk_cms_block");
644
645
CREATE SEQUENCE "spy_cms_page_search_pk_seq";
646
647
CREATE TABLE "spy_cms_page_search"
648
(
649
    "id_cms_page_search" INT8 NOT NULL,
650
    "fk_cms_page" INTEGER NOT NULL,
651
    "structured_data" TEXT NOT NULL,
652
    "data" TEXT,
653
    "store" VARCHAR(128),
654
    "locale" VARCHAR(16) NOT NULL,
655
    "key" VARCHAR,
656
    "created_at" TIMESTAMP,
657
    "updated_at" TIMESTAMP,
658
    PRIMARY KEY ("id_cms_page_search"),
659
    CONSTRAINT "spy_cms_page_search-unique-key" UNIQUE ("key")
660
);
661
662
CREATE INDEX "spy_cms_page_search-fk_cms_page" ON "spy_cms_page_search" ("fk_cms_page");
663
664
CREATE SEQUENCE "spy_cms_page_storage_pk_seq";
665
666
CREATE TABLE "spy_cms_page_storage"
667
(
668
    "id_cms_page_storage" INT8 NOT NULL,
669
    "fk_cms_page" INTEGER NOT NULL,
670
    "data" TEXT,
671
    "store" VARCHAR(128),
672
    "locale" VARCHAR(16) NOT NULL,
673
    "key" VARCHAR,
674
    "created_at" TIMESTAMP,
675
    "updated_at" TIMESTAMP,
676
    PRIMARY KEY ("id_cms_page_storage"),
677
    CONSTRAINT "spy_cms_page_storage-unique-key" UNIQUE ("key")
678
);
679
680
CREATE INDEX "spy_cms_page_storage-fk_cms_page" ON "spy_cms_page_storage" ("fk_cms_page");
681
682
CREATE SEQUENCE "spy_content_pk_seq";
683
684
CREATE TABLE "spy_content"
685
(
686
    "id_content" INTEGER NOT NULL,
687
    "content_term_key" VARCHAR(255) NOT NULL,
688
    "content_type_key" VARCHAR(255) NOT NULL,
689
    "description" TEXT,
690
    "key" VARCHAR(255) NOT NULL,
691
    "name" VARCHAR(255) NOT NULL,
692
    "created_at" TIMESTAMP,
693
    "updated_at" TIMESTAMP,
694
    PRIMARY KEY ("id_content"),
695
    CONSTRAINT "spy_content-key" UNIQUE ("key")
696
);
697
698
COMMENT ON COLUMN "spy_content"."key" IS \'Identifier for existing entities. It should never be changed.\';
699
700
CREATE SEQUENCE "spy_content_localized_pk_seq";
701
702
CREATE TABLE "spy_content_localized"
703
(
704
    "id_content_localized" INTEGER NOT NULL,
705
    "fk_content" INTEGER NOT NULL,
706
    "fk_locale" INTEGER,
707
    "parameters" TEXT NOT NULL,
708
    "created_at" TIMESTAMP,
709
    "updated_at" TIMESTAMP,
710
    PRIMARY KEY ("id_content_localized"),
711
    CONSTRAINT "fk_content_unique_fk_locale_unique" UNIQUE ("fk_content","fk_locale")
712
);
713
714
CREATE INDEX "index-spy_content_localized-fk_content" ON "spy_content_localized" ("fk_content");
715
716
CREATE INDEX "index-spy_content_localized-fk_locale" ON "spy_content_localized" ("fk_locale");
717
718
CREATE SEQUENCE "spy_content_storage_pk_seq";
719
720
CREATE TABLE "spy_content_storage"
721
(
722
    "id_content_storage" INTEGER NOT NULL,
723
    "fk_content" INTEGER NOT NULL,
724
    "content_key" VARCHAR(255) NOT NULL,
725
    "data" TEXT,
726
    "locale" VARCHAR(16) NOT NULL,
727
    "key" VARCHAR,
728
    "created_at" TIMESTAMP,
729
    "updated_at" TIMESTAMP,
730
    PRIMARY KEY ("id_content_storage"),
731
    CONSTRAINT "spy_content_storage-unique-key" UNIQUE ("key")
732
);
733
734
CREATE INDEX "spy_content_storage-content_key" ON "spy_content_storage" ("content_key");
735
736
CREATE INDEX "spy_content_storage-fk_content" ON "spy_content_storage" ("fk_content");
737
738
CREATE SEQUENCE "spy_country_pk_seq";
739
740
CREATE TABLE "spy_country"
741
(
742
    "id_country" INTEGER NOT NULL,
743
    "iso2_code" VARCHAR(2) NOT NULL,
744
    "iso3_code" VARCHAR(3),
745
    "name" VARCHAR(255),
746
    "postal_code_mandatory" BOOLEAN DEFAULT \'f\',
747
    "postal_code_regex" VARCHAR(500),
748
    PRIMARY KEY ("id_country"),
749
    CONSTRAINT "spy_country-iso2_code" UNIQUE ("iso2_code"),
750
    CONSTRAINT "spy_country-iso3_code" UNIQUE ("iso3_code")
751
);
752
753
CREATE SEQUENCE "spy_region_pk_seq";
754
755
CREATE TABLE "spy_region"
756
(
757
    "id_region" INTEGER NOT NULL,
758
    "fk_country" INTEGER,
759
    "iso2_code" VARCHAR(6) NOT NULL,
760
    "name" VARCHAR(100) NOT NULL,
761
    PRIMARY KEY ("id_region"),
762
    CONSTRAINT "spy_region-iso2_code" UNIQUE ("iso2_code")
763
);
764
765
CREATE INDEX "index-spy_region-fk_country" ON "spy_region" ("fk_country");
766
767
CREATE SEQUENCE "spy_currency_pk_seq";
768
769
CREATE TABLE "spy_currency"
770
(
771
    "id_currency" INTEGER NOT NULL,
772
    "name" VARCHAR(255),
773
    "code" VARCHAR(5),
774
    "symbol" VARCHAR(255),
775
    PRIMARY KEY ("id_currency")
776
);
777
778
CREATE SEQUENCE "spy_customer_pk_seq";
779
780
CREATE TABLE "spy_customer"
781
(
782
    "id_customer" INTEGER NOT NULL,
783
    "fk_locale" INTEGER,
784
    "fk_user" INTEGER,
785
    "anonymized_at" TIMESTAMP,
786
    "company" VARCHAR(100),
787
    "customer_reference" VARCHAR(255) NOT NULL,
788
    "date_of_birth" DATE,
789
    "default_billing_address" INTEGER,
790
    "default_shipping_address" INTEGER,
791
    "email" VARCHAR(255) NOT NULL,
792
    "first_name" VARCHAR(100),
793
    "gender" INT2,
794
    "last_name" VARCHAR(100),
795
    "password" VARCHAR(255),
796
    "phone" VARCHAR(255),
797
    "registered" DATE,
798
    "registration_key" VARCHAR(150),
799
    "restore_password_date" TIMESTAMP,
800
    "restore_password_key" VARCHAR(150),
801
    "salutation" INT2,
802
    "created_at" TIMESTAMP,
803
    "updated_at" TIMESTAMP,
804
    PRIMARY KEY ("id_customer"),
805
    CONSTRAINT "spy_customer-email" UNIQUE ("email"),
806
    CONSTRAINT "spy_customer-customer_reference" UNIQUE ("customer_reference")
807
);
808
809
CREATE INDEX "index-spy_customer-default_billing_address" ON "spy_customer" ("default_billing_address");
810
811
CREATE INDEX "index-spy_customer-default_shipping_address" ON "spy_customer" ("default_shipping_address");
812
813
CREATE INDEX "index-spy_customer-fk_locale" ON "spy_customer" ("fk_locale");
814
815
CREATE INDEX "index-spy_customer-fk_user" ON "spy_customer" ("fk_user");
816
817
CREATE SEQUENCE "spy_customer_address_pk_seq";
818
819
CREATE TABLE "spy_customer_address"
820
(
821
    "id_customer_address" INTEGER NOT NULL,
822
    "fk_country" INTEGER NOT NULL,
823
    "fk_customer" INTEGER NOT NULL,
824
    "fk_region" INTEGER,
825
    "address1" VARCHAR(255),
826
    "address2" VARCHAR(255),
827
    "address3" VARCHAR(255),
828
    "anonymized_at" TIMESTAMP,
829
    "city" VARCHAR(255),
830
    "comment" VARCHAR(255),
831
    "company" VARCHAR(255),
832
    "deleted_at" TIMESTAMP,
833
    "first_name" VARCHAR(100) NOT NULL,
834
    "last_name" VARCHAR(100) NOT NULL,
835
    "phone" VARCHAR(255),
836
    "salutation" INT2,
837
    "uuid" VARCHAR(255),
838
    "zip_code" VARCHAR(15),
839
    "created_at" TIMESTAMP,
840
    "updated_at" TIMESTAMP,
841
    PRIMARY KEY ("id_customer_address"),
842
    CONSTRAINT "spy_customer_address-unique-uuid" UNIQUE ("uuid")
843
);
844
845
CREATE INDEX "spy_customer_address-fk_customer" ON "spy_customer_address" ("fk_customer");
846
847
CREATE INDEX "index-spy_customer_address-fk_region" ON "spy_customer_address" ("fk_region");
848
849
CREATE INDEX "index-spy_customer_address-fk_country" ON "spy_customer_address" ("fk_country");
850
851
CREATE SEQUENCE "spy_customer_group_pk_seq";
852
853
CREATE TABLE "spy_customer_group"
854
(
855
    "id_customer_group" INTEGER NOT NULL,
856
    "description" VARCHAR(255),
857
    "name" VARCHAR(70) NOT NULL,
858
    "created_at" TIMESTAMP,
859
    "updated_at" TIMESTAMP,
860
    PRIMARY KEY ("id_customer_group"),
861
    CONSTRAINT "spy_customer-name" UNIQUE ("name")
862
);
863
864
CREATE SEQUENCE "spy_customer_group_to_customer_pk_seq";
865
866
CREATE TABLE "spy_customer_group_to_customer"
867
(
868
    "id_customer_group_to_customer" INTEGER NOT NULL,
869
    "fk_customer" INTEGER NOT NULL,
870
    "fk_customer_group" INTEGER NOT NULL,
871
    "created_at" TIMESTAMP,
872
    "updated_at" TIMESTAMP,
873
    PRIMARY KEY ("id_customer_group_to_customer"),
874
    CONSTRAINT "fk_customer_group-fk_customer" UNIQUE ("fk_customer_group","fk_customer")
875
);
876
877
CREATE INDEX "index-spy_customer_group_to_customer-fk_customer_group" ON "spy_customer_group_to_customer" ("fk_customer_group");
878
879
CREATE INDEX "index-spy_customer_group_to_customer-fk_customer" ON "spy_customer_group_to_customer" ("fk_customer");
880
881
CREATE SEQUENCE "spy_customer_note_pk_seq";
882
883
CREATE TABLE "spy_customer_note"
884
(
885
    "id_customer_note" INTEGER NOT NULL,
886
    "fk_customer" INTEGER NOT NULL,
887
    "fk_user" INTEGER NOT NULL,
888
    "created_at" TIMESTAMP,
889
    "message" TEXT NOT NULL,
890
    "updated_at" TIMESTAMP,
891
    "username" VARCHAR,
892
    PRIMARY KEY ("id_customer_note")
893
);
894
895
CREATE INDEX "index-spy_customer_note-fk_customer" ON "spy_customer_note" ("fk_customer");
896
897
CREATE INDEX "index-spy_customer_note-fk_user" ON "spy_customer_note" ("fk_user");
898
899
CREATE SEQUENCE "spy_discount_pk_seq";
900
901
CREATE TABLE "spy_discount"
902
(
903
    "id_discount" INTEGER NOT NULL,
904
    "fk_discount_voucher_pool" INTEGER,
905
    "fk_store" INTEGER,
906
    "amount" INTEGER NOT NULL,
907
    "calculator_plugin" VARCHAR(255),
908
    "collector_query_string" VARCHAR,
909
    "decision_rule_query_string" VARCHAR,
910
    "description" VARCHAR(1024),
911
    "discount_key" VARCHAR(32),
912
    "discount_type" VARCHAR(255),
913
    "display_name" VARCHAR(255) NOT NULL,
914
    "is_active" BOOLEAN DEFAULT \'f\',
915
    "is_exclusive" BOOLEAN DEFAULT \'f\',
916
    "minimum_item_amount" INTEGER DEFAULT 1 NOT NULL,
917
    "valid_from" TIMESTAMP,
918
    "valid_to" TIMESTAMP,
919
    "created_at" TIMESTAMP,
920
    "updated_at" TIMESTAMP,
921
    PRIMARY KEY ("id_discount"),
922
    CONSTRAINT "spy_discount-unique-fk_discount_voucher_pool" UNIQUE ("fk_discount_voucher_pool"),
923
    CONSTRAINT "spy_discount-unique-display_name" UNIQUE ("display_name")
924
);
925
926
CREATE INDEX "spy_discount-index-discount_type" ON "spy_discount" ("discount_type");
927
928
CREATE INDEX "spy_discount_i_862ce6" ON "spy_discount" ("discount_key");
929
930
CREATE INDEX "index-spy_discount-fk_discount_voucher_pool" ON "spy_discount" ("fk_discount_voucher_pool");
931
932
CREATE INDEX "index-spy_discount-fk_store" ON "spy_discount" ("fk_store");
933
934
CREATE SEQUENCE "id_discount_store_pk_seq";
935
936
CREATE TABLE "spy_discount_store"
937
(
938
    "id_discount_store" INTEGER NOT NULL,
939
    "fk_discount" INTEGER NOT NULL,
940
    "fk_store" INTEGER NOT NULL,
941
    PRIMARY KEY ("id_discount_store"),
942
    CONSTRAINT "spy_discount_store-fk_discount-fk_store" UNIQUE ("fk_discount","fk_store")
943
);
944
945
CREATE INDEX "index-spy_discount_store-fk_discount" ON "spy_discount_store" ("fk_discount");
946
947
CREATE INDEX "index-spy_discount_store-fk_store" ON "spy_discount_store" ("fk_store");
948
949
CREATE SEQUENCE "spy_discount_voucher_pool_pk_seq";
950
951
CREATE TABLE "spy_discount_voucher_pool"
952
(
953
    "id_discount_voucher_pool" INTEGER NOT NULL,
954
    "is_active" BOOLEAN DEFAULT \'f\',
955
    "name" VARCHAR(255) NOT NULL,
956
    "created_at" TIMESTAMP,
957
    "updated_at" TIMESTAMP,
958
    PRIMARY KEY ("id_discount_voucher_pool")
959
);
960
961
CREATE SEQUENCE "spy_discount_voucher_pk_seq";
962
963
CREATE TABLE "spy_discount_voucher"
964
(
965
    "id_discount_voucher" INTEGER NOT NULL,
966
    "fk_discount_voucher_pool" INTEGER,
967
    "code" VARCHAR(255) NOT NULL,
968
    "is_active" BOOLEAN DEFAULT \'f\',
969
    "max_number_of_uses" INTEGER,
970
    "number_of_uses" INTEGER,
971
    "voucher_batch" INTEGER DEFAULT 0,
972
    "created_at" TIMESTAMP,
973
    "updated_at" TIMESTAMP,
974
    PRIMARY KEY ("id_discount_voucher"),
975
    CONSTRAINT "spy_discount_voucher-code" UNIQUE ("code")
976
);
977
978
CREATE INDEX "index-spy_discount_voucher-fk_discount_voucher_pool" ON "spy_discount_voucher" ("fk_discount_voucher_pool");
979
980
CREATE SEQUENCE "spy_discount_amount_pk_seq";
981
982
CREATE TABLE "spy_discount_amount"
983
(
984
    "id_discount_amount" INTEGER NOT NULL,
985
    "fk_currency" INTEGER NOT NULL,
986
    "fk_discount" INTEGER NOT NULL,
987
    "gross_amount" INTEGER,
988
    "net_amount" INTEGER,
989
    PRIMARY KEY ("id_discount_amount"),
990
    CONSTRAINT "spy_discount_amount-unique-currency-discount" UNIQUE ("fk_currency","fk_discount")
991
);
992
993
CREATE INDEX "index-spy_discount_amount-fk_currency" ON "spy_discount_amount" ("fk_currency");
994
995
CREATE INDEX "index-spy_discount_amount-fk_discount" ON "spy_discount_amount" ("fk_discount");
996
997
CREATE SEQUENCE "spy_discount_promotion_pk_seq";
998
999
CREATE TABLE "spy_discount_promotion"
1000
(
1001
    "id_discount_promotion" INTEGER NOT NULL,
1002
    "fk_discount" INTEGER NOT NULL,
1003
    "abstract_sku" VARCHAR(255) NOT NULL,
1004
    "quantity" INTEGER NOT NULL,
1005
    PRIMARY KEY ("id_discount_promotion")
1006
);
1007
1008
CREATE INDEX "index-spy_discount_promotion-fk_discount" ON "spy_discount_promotion" ("fk_discount");
1009
1010
CREATE SEQUENCE "spy_event_behavior_entity_change_pk_seq";
1011
1012
CREATE TABLE "spy_event_behavior_entity_change"
1013
(
1014
    "id_event_behavior_entity_change" INT8 NOT NULL,
1015
    "data" TEXT,
1016
    "process_id" VARCHAR,
1017
    "created_at" TIMESTAMP,
1018
    PRIMARY KEY ("id_event_behavior_entity_change")
1019
);
1020
1021
CREATE SEQUENCE "pyz_example_state_machine_item_pk_seq";
1022
1023
CREATE TABLE "pyz_example_state_machine_item"
1024
(
1025
    "id_example_state_machine_item" INTEGER NOT NULL,
1026
    "fk_state_machine_item_state" INTEGER,
1027
    "name" VARCHAR,
1028
    PRIMARY KEY ("id_example_state_machine_item")
1029
);
1030
1031
CREATE INDEX "index-pyz_example_state_machine_item-fk_state_mach-bdf22e713652" ON "pyz_example_state_machine_item" ("fk_state_machine_item_state");
1032
1033
CREATE SEQUENCE "spy_file_pk_seq";
1034
1035
CREATE TABLE "spy_file"
1036
(
1037
    "id_file" INTEGER NOT NULL,
1038
    "fk_file_directory" INTEGER,
1039
    "file_name" VARCHAR(500) NOT NULL,
1040
    PRIMARY KEY ("id_file")
1041
);
1042
1043
CREATE INDEX "index-spy_file-fk_file_directory" ON "spy_file" ("fk_file_directory");
1044
1045
CREATE SEQUENCE "spy_file_info_pk_seq";
1046
1047
CREATE TABLE "spy_file_info"
1048
(
1049
    "id_file_info" INTEGER NOT NULL,
1050
    "fk_file" INTEGER NOT NULL,
1051
    "extension" VARCHAR(255) NOT NULL,
1052
    "size" INTEGER NOT NULL,
1053
    "storage_file_name" VARCHAR(255),
1054
    "storage_name" VARCHAR(255),
1055
    "type" VARCHAR(255) NOT NULL,
1056
    "version" INTEGER NOT NULL,
1057
    "version_name" VARCHAR(255) NOT NULL,
1058
    "created_at" TIMESTAMP,
1059
    "updated_at" TIMESTAMP,
1060
    PRIMARY KEY ("id_file_info")
1061
);
1062
1063
CREATE INDEX "index-spy_file_info-fk_file" ON "spy_file_info" ("fk_file");
1064
1065
CREATE SEQUENCE "spy_file_localized_attributes_pk_seq";
1066
1067
CREATE TABLE "spy_file_localized_attributes"
1068
(
1069
    "id_file_localized_attributes" INTEGER NOT NULL,
1070
    "fk_file" INTEGER NOT NULL,
1071
    "fk_locale" INTEGER NOT NULL,
1072
    "alt" TEXT,
1073
    "title" VARCHAR(255),
1074
    PRIMARY KEY ("id_file_localized_attributes"),
1075
    CONSTRAINT "spy_file_localized_attributes-unique-fk_file" UNIQUE ("fk_file","fk_locale")
1076
);
1077
1078
CREATE INDEX "index-spy_file_localized_attributes-fk_file" ON "spy_file_localized_attributes" ("fk_file");
1079
1080
CREATE INDEX "index-spy_file_localized_attributes-fk_locale" ON "spy_file_localized_attributes" ("fk_locale");
1081
1082
CREATE SEQUENCE "spy_file_directory_pk_seq";
1083
1084
CREATE TABLE "spy_file_directory"
1085
(
1086
    "id_file_directory" INTEGER NOT NULL,
1087
    "fk_parent_file_directory" INTEGER,
1088
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1089
    "name" VARCHAR(255) NOT NULL,
1090
    "position" INTEGER,
1091
    PRIMARY KEY ("id_file_directory")
1092
);
1093
1094
CREATE INDEX "spy_file_directory_i_ba7161" ON "spy_file_directory" ("position");
1095
1096
CREATE INDEX "index-spy_file_directory-fk_parent_file_directory" ON "spy_file_directory" ("fk_parent_file_directory");
1097
1098
CREATE SEQUENCE "spy_file_directory_localized_attributes_pk_seq";
1099
1100
CREATE TABLE "spy_file_directory_localized_attributes"
1101
(
1102
    "id_file_directory_localized_attributes" INTEGER NOT NULL,
1103
    "fk_file_directory" INTEGER NOT NULL,
1104
    "fk_locale" INTEGER NOT NULL,
1105
    "title" VARCHAR(255) NOT NULL,
1106
    "created_at" TIMESTAMP,
1107
    "updated_at" TIMESTAMP,
1108
    PRIMARY KEY ("id_file_directory_localized_attributes"),
1109
    CONSTRAINT "spy_file_directory_localized_attributes-unique-fk_fd-fk_locale" UNIQUE ("fk_file_directory","fk_locale")
1110
);
1111
1112
CREATE INDEX "index-spy_file_directory_localized_attributes-fk_file_directory" ON "spy_file_directory_localized_attributes" ("fk_file_directory");
1113
1114
CREATE INDEX "index-spy_file_directory_localized_attributes-fk_locale" ON "spy_file_directory_localized_attributes" ("fk_locale");
1115
1116
CREATE SEQUENCE "spy_mime_type_pk_seq";
1117
1118
CREATE TABLE "spy_mime_type"
1119
(
1120
    "id_mime_type" INTEGER NOT NULL,
1121
    "comment" VARCHAR(255),
1122
    "is_allowed" BOOLEAN NOT NULL,
1123
    "name" VARCHAR(255) NOT NULL,
1124
    PRIMARY KEY ("id_mime_type"),
1125
    CONSTRAINT "spy_mime_type-name" UNIQUE ("name")
1126
);
1127
1128
CREATE SEQUENCE "spy_file_storage_pk_seq";
1129
1130
CREATE TABLE "spy_file_storage"
1131
(
1132
    "id_file_storage" INTEGER NOT NULL,
1133
    "fk_file" INTEGER,
1134
    "file_name" VARCHAR,
1135
    "data" TEXT,
1136
    "locale" VARCHAR(16) NOT NULL,
1137
    "key" VARCHAR,
1138
    PRIMARY KEY ("id_file_storage"),
1139
    CONSTRAINT "spy_file_storage-unique-key" UNIQUE ("key")
1140
);
1141
1142
CREATE INDEX "spy_file_storage-fk_file" ON "spy_file_storage" ("fk_file");
1143
1144
CREATE SEQUENCE "spy_gift_card_pk_seq";
1145
1146
CREATE TABLE "spy_gift_card"
1147
(
1148
    "id_gift_card" INTEGER NOT NULL,
1149
    "attributes" TEXT,
1150
    "code" VARCHAR(40) NOT NULL,
1151
    "currency_iso_code" VARCHAR(5),
1152
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1153
    "name" VARCHAR(40) NOT NULL,
1154
    "replacement_pattern" VARCHAR(40),
1155
    "value" INTEGER NOT NULL,
1156
    "created_at" TIMESTAMP,
1157
    "updated_at" TIMESTAMP,
1158
    PRIMARY KEY ("id_gift_card")
1159
);
1160
1161
CREATE SEQUENCE "spy_gift_card_product_abstract_configuration_pk_seq";
1162
1163
CREATE TABLE "spy_gift_card_product_abstract_configuration"
1164
(
1165
    "id_gift_card_product_abstract_configuration" INTEGER NOT NULL,
1166
    "code_pattern" VARCHAR(40) NOT NULL,
1167
    "created_at" TIMESTAMP,
1168
    "updated_at" TIMESTAMP,
1169
    PRIMARY KEY ("id_gift_card_product_abstract_configuration")
1170
);
1171
1172
CREATE SEQUENCE "spy_gift_card_product_abstract_configuration_link_pk_seq";
1173
1174
CREATE TABLE "spy_gift_card_product_abstract_configuration_link"
1175
(
1176
    "id_gift_card_product_abstract_configuration_link" INTEGER NOT NULL,
1177
    "fk_gift_card_product_abstract_configuration" INTEGER NOT NULL,
1178
    "fk_product_abstract" INTEGER NOT NULL,
1179
    PRIMARY KEY ("id_gift_card_product_abstract_configuration_link")
1180
);
1181
1182
CREATE INDEX "index-spy_gift_card_product_abstract_configuration-ea801cb20841" ON "spy_gift_card_product_abstract_configuration_link" ("fk_product_abstract");
1183
1184
CREATE INDEX "index-spy_gift_card_product_abstract_configuration-5c47cd7f57d8" ON "spy_gift_card_product_abstract_configuration_link" ("fk_gift_card_product_abstract_configuration");
1185
1186
CREATE SEQUENCE "spy_gift_card_product_configuration_pk_seq";
1187
1188
CREATE TABLE "spy_gift_card_product_configuration"
1189
(
1190
    "id_gift_card_product_configuration" INTEGER NOT NULL,
1191
    "value" INTEGER NOT NULL,
1192
    "created_at" TIMESTAMP,
1193
    "updated_at" TIMESTAMP,
1194
    PRIMARY KEY ("id_gift_card_product_configuration")
1195
);
1196
1197
CREATE SEQUENCE "spy_gift_card_product_configuration_link_pk_seq";
1198
1199
CREATE TABLE "spy_gift_card_product_configuration_link"
1200
(
1201
    "id_gift_card_product_configuration_link" INTEGER NOT NULL,
1202
    "fk_gift_card_product_configuration" INTEGER NOT NULL,
1203
    "fk_product" INTEGER NOT NULL,
1204
    PRIMARY KEY ("id_gift_card_product_configuration_link")
1205
);
1206
1207
CREATE INDEX "index-spy_gift_card_product_configuration_link-fk_product" ON "spy_gift_card_product_configuration_link" ("fk_product");
1208
1209
CREATE INDEX "index-spy_gift_card_product_configuration_link-fk_-b6cecefc1da0" ON "spy_gift_card_product_configuration_link" ("fk_gift_card_product_configuration");
1210
1211
CREATE SEQUENCE "spy_payment_gift_card_pk_seq";
1212
1213
CREATE TABLE "spy_payment_gift_card"
1214
(
1215
    "id_payment_gift_card" INTEGER NOT NULL,
1216
    "fk_sales_payment" INTEGER NOT NULL,
1217
    "code" VARCHAR(255) NOT NULL,
1218
    "created_at" TIMESTAMP,
1219
    PRIMARY KEY ("id_payment_gift_card")
1220
);
1221
1222
CREATE INDEX "index-spy_payment_gift_card-fk_sales_payment" ON "spy_payment_gift_card" ("fk_sales_payment");
1223
1224
CREATE SEQUENCE "spy_gift_card_balance_log_pk_seq";
1225
1226
CREATE TABLE "spy_gift_card_balance_log"
1227
(
1228
    "id_gift_card_balance_log" INTEGER NOT NULL,
1229
    "fk_gift_card" INTEGER NOT NULL,
1230
    "fk_sales_order" INTEGER NOT NULL,
1231
    "value" INTEGER NOT NULL,
1232
    "created_at" TIMESTAMP NOT NULL,
1233
    PRIMARY KEY ("id_gift_card_balance_log")
1234
);
1235
1236
CREATE INDEX "spy_gift_card_balance_log_i_f56346" ON "spy_gift_card_balance_log" ("fk_gift_card","created_at","fk_sales_order","value");
1237
1238
CREATE SEQUENCE "spy_glossary_key_pk_seq";
1239
1240
CREATE TABLE "spy_glossary_key"
1241
(
1242
    "id_glossary_key" INTEGER NOT NULL,
1243
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1244
    "key" VARCHAR(255) NOT NULL,
1245
    PRIMARY KEY ("id_glossary_key"),
1246
    CONSTRAINT "spy_glossary_key-unique-key" UNIQUE ("key")
1247
);
1248
1249
CREATE INDEX "spy_glossary_key-index-key" ON "spy_glossary_key" ("key");
1250
1251
CREATE INDEX "spy_glossary_key-is_active" ON "spy_glossary_key" ("is_active");
1252
1253
CREATE SEQUENCE "spy_glossary_translation_pk_seq";
1254
1255
CREATE TABLE "spy_glossary_translation"
1256
(
1257
    "id_glossary_translation" INTEGER NOT NULL,
1258
    "fk_glossary_key" INTEGER NOT NULL,
1259
    "fk_locale" INTEGER NOT NULL,
1260
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1261
    "value" TEXT NOT NULL,
1262
    PRIMARY KEY ("id_glossary_translation"),
1263
    CONSTRAINT "spy_glossary_translation-unique-fk_glossary_key" UNIQUE ("fk_glossary_key","fk_locale")
1264
);
1265
1266
CREATE INDEX "spy_glossary_translation-index-fk_locale" ON "spy_glossary_translation" ("fk_locale");
1267
1268
CREATE INDEX "spy_glossary_translation-is_active" ON "spy_glossary_translation" ("is_active");
1269
1270
CREATE INDEX "index-spy_glossary_translation-fk_glossary_key" ON "spy_glossary_translation" ("fk_glossary_key");
1271
1272
CREATE SEQUENCE "spy_glossary_storage_pk_seq";
1273
1274
CREATE TABLE "spy_glossary_storage"
1275
(
1276
    "id_glossary_storage" INT8 NOT NULL,
1277
    "fk_glossary_key" INTEGER NOT NULL,
1278
    "glossary_key" VARCHAR NOT NULL,
1279
    "data" TEXT,
1280
    "locale" VARCHAR(16) NOT NULL,
1281
    "key" VARCHAR,
1282
    "created_at" TIMESTAMP,
1283
    "updated_at" TIMESTAMP,
1284
    PRIMARY KEY ("id_glossary_storage"),
1285
    CONSTRAINT "spy_glossary_storage-unique-key" UNIQUE ("key")
1286
);
1287
1288
CREATE INDEX "spy_glossary_storage-fk_glossary_key" ON "spy_glossary_storage" ("fk_glossary_key");
1289
1290
CREATE SEQUENCE "spy_locale_pk_seq";
1291
1292
CREATE TABLE "spy_locale"
1293
(
1294
    "id_locale" INTEGER NOT NULL,
1295
    "locale_name" VARCHAR(5) NOT NULL,
1296
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1297
    PRIMARY KEY ("id_locale"),
1298
    CONSTRAINT "spy_locale-unique-locale_name" UNIQUE ("locale_name")
1299
);
1300
1301
CREATE INDEX "spy_locale-index-locale_name" ON "spy_locale" ("locale_name");
1302
1303
CREATE SEQUENCE "spy_navigation_pk_seq";
1304
1305
CREATE TABLE "spy_navigation"
1306
(
1307
    "id_navigation" INTEGER NOT NULL,
1308
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1309
    "key" VARCHAR(255) NOT NULL,
1310
    "name" VARCHAR(255) NOT NULL,
1311
    "created_at" TIMESTAMP,
1312
    "updated_at" TIMESTAMP,
1313
    PRIMARY KEY ("id_navigation"),
1314
    CONSTRAINT "spy_navigation_key-unique-key" UNIQUE ("key")
1315
);
1316
1317
CREATE INDEX "spy_navigation-index-key" ON "spy_navigation" ("key");
1318
1319
CREATE INDEX "spy_navigation-index-is_active" ON "spy_navigation" ("is_active");
1320
1321
CREATE SEQUENCE "spy_navigation_node_pk_seq";
1322
1323
CREATE TABLE "spy_navigation_node"
1324
(
1325
    "id_navigation_node" INTEGER NOT NULL,
1326
    "fk_navigation" INTEGER NOT NULL,
1327
    "fk_parent_navigation_node" INTEGER,
1328
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1329
    "node_key" VARCHAR(32),
1330
    "node_type" VARCHAR(255),
1331
    "position" INTEGER,
1332
    "valid_from" TIMESTAMP,
1333
    "valid_to" TIMESTAMP,
1334
    PRIMARY KEY ("id_navigation_node")
1335
);
1336
1337
CREATE INDEX "spy_navigation_node_i_ba7161" ON "spy_navigation_node" ("position");
1338
1339
CREATE INDEX "spy_navigation_node_i_576b1b" ON "spy_navigation_node" ("node_key");
1340
1341
CREATE INDEX "index-spy_navigation_node-fk_parent_navigation_node" ON "spy_navigation_node" ("fk_parent_navigation_node");
1342
1343
CREATE INDEX "index-spy_navigation_node-fk_navigation" ON "spy_navigation_node" ("fk_navigation");
1344
1345
CREATE SEQUENCE "spy_navigation_node_localized_attributes_pk_seq";
1346
1347
CREATE TABLE "spy_navigation_node_localized_attributes"
1348
(
1349
    "id_navigation_node_localized_attributes" INTEGER NOT NULL,
1350
    "fk_locale" INTEGER NOT NULL,
1351
    "fk_navigation_node" INTEGER NOT NULL,
1352
    "fk_url" INTEGER,
1353
    "css_class" VARCHAR(255),
1354
    "external_url" VARCHAR(255),
1355
    "link" VARCHAR(255),
1356
    "title" VARCHAR(255) NOT NULL,
1357
    "created_at" TIMESTAMP,
1358
    "updated_at" TIMESTAMP,
1359
    PRIMARY KEY ("id_navigation_node_localized_attributes")
1360
);
1361
1362
CREATE INDEX "index-spy_navigation_node_localized_attributes-fk_-4f569df99f9b" ON "spy_navigation_node_localized_attributes" ("fk_navigation_node");
1363
1364
CREATE INDEX "index-spy_navigation_node_localized_attributes-fk_locale" ON "spy_navigation_node_localized_attributes" ("fk_locale");
1365
1366
CREATE INDEX "index-spy_navigation_node_localized_attributes-fk_url" ON "spy_navigation_node_localized_attributes" ("fk_url");
1367
1368
CREATE SEQUENCE "spy_navigation_storage_pk_seq";
1369
1370
CREATE TABLE "spy_navigation_storage"
1371
(
1372
    "id_navigation_storage" INT8 NOT NULL,
1373
    "fk_navigation" INTEGER NOT NULL,
1374
    "navigation_key" VARCHAR NOT NULL,
1375
    "data" TEXT,
1376
    "locale" VARCHAR(16) NOT NULL,
1377
    "key" VARCHAR,
1378
    "created_at" TIMESTAMP,
1379
    "updated_at" TIMESTAMP,
1380
    PRIMARY KEY ("id_navigation_storage"),
1381
    CONSTRAINT "spy_navigation_storage-unique-key" UNIQUE ("key")
1382
);
1383
1384
CREATE INDEX "spy_navigation_storage-fk_navigation" ON "spy_navigation_storage" ("fk_navigation");
1385
1386
CREATE SEQUENCE "spy_newsletter_subscriber_pk_seq";
1387
1388
CREATE TABLE "spy_newsletter_subscriber"
1389
(
1390
    "id_newsletter_subscriber" INTEGER NOT NULL,
1391
    "fk_customer" INTEGER,
1392
    "email" VARCHAR(255) NOT NULL,
1393
    "is_confirmed" BOOLEAN DEFAULT \'f\' NOT NULL,
1394
    "subscriber_key" VARCHAR(150),
1395
    "created_at" TIMESTAMP,
1396
    "updated_at" TIMESTAMP,
1397
    PRIMARY KEY ("id_newsletter_subscriber"),
1398
    CONSTRAINT "spy_newsletter_subscriber-unique-email" UNIQUE ("email"),
1399
    CONSTRAINT "spy_newsletter_subscriber-unique-subscriber_key" UNIQUE ("subscriber_key")
1400
);
1401
1402
CREATE INDEX "spy_newsletter_subscriber-index-email" ON "spy_newsletter_subscriber" ("email");
1403
1404
CREATE INDEX "spy_newsletter_subscriber-index-subscriber_key" ON "spy_newsletter_subscriber" ("subscriber_key");
1405
1406
CREATE INDEX "index-spy_newsletter_subscriber-fk_customer" ON "spy_newsletter_subscriber" ("fk_customer");
1407
1408
CREATE SEQUENCE "spy_newsletter_type_pk_seq";
1409
1410
CREATE TABLE "spy_newsletter_type"
1411
(
1412
    "id_newsletter_type" INTEGER NOT NULL,
1413
    "name" VARCHAR(255) NOT NULL,
1414
    "created_at" TIMESTAMP,
1415
    "updated_at" TIMESTAMP,
1416
    PRIMARY KEY ("id_newsletter_type"),
1417
    CONSTRAINT "spy_newsletter_type-unique-name" UNIQUE ("name")
1418
);
1419
1420
CREATE INDEX "spy_newsletter_type-index-name" ON "spy_newsletter_type" ("name");
1421
1422
CREATE TABLE "spy_newsletter_subscription"
1423
(
1424
    "fk_newsletter_subscriber" INTEGER NOT NULL,
1425
    "fk_newsletter_type" INTEGER NOT NULL,
1426
    "created_at" TIMESTAMP,
1427
    "updated_at" TIMESTAMP,
1428
    PRIMARY KEY ("fk_newsletter_subscriber","fk_newsletter_type")
1429
);
1430
1431
CREATE SEQUENCE "spy_nopayment_paid_pk_seq";
1432
1433
CREATE TABLE "spy_nopayment_paid"
1434
(
1435
    "id_nopayment_paid" INTEGER NOT NULL,
1436
    "fk_sales_order_item" INTEGER NOT NULL,
1437
    "created_at" TIMESTAMP,
1438
    "updated_at" TIMESTAMP,
1439
    PRIMARY KEY ("id_nopayment_paid")
1440
);
1441
1442
CREATE INDEX "index-spy_nopayment_paid-fk_sales_order_item" ON "spy_nopayment_paid" ("fk_sales_order_item");
1443
1444
CREATE SEQUENCE "spy_oauth_access_token_pk_seq";
1445
1446
CREATE TABLE "spy_oauth_access_token"
1447
(
1448
    "id_oauth_access_token" INTEGER NOT NULL,
1449
    "fk_oauth_client" VARCHAR(1024) NOT NULL,
1450
    "expirity_date" TIMESTAMP NOT NULL,
1451
    "identifier" VARCHAR(3024) NOT NULL,
1452
    "scopes" VARCHAR(1024),
1453
    "user_identifier" VARCHAR(1024) NOT NULL,
1454
    "created_at" TIMESTAMP,
1455
    "updated_at" TIMESTAMP,
1456
    PRIMARY KEY ("id_oauth_access_token")
1457
);
1458
1459
CREATE INDEX "index-spy_oauth_access_token-fk_oauth_client" ON "spy_oauth_access_token" ("fk_oauth_client");
1460
1461
CREATE SEQUENCE "spy_oauth_client_pk_seq";
1462
1463
CREATE TABLE "spy_oauth_client"
1464
(
1465
    "id_oauth_client" INTEGER NOT NULL,
1466
    "identifier" VARCHAR(1024) NOT NULL,
1467
    "is_confidential" BOOLEAN,
1468
    "name" VARCHAR(1024) NOT NULL,
1469
    "redirect_uri" VARCHAR(1024),
1470
    "secret" VARCHAR(1024),
1471
    PRIMARY KEY ("id_oauth_client"),
1472
    CONSTRAINT "spy_oauth_client-identifier" UNIQUE ("identifier")
1473
);
1474
1475
CREATE SEQUENCE "spy_oauth_scope_pk_seq";
1476
1477
CREATE TABLE "spy_oauth_scope"
1478
(
1479
    "id_oauth_scope" INTEGER NOT NULL,
1480
    "description" TEXT,
1481
    "identifier" VARCHAR(1024) NOT NULL,
1482
    PRIMARY KEY ("id_oauth_scope"),
1483
    CONSTRAINT "spy_oauth_scope-identifier" UNIQUE ("identifier")
1484
);
1485
1486
CREATE SEQUENCE "spy_oms_transition_log_pk_seq";
1487
1488
CREATE TABLE "spy_oms_transition_log"
1489
(
1490
    "id_oms_transition_log" INTEGER NOT NULL,
1491
    "fk_oms_order_process" INTEGER,
1492
    "fk_sales_order" INTEGER NOT NULL,
1493
    "fk_sales_order_item" INTEGER NOT NULL,
1494
    "command" VARCHAR,
1495
    "condition" VARCHAR,
1496
    "error_message" TEXT,
1497
    "event" VARCHAR(100),
1498
    "hostname" VARCHAR(128) NOT NULL,
1499
    "is_error" BOOLEAN,
1500
    "locked" BOOLEAN,
1501
    "params" TEXT,
1502
    "path" VARCHAR(256),
1503
    "quantity" INTEGER,
1504
    "source_state" VARCHAR(128),
1505
    "target_state" VARCHAR(128),
1506
    "created_at" TIMESTAMP,
1507
    PRIMARY KEY ("id_oms_transition_log")
1508
);
1509
1510
CREATE INDEX "index-spy_oms_transition_log-fk_sales_order" ON "spy_oms_transition_log" ("fk_sales_order");
1511
1512
CREATE INDEX "index-spy_oms_transition_log-fk_sales_order_item" ON "spy_oms_transition_log" ("fk_sales_order_item");
1513
1514
CREATE INDEX "index-spy_oms_transition_log-fk_oms_order_process" ON "spy_oms_transition_log" ("fk_oms_order_process");
1515
1516
CREATE SEQUENCE "spy_oms_order_process_pk_seq";
1517
1518
CREATE TABLE "spy_oms_order_process"
1519
(
1520
    "id_oms_order_process" INTEGER NOT NULL,
1521
    "name" VARCHAR(255) NOT NULL,
1522
    "created_at" TIMESTAMP,
1523
    "updated_at" TIMESTAMP,
1524
    PRIMARY KEY ("id_oms_order_process"),
1525
    CONSTRAINT "spy_oms_order_process-name" UNIQUE ("name")
1526
);
1527
1528
CREATE SEQUENCE "spy_oms_state_machine_lock_pk_seq";
1529
1530
CREATE TABLE "spy_oms_state_machine_lock"
1531
(
1532
    "id_oms_state_machine_lock" INTEGER NOT NULL,
1533
    "details" VARCHAR,
1534
    "expires" TIMESTAMP NOT NULL,
1535
    "identifier" VARCHAR(255) NOT NULL,
1536
    "created_at" TIMESTAMP,
1537
    "updated_at" TIMESTAMP,
1538
    PRIMARY KEY ("id_oms_state_machine_lock"),
1539
    CONSTRAINT "spy_oms_state_machine_lock-identifier" UNIQUE ("identifier")
1540
);
1541
1542
CREATE SEQUENCE "spy_oms_order_item_state_pk_seq";
1543
1544
CREATE TABLE "spy_oms_order_item_state"
1545
(
1546
    "id_oms_order_item_state" INTEGER NOT NULL,
1547
    "description" VARCHAR(255),
1548
    "name" VARCHAR(255) NOT NULL,
1549
    PRIMARY KEY ("id_oms_order_item_state"),
1550
    CONSTRAINT "spy_oms_order_item_state-name" UNIQUE ("name")
1551
);
1552
1553
CREATE SEQUENCE "spy_oms_order_item_state_history_pk_seq";
1554
1555
CREATE TABLE "spy_oms_order_item_state_history"
1556
(
1557
    "id_oms_order_item_state_history" INTEGER NOT NULL,
1558
    "fk_oms_order_item_state" INTEGER NOT NULL,
1559
    "fk_sales_order_item" INTEGER NOT NULL,
1560
    "created_at" TIMESTAMP,
1561
    PRIMARY KEY ("id_oms_order_item_state_history")
1562
);
1563
1564
CREATE INDEX "spy_oms_order_item_state_history-index-fk_soi-fk_oois-id_ooish" ON "spy_oms_order_item_state_history" ("fk_sales_order_item","fk_oms_order_item_state");
1565
1566
CREATE SEQUENCE "spy_oms_event_timeout_pk_seq";
1567
1568
CREATE TABLE "spy_oms_event_timeout"
1569
(
1570
    "id_oms_event_timeout" INTEGER NOT NULL,
1571
    "fk_oms_order_item_state" INTEGER NOT NULL,
1572
    "fk_sales_order_item" INTEGER NOT NULL,
1573
    "event" VARCHAR(255) NOT NULL,
1574
    "timeout" TIMESTAMP NOT NULL,
1575
    "created_at" TIMESTAMP,
1576
    "updated_at" TIMESTAMP,
1577
    PRIMARY KEY ("id_oms_event_timeout"),
1578
    CONSTRAINT "spy_oms_event_timeout-unique-fk_sales_order_item" UNIQUE ("fk_sales_order_item","fk_oms_order_item_state")
1579
);
1580
1581
CREATE INDEX "spy_oms_event_timeout-timeout" ON "spy_oms_event_timeout" ("timeout");
1582
1583
CREATE INDEX "index-spy_oms_event_timeout-fk_sales_order_item" ON "spy_oms_event_timeout" ("fk_sales_order_item");
1584
1585
CREATE INDEX "index-spy_oms_event_timeout-fk_oms_order_item_state" ON "spy_oms_event_timeout" ("fk_oms_order_item_state");
1586
1587
CREATE SEQUENCE "spy_oms_product_reservation_pk_seq";
1588
1589
CREATE TABLE "spy_oms_product_reservation"
1590
(
1591
    "id_oms_product_reservation" INTEGER NOT NULL,
1592
    "fk_store" INTEGER,
1593
    "reservation_quantity" INTEGER DEFAULT 0 NOT NULL,
1594
    "sku" VARCHAR(255) NOT NULL,
1595
    PRIMARY KEY ("id_oms_product_reservation"),
1596
    CONSTRAINT "spy_oms_product_reservation-sku" UNIQUE ("sku","fk_store")
1597
);
1598
1599
CREATE INDEX "index-spy_oms_product_reservation-fk_store" ON "spy_oms_product_reservation" ("fk_store");
1600
1601
CREATE SEQUENCE "spy_oms_product_reservation_store_pk_seq";
1602
1603
CREATE TABLE "spy_oms_product_reservation_store"
1604
(
1605
    "id_oms_product_reservation_store" INTEGER NOT NULL,
1606
    "reservation_quantity" INTEGER NOT NULL,
1607
    "sku" VARCHAR(255) NOT NULL,
1608
    "store" VARCHAR(255) NOT NULL,
1609
    "version" INT8 NOT NULL,
1610
    "created_at" TIMESTAMP,
1611
    "updated_at" TIMESTAMP,
1612
    PRIMARY KEY ("id_oms_product_reservation_store"),
1613
    CONSTRAINT "spy_oms_product_reservation_store-unique-store-sku" UNIQUE ("store","sku")
1614
);
1615
1616
CREATE INDEX "spy_oms_product_reservation_store-version" ON "spy_oms_product_reservation_store" ("version");
1617
1618
CREATE INDEX "spy_oms_product_reservation_store-sku" ON "spy_oms_product_reservation_store" ("sku");
1619
1620
CREATE INDEX "spy_oms_product_reservation_store-store" ON "spy_oms_product_reservation_store" ("store");
1621
1622
CREATE SEQUENCE "spy_oms_product_reservation_change_version_pk_seq";
1623
1624
CREATE TABLE "spy_oms_product_reservation_change_version"
1625
(
1626
    "id_oms_product_reservation_id" INTEGER NOT NULL,
1627
    "version" INT8 NOT NULL,
1628
    "created_at" TIMESTAMP,
1629
    "updated_at" TIMESTAMP,
1630
    PRIMARY KEY ("version")
1631
);
1632
1633
CREATE TABLE "spy_oms_product_reservation_last_exported_version"
1634
(
1635
    "version" INT8 NOT NULL,
1636
    "created_at" TIMESTAMP,
1637
    "updated_at" TIMESTAMP
1638
);
1639
1640
CREATE SEQUENCE "spy_permission_pk_seq";
1641
1642
CREATE TABLE "spy_permission"
1643
(
1644
    "id_permission" INTEGER NOT NULL,
1645
    "key" VARCHAR(255) NOT NULL,
1646
    "configuration_signature" TEXT,
1647
    PRIMARY KEY ("id_permission"),
1648
    CONSTRAINT "spy_permission-key" UNIQUE ("key")
1649
);
1650
1651
CREATE SEQUENCE "spy_price_product_pk_seq";
1652
1653
CREATE TABLE "spy_price_product"
1654
(
1655
    "id_price_product" INTEGER NOT NULL,
1656
    "fk_price_type" INTEGER NOT NULL,
1657
    "fk_product" INTEGER,
1658
    "fk_product_abstract" INTEGER,
1659
    "price" INTEGER DEFAULT 0,
1660
    PRIMARY KEY ("id_price_product"),
1661
    CONSTRAINT "spy_price_product-unique-fk_product_abstract" UNIQUE ("fk_product_abstract","fk_product","fk_price_type"),
1662
    CONSTRAINT "fk_price_type_unique_fk_product_abstract_unique" UNIQUE ("fk_product_abstract","fk_price_type"),
1663
    CONSTRAINT "fk_price_type_unique_fk_product_unique" UNIQUE ("fk_product","fk_price_type")
1664
);
1665
1666
CREATE INDEX "spy_price_product-fk_price_type" ON "spy_price_product" ("fk_price_type");
1667
1668
CREATE INDEX "spy_price_product-index-fk_product-fk_price_type-price" ON "spy_price_product" ("fk_product","fk_price_type","price");
1669
1670
CREATE INDEX "index-spy_price_product-fk_product_abstract" ON "spy_price_product" ("fk_product_abstract");
1671
1672
CREATE SEQUENCE "spy_price_type_pk_seq";
1673
1674
CREATE TABLE "spy_price_type"
1675
(
1676
    "id_price_type" INTEGER NOT NULL,
1677
    "name" VARCHAR(255) NOT NULL,
1678
    "price_mode_configuration" INT2,
1679
    PRIMARY KEY ("id_price_type"),
1680
    CONSTRAINT "spy_price_type-name" UNIQUE ("name")
1681
);
1682
1683
CREATE SEQUENCE "spy_price_product_store_pk_seq";
1684
1685
CREATE TABLE "spy_price_product_store"
1686
(
1687
    "id_price_product_store" INT8 NOT NULL,
1688
    "fk_currency" INTEGER NOT NULL,
1689
    "fk_price_product" INTEGER NOT NULL,
1690
    "fk_store" INTEGER,
1691
    "gross_price" INTEGER,
1692
    "net_price" INTEGER,
1693
    "price_data" TEXT,
1694
    "price_data_checksum" VARCHAR,
1695
    PRIMARY KEY ("id_price_product_store")
1696
);
1697
1698
CREATE INDEX "spy_price_product_store-index-fk_pr_pro-fk_cur-fk_st" ON "spy_price_product_store" ("fk_currency","fk_store","fk_price_product","price_data_checksum","net_price","gross_price");
1699
1700
CREATE INDEX "spy_price_product_store-index-fk_pr_pro-id_pr_pro_st" ON "spy_price_product_store" ("fk_price_product","id_price_product_store");
1701
1702
CREATE SEQUENCE "spy_price_product_default_pk_seq";
1703
1704
CREATE TABLE "spy_price_product_default"
1705
(
1706
    "id_price_product_default" INT8 NOT NULL,
1707
    "fk_price_product_store" INT8 NOT NULL,
1708
    PRIMARY KEY ("id_price_product_default"),
1709
    CONSTRAINT "spy_prs_prod_default-unique-price_product_store" UNIQUE ("fk_price_product_store")
1710
);
1711
1712
CREATE INDEX "spy_price_product_default-index-fk_price_product_store" ON "spy_price_product_default" ("fk_price_product_store");
1713
1714
CREATE SEQUENCE "spy_price_product_schedule_pk_seq";
1715
1716
CREATE TABLE "spy_price_product_schedule"
1717
(
1718
    "id_price_product_schedule" INT8 NOT NULL,
1719
    "fk_currency" INTEGER NOT NULL,
1720
    "fk_store" INTEGER NOT NULL,
1721
    "fk_price_type" INTEGER NOT NULL,
1722
    "fk_product" INTEGER,
1723
    "fk_product_abstract" INTEGER,
1724
    "fk_price_product_schedule_list" INT8 NOT NULL,
1725
    "net_price" INTEGER,
1726
    "gross_price" INTEGER,
1727
    "price_data" TEXT,
1728
    "active_from" TIMESTAMP NOT NULL,
1729
    "active_to" TIMESTAMP NOT NULL,
1730
    "is_current" BOOLEAN DEFAULT \'f\' NOT NULL,
1731
    "created_at" TIMESTAMP,
1732
    "updated_at" TIMESTAMP,
1733
    PRIMARY KEY ("id_price_product_schedule")
1734
);
1735
1736
CREATE INDEX "index-spy_price_product_schedule-fk_product" ON "spy_price_product_schedule" ("fk_product");
1737
1738
CREATE INDEX "index-spy_price_product_schedule-fk_product_abstract" ON "spy_price_product_schedule" ("fk_product_abstract");
1739
1740
CREATE INDEX "index-spy_price_product_schedule-fk_currency" ON "spy_price_product_schedule" ("fk_currency");
1741
1742
CREATE INDEX "index-spy_price_product_schedule-fk_store" ON "spy_price_product_schedule" ("fk_store");
1743
1744
CREATE INDEX "index-spy_price_product_schedule-fk_price_type" ON "spy_price_product_schedule" ("fk_price_type");
1745
1746
CREATE INDEX "index-spy_price_product_schedule-fk_price_product_schedule_list" ON "spy_price_product_schedule" ("fk_price_product_schedule_list");
1747
1748
CREATE SEQUENCE "spy_price_product_schedule_list_pk_seq";
1749
1750
CREATE TABLE "spy_price_product_schedule_list"
1751
(
1752
    "id_price_product_schedule_list" INT8 NOT NULL,
1753
    "name" VARCHAR(255) NOT NULL,
1754
    "is_active" BOOLEAN DEFAULT \'f\',
1755
    "fk_user" INTEGER,
1756
    "created_at" TIMESTAMP,
1757
    "updated_at" TIMESTAMP,
1758
    PRIMARY KEY ("id_price_product_schedule_list")
1759
);
1760
1761
CREATE INDEX "index-spy_price_product_schedule_list-fk_user" ON "spy_price_product_schedule_list" ("fk_user");
1762
1763
CREATE INDEX "index-spy_price_product_schedule_list-name" ON "spy_price_product_schedule_list" ("name");
1764
1765
CREATE SEQUENCE "spy_price_product_abstract_storage_pk_seq";
1766
1767
CREATE TABLE "spy_price_product_abstract_storage"
1768
(
1769
    "id_price_product_abstract_storage" INT8 NOT NULL,
1770
    "fk_product_abstract" INTEGER NOT NULL,
1771
    "data" TEXT,
1772
    "store" VARCHAR(128),
1773
    "key" VARCHAR,
1774
    "created_at" TIMESTAMP,
1775
    "updated_at" TIMESTAMP,
1776
    PRIMARY KEY ("id_price_product_abstract_storage"),
1777
    CONSTRAINT "spy_price_product_abstract_storage-unique-key" UNIQUE ("key")
1778
);
1779
1780
CREATE INDEX "spy_price_product_abstract_storage-fk_product_abstract" ON "spy_price_product_abstract_storage" ("fk_product_abstract");
1781
1782
CREATE SEQUENCE "spy_price_product_concrete_storage_pk_seq";
1783
1784
CREATE TABLE "spy_price_product_concrete_storage"
1785
(
1786
    "id_price_product_concrete_storage" INT8 NOT NULL,
1787
    "fk_product" INTEGER NOT NULL,
1788
    "data" TEXT,
1789
    "store" VARCHAR(128),
1790
    "key" VARCHAR,
1791
    "created_at" TIMESTAMP,
1792
    "updated_at" TIMESTAMP,
1793
    PRIMARY KEY ("id_price_product_concrete_storage"),
1794
    CONSTRAINT "spy_price_product_concrete_storage-unique-key" UNIQUE ("key")
1795
);
1796
1797
CREATE INDEX "spy_price_product_concrete_storage-fk_product" ON "spy_price_product_concrete_storage" ("fk_product");
1798
1799
CREATE SEQUENCE "spy_product_abstract_pk_seq";
1800
1801
CREATE TABLE "spy_product_abstract"
1802
(
1803
    "id_product_abstract" INTEGER NOT NULL,
1804
    "fk_tax_set" INTEGER,
1805
    "attributes" TEXT NOT NULL,
1806
    "color_code" VARCHAR(8),
1807
    "new_from" TIMESTAMP,
1808
    "new_to" TIMESTAMP,
1809
    "sku" VARCHAR(255) NOT NULL,
1810
    "created_at" TIMESTAMP,
1811
    "updated_at" TIMESTAMP,
1812
    PRIMARY KEY ("id_product_abstract"),
1813
    CONSTRAINT "spy_product_abstract-sku" UNIQUE ("sku")
1814
);
1815
1816
CREATE INDEX "index-spy_product_abstract-fk_tax_set" ON "spy_product_abstract" ("fk_tax_set");
1817
1818
CREATE SEQUENCE "spy_product_abstract_localized_attributes_pk_seq";
1819
1820
CREATE TABLE "spy_product_abstract_localized_attributes"
1821
(
1822
    "id_abstract_attributes" INTEGER NOT NULL,
1823
    "fk_locale" INTEGER NOT NULL,
1824
    "fk_product_abstract" INTEGER NOT NULL,
1825
    "attributes" TEXT NOT NULL,
1826
    "description" TEXT,
1827
    "meta_description" TEXT,
1828
    "meta_keywords" TEXT,
1829
    "meta_title" VARCHAR(255),
1830
    "name" VARCHAR NOT NULL,
1831
    "created_at" TIMESTAMP,
1832
    "updated_at" TIMESTAMP,
1833
    PRIMARY KEY ("id_abstract_attributes"),
1834
    CONSTRAINT "spy_product_abstract_localized_attributes-unique-fk_pa" UNIQUE ("fk_product_abstract","fk_locale")
1835
);
1836
1837
CREATE INDEX "index-spy_product_abstract_localized_attributes-fk-a7603b3c2144" ON "spy_product_abstract_localized_attributes" ("fk_product_abstract");
1838
1839
CREATE INDEX "index-spy_product_abstract_localized_attributes-fk_locale" ON "spy_product_abstract_localized_attributes" ("fk_locale");
1840
1841
CREATE SEQUENCE "id_product_abstract_store_pk_seq";
1842
1843
CREATE TABLE "spy_product_abstract_store"
1844
(
1845
    "id_product_abstract_store" INTEGER NOT NULL,
1846
    "fk_product_abstract" INTEGER NOT NULL,
1847
    "fk_store" INTEGER NOT NULL,
1848
    PRIMARY KEY ("id_product_abstract_store"),
1849
    CONSTRAINT "spy_product_abstract_store-fk_product_abstract-fk_store" UNIQUE ("fk_product_abstract","fk_store")
1850
);
1851
1852
CREATE INDEX "index-spy_product_abstract_store-fk_product_abstract" ON "spy_product_abstract_store" ("fk_product_abstract");
1853
1854
CREATE INDEX "index-spy_product_abstract_store-fk_store" ON "spy_product_abstract_store" ("fk_store");
1855
1856
CREATE SEQUENCE "spy_product_pk_seq";
1857
1858
CREATE TABLE "spy_product"
1859
(
1860
    "id_product" INTEGER NOT NULL,
1861
    "fk_product_abstract" INTEGER NOT NULL,
1862
    "attributes" TEXT NOT NULL,
1863
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
1864
    "is_quantity_splittable" BOOLEAN DEFAULT \'t\' NOT NULL,
1865
    "sku" VARCHAR(255) NOT NULL,
1866
    "created_at" TIMESTAMP,
1867
    "updated_at" TIMESTAMP,
1868
    PRIMARY KEY ("id_product"),
1869
    CONSTRAINT "spy_product-sku" UNIQUE ("sku")
1870
);
1871
1872
CREATE INDEX "index-spy_product-fk_product_abstract" ON "spy_product" ("fk_product_abstract");
1873
1874
CREATE SEQUENCE "spy_product_localized_attributes_pk_seq";
1875
1876
CREATE TABLE "spy_product_localized_attributes"
1877
(
1878
    "id_product_attributes" INTEGER NOT NULL,
1879
    "fk_locale" INTEGER NOT NULL,
1880
    "fk_product" INTEGER NOT NULL,
1881
    "attributes" TEXT NOT NULL,
1882
    "description" TEXT,
1883
    "is_complete" BOOLEAN DEFAULT \'t\',
1884
    "name" VARCHAR NOT NULL,
1885
    "created_at" TIMESTAMP,
1886
    "updated_at" TIMESTAMP,
1887
    PRIMARY KEY ("id_product_attributes"),
1888
    CONSTRAINT "spy_product_localized_attributes-unique-fk_product" UNIQUE ("fk_product","fk_locale")
1889
);
1890
1891
CREATE INDEX "index-spy_product_localized_attributes-fk_product" ON "spy_product_localized_attributes" ("fk_product");
1892
1893
CREATE INDEX "index-spy_product_localized_attributes-fk_locale" ON "spy_product_localized_attributes" ("fk_locale");
1894
1895
CREATE SEQUENCE "spy_product_attribute_key_pk_seq";
1896
1897
CREATE TABLE "spy_product_attribute_key"
1898
(
1899
    "id_product_attribute_key" INTEGER NOT NULL,
1900
    "is_super" BOOLEAN DEFAULT \'f\' NOT NULL,
1901
    "key" VARCHAR NOT NULL,
1902
    PRIMARY KEY ("id_product_attribute_key"),
1903
    CONSTRAINT "spy_product_attribute_key-unique-key" UNIQUE ("key")
1904
);
1905
1906
CREATE SEQUENCE "spy_product_alternative_pk_seq";
1907
1908
CREATE TABLE "spy_product_alternative"
1909
(
1910
    "id_product_alternative" INTEGER NOT NULL,
1911
    "fk_product" INTEGER NOT NULL,
1912
    "fk_product_abstract_alternative" INTEGER,
1913
    "fk_product_concrete_alternative" INTEGER,
1914
    PRIMARY KEY ("id_product_alternative")
1915
);
1916
1917
CREATE INDEX "index-spy_product_alternative-fk_product" ON "spy_product_alternative" ("fk_product");
1918
1919
CREATE INDEX "index-spy_product_alternative-fk_product_abstract_alternative" ON "spy_product_alternative" ("fk_product_abstract_alternative");
1920
1921
CREATE INDEX "index-spy_product_alternative-fk_product_concrete_alternative" ON "spy_product_alternative" ("fk_product_concrete_alternative");
1922
1923
CREATE SEQUENCE "id_product_alternative_storage_pk_seq";
1924
1925
CREATE TABLE "spy_product_alternative_storage"
1926
(
1927
    "id_product_alternative_storage" INTEGER NOT NULL,
1928
    "fk_product" INTEGER NOT NULL,
1929
    "data" TEXT,
1930
    "sku" VARCHAR(255) NOT NULL,
1931
    "key" VARCHAR,
1932
    "created_at" TIMESTAMP,
1933
    "updated_at" TIMESTAMP,
1934
    PRIMARY KEY ("id_product_alternative_storage"),
1935
    CONSTRAINT "spy_product_alternative_storage-unique-key" UNIQUE ("key")
1936
);
1937
1938
CREATE INDEX "spy_product_alternative_storage-fk_product" ON "spy_product_alternative_storage" ("fk_product");
1939
1940
CREATE SEQUENCE "id_product_replacement_for_storage_pk_seq";
1941
1942
CREATE TABLE "spy_product_replacement_for_storage"
1943
(
1944
    "id_product_replacement_for_storage" INTEGER NOT NULL,
1945
    "data" TEXT,
1946
    "sku" VARCHAR(255) NOT NULL,
1947
    "key" VARCHAR,
1948
    "created_at" TIMESTAMP,
1949
    "updated_at" TIMESTAMP,
1950
    PRIMARY KEY ("id_product_replacement_for_storage"),
1951
    CONSTRAINT "spy_product_replacement_for_storage-unique-key" UNIQUE ("key")
1952
);
1953
1954
CREATE INDEX "spy_product_replacement_for_storage-sku" ON "spy_product_replacement_for_storage" ("sku");
1955
1956
CREATE SEQUENCE "spy_product_management_attribute_pk_seq";
1957
1958
CREATE TABLE "spy_product_management_attribute"
1959
(
1960
    "id_product_management_attribute" INTEGER NOT NULL,
1961
    "fk_product_attribute_key" INTEGER NOT NULL,
1962
    "allow_input" BOOLEAN DEFAULT \'t\' NOT NULL,
1963
    "input_type" VARCHAR NOT NULL,
1964
    PRIMARY KEY ("id_product_management_attribute"),
1965
    CONSTRAINT "spy_pim_attribute-unique-fk_product_attribute_key" UNIQUE ("fk_product_attribute_key")
1966
);
1967
1968
CREATE INDEX "index-spy_product_management_attribute-fk_product_attribute_key" ON "spy_product_management_attribute" ("fk_product_attribute_key");
1969
1970
CREATE SEQUENCE "spy_product_management_attribute_value_pk_seq";
1971
1972
CREATE TABLE "spy_product_management_attribute_value"
1973
(
1974
    "id_product_management_attribute_value" INTEGER NOT NULL,
1975
    "fk_product_management_attribute" INTEGER NOT NULL,
1976
    "value" TEXT NOT NULL,
1977
    PRIMARY KEY ("id_product_management_attribute_value")
1978
);
1979
1980
CREATE INDEX "index-spy_product_management_attribute_value-fk_pr-7f614d579abb" ON "spy_product_management_attribute_value" ("fk_product_management_attribute");
1981
1982
CREATE SEQUENCE "spy_product_management_attribute_value_translation_pk_seq";
1983
1984
CREATE TABLE "spy_product_management_attribute_value_translation"
1985
(
1986
    "id_product_management_attribute_value_translation" INTEGER NOT NULL,
1987
    "fk_locale" INTEGER NOT NULL,
1988
    "fk_product_management_attribute_value" INTEGER NOT NULL,
1989
    "translation" TEXT NOT NULL,
1990
    PRIMARY KEY ("id_product_management_attribute_value_translation"),
1991
    CONSTRAINT "spy_pim_attribute_value_translation-unique-locale_attribute_val" UNIQUE ("fk_locale","fk_product_management_attribute_value")
1992
);
1993
1994
CREATE INDEX "index-spy_product_management_attribute_value_trans-a710a253ee1d" ON "spy_product_management_attribute_value_translation" ("fk_locale");
1995
1996
CREATE INDEX "index-spy_product_management_attribute_value_trans-8f14a52f8fbf" ON "spy_product_management_attribute_value_translation" ("fk_product_management_attribute_value");
1997
1998
CREATE SEQUENCE "spy_sales_order_item_bundle_pk_seq";
1999
2000
CREATE TABLE "spy_sales_order_item_bundle"
2001
(
2002
    "id_sales_order_item_bundle" INTEGER NOT NULL,
2003
    "cart_note" VARCHAR(255),
2004
    "gross_price" INTEGER NOT NULL,
2005
    "image" TEXT,
2006
    "name" VARCHAR(255) NOT NULL,
2007
    "net_price" INTEGER DEFAULT 0,
2008
    "price" INTEGER DEFAULT 0,
2009
    "sku" VARCHAR(255) NOT NULL,
2010
    "created_at" TIMESTAMP,
2011
    "updated_at" TIMESTAMP,
2012
    PRIMARY KEY ("id_sales_order_item_bundle")
2013
);
2014
2015
CREATE SEQUENCE "spy_product_bundle_pk_seq";
2016
2017
CREATE TABLE "spy_product_bundle"
2018
(
2019
    "id_product_bundle" INTEGER NOT NULL,
2020
    "fk_bundled_product" INTEGER NOT NULL,
2021
    "fk_product" INTEGER NOT NULL,
2022
    "quantity" INTEGER DEFAULT 1 NOT NULL,
2023
    "created_at" TIMESTAMP,
2024
    "updated_at" TIMESTAMP,
2025
    PRIMARY KEY ("id_product_bundle")
2026
);
2027
2028
COMMENT ON COLUMN "spy_product_bundle"."fk_bundled_product" IS \'Representation of the single item in this bundle\';
2029
2030
COMMENT ON COLUMN "spy_product_bundle"."fk_product" IS \'Relation to the main bundle product\';
2031
2032
COMMENT ON COLUMN "spy_product_bundle"."quantity" IS \'Number of items bundled. For instance when you have 5000 equal items you will have quantity 5000\';
2033
2034
CREATE INDEX "spy_product_bundle-index-fk_product" ON "spy_product_bundle" ("fk_product");
2035
2036
CREATE INDEX "index-spy_product_bundle-fk_bundled_product" ON "spy_product_bundle" ("fk_bundled_product");
2037
2038
CREATE SEQUENCE "spy_product_category_pk_seq";
2039
2040
CREATE TABLE "spy_product_category"
2041
(
2042
    "id_product_category" INTEGER NOT NULL,
2043
    "fk_category" INTEGER NOT NULL,
2044
    "fk_product_abstract" INTEGER NOT NULL,
2045
    "product_order" INTEGER DEFAULT 0,
2046
    PRIMARY KEY ("id_product_category"),
2047
    CONSTRAINT "spy_product_category-unique-fk_product_abstract" UNIQUE ("fk_product_abstract","fk_category")
2048
);
2049
2050
CREATE INDEX "index-spy_product_category-fk_category" ON "spy_product_category" ("fk_category");
2051
2052
CREATE INDEX "index-spy_product_category-fk_product_abstract" ON "spy_product_category" ("fk_product_abstract");
2053
2054
CREATE SEQUENCE "spy_product_category_filter_pk_seq";
2055
2056
CREATE TABLE "spy_product_category_filter"
2057
(
2058
    "id_product_category_filter" INTEGER NOT NULL,
2059
    "fk_category" INTEGER,
2060
    "filter_data" TEXT NOT NULL,
2061
    PRIMARY KEY ("id_product_category_filter"),
2062
    CONSTRAINT "spy_product_category_filter-unique-fk_category" UNIQUE ("fk_category")
2063
);
2064
2065
CREATE INDEX "spy_product_category_filter_i_adaed7" ON "spy_product_category_filter" ("fk_category");
2066
2067
CREATE SEQUENCE "spy_product_category_filter_storage_pk_seq";
2068
2069
CREATE TABLE "spy_product_category_filter_storage"
2070
(
2071
    "id_product_category_filter_storage" INT8 NOT NULL,
2072
    "fk_category" INTEGER NOT NULL,
2073
    "data" TEXT,
2074
    "key" VARCHAR,
2075
    "created_at" TIMESTAMP,
2076
    "updated_at" TIMESTAMP,
2077
    PRIMARY KEY ("id_product_category_filter_storage"),
2078
    CONSTRAINT "spy_product_category_filter_storage-unique-key" UNIQUE ("key")
2079
);
2080
2081
CREATE INDEX "spy_product_category_filter_storage-fk_category" ON "spy_product_category_filter_storage" ("fk_category");
2082
2083
CREATE SEQUENCE "spy_product_abstract_category_storage_pk_seq";
2084
2085
CREATE TABLE "spy_product_abstract_category_storage"
2086
(
2087
    "id_product_abstract_category_storage" INT8 NOT NULL,
2088
    "fk_product_abstract" INTEGER NOT NULL,
2089
    "data" TEXT,
2090
    "locale" VARCHAR(16) NOT NULL,
2091
    "key" VARCHAR,
2092
    "created_at" TIMESTAMP,
2093
    "updated_at" TIMESTAMP,
2094
    PRIMARY KEY ("id_product_abstract_category_storage"),
2095
    CONSTRAINT "spy_product_abstract_category_storage-unique-key" UNIQUE ("key")
2096
);
2097
2098
CREATE INDEX "spy_product_abstract_category_storage-fk_product_abstract" ON "spy_product_abstract_category_storage" ("fk_product_abstract");
2099
2100
CREATE SEQUENCE "id_product_discontinued_pk_seq";
2101
2102
CREATE TABLE "spy_product_discontinued"
2103
(
2104
    "id_product_discontinued" INTEGER NOT NULL,
2105
    "fk_product" INTEGER NOT NULL,
2106
    "active_until" DATE NOT NULL,
2107
    "discontinued_on" TIMESTAMP,
2108
    "updated_at" TIMESTAMP,
2109
    PRIMARY KEY ("id_product_discontinued")
2110
);
2111
2112
CREATE INDEX "index-spy_product_discontinued-fk_product" ON "spy_product_discontinued" ("fk_product");
2113
2114
CREATE SEQUENCE "id_product_discontinued_note_pk_seq";
2115
2116
CREATE TABLE "spy_product_discontinued_note"
2117
(
2118
    "id_product_discontinued_note" INTEGER NOT NULL,
2119
    "fk_locale" INTEGER NOT NULL,
2120
    "fk_product_discontinued" INTEGER NOT NULL,
2121
    "note" VARCHAR,
2122
    "created_at" TIMESTAMP,
2123
    "updated_at" TIMESTAMP,
2124
    PRIMARY KEY ("id_product_discontinued_note"),
2125
    CONSTRAINT "spy_product_discontinued_note-unique-fk_product_discontinued" UNIQUE ("fk_product_discontinued","fk_locale")
2126
);
2127
2128
CREATE INDEX "index-spy_product_discontinued_note-fk_product_discontinued" ON "spy_product_discontinued_note" ("fk_product_discontinued");
2129
2130
CREATE INDEX "index-spy_product_discontinued_note-fk_locale" ON "spy_product_discontinued_note" ("fk_locale");
2131
2132
CREATE SEQUENCE "id_product_discontinued_storage_pk_seq";
2133
2134
CREATE TABLE "spy_product_discontinued_storage"
2135
(
2136
    "id_product_discontinued_storage" INTEGER NOT NULL,
2137
    "fk_product_discontinued" INTEGER NOT NULL,
2138
    "data" TEXT,
2139
    "key" VARCHAR(255) NOT NULL,
2140
    "locale" VARCHAR NOT NULL,
2141
    "sku" VARCHAR(255) NOT NULL,
2142
    "created_at" TIMESTAMP,
2143
    "updated_at" TIMESTAMP,
2144
    PRIMARY KEY ("id_product_discontinued_storage")
2145
);
2146
2147
CREATE INDEX "spy_product_discontinued_storage-fk_product_discontinued" ON "spy_product_discontinued_storage" ("fk_product_discontinued");
2148
2149
CREATE SEQUENCE "spy_product_group_pk_seq";
2150
2151
CREATE TABLE "spy_product_group"
2152
(
2153
    "id_product_group" INTEGER NOT NULL,
2154
    "product_group_key" VARCHAR(32),
2155
    PRIMARY KEY ("id_product_group")
2156
);
2157
2158
CREATE INDEX "spy_product_group_i_55ec34" ON "spy_product_group" ("product_group_key");
2159
2160
CREATE TABLE "spy_product_abstract_group"
2161
(
2162
    "fk_product_abstract" INTEGER NOT NULL,
2163
    "fk_product_group" INTEGER NOT NULL,
2164
    "position" INTEGER DEFAULT 0 NOT NULL,
2165
    PRIMARY KEY ("fk_product_abstract","fk_product_group")
2166
);
2167
2168
CREATE SEQUENCE "spy_product_abstract_group_storage_pk_seq";
2169
2170
CREATE TABLE "spy_product_abstract_group_storage"
2171
(
2172
    "id_product_abstract_group_storage" INT8 NOT NULL,
2173
    "fk_product_abstract" INTEGER NOT NULL,
2174
    "data" TEXT,
2175
    "key" VARCHAR,
2176
    "created_at" TIMESTAMP,
2177
    "updated_at" TIMESTAMP,
2178
    PRIMARY KEY ("id_product_abstract_group_storage"),
2179
    CONSTRAINT "spy_product_abstract_group_storage-unique-key" UNIQUE ("key")
2180
);
2181
2182
CREATE INDEX "spy_product_abstract_group_storage-fk_product_abstract" ON "spy_product_abstract_group_storage" ("fk_product_abstract");
2183
2184
CREATE SEQUENCE "spy_product_image_set_pk_seq";
2185
2186
CREATE TABLE "spy_product_image_set"
2187
(
2188
    "id_product_image_set" INTEGER NOT NULL,
2189
    "fk_locale" INTEGER,
2190
    "fk_product" INTEGER,
2191
    "fk_product_abstract" INTEGER,
2192
    "fk_resource_product_set" INTEGER,
2193
    "name" VARCHAR(255),
2194
    "created_at" TIMESTAMP,
2195
    "updated_at" TIMESTAMP,
2196
    PRIMARY KEY ("id_product_image_set"),
2197
    CONSTRAINT "fk_locale-fk_product-fk_product_abstract" UNIQUE ("fk_locale","fk_product","fk_product_abstract")
2198
);
2199
2200
CREATE INDEX "spy_product_image_set-index-fk_product" ON "spy_product_image_set" ("fk_product");
2201
2202
CREATE INDEX "spy_product_image_set-index-fk_product_abstract" ON "spy_product_image_set" ("fk_product_abstract");
2203
2204
CREATE INDEX "spy_product_image_set-fk_resource_product_set" ON "spy_product_image_set" ("fk_resource_product_set");
2205
2206
CREATE INDEX "index-spy_product_image_set-fk_locale" ON "spy_product_image_set" ("fk_locale");
2207
2208
CREATE SEQUENCE "spy_product_image_pk_seq";
2209
2210
CREATE TABLE "spy_product_image"
2211
(
2212
    "id_product_image" INTEGER NOT NULL,
2213
    "external_url_large" VARCHAR(2048),
2214
    "external_url_small" VARCHAR(2048),
2215
    "created_at" TIMESTAMP,
2216
    "updated_at" TIMESTAMP,
2217
    PRIMARY KEY ("id_product_image")
2218
);
2219
2220
CREATE SEQUENCE "spy_product_image_set_to_product_image_pk_seq";
2221
2222
CREATE TABLE "spy_product_image_set_to_product_image"
2223
(
2224
    "id_product_image_set_to_product_image" INTEGER NOT NULL,
2225
    "fk_product_image" INTEGER NOT NULL,
2226
    "fk_product_image_set" INTEGER NOT NULL,
2227
    "sort_order" INTEGER NOT NULL,
2228
    PRIMARY KEY ("id_product_image_set_to_product_image"),
2229
    CONSTRAINT "fk_product_image_set-fk_product_image" UNIQUE ("fk_product_image_set","fk_product_image")
2230
);
2231
2232
CREATE INDEX "index-spy_product_image_set_to_product_image-fk_pr-73c1243c19c1" ON "spy_product_image_set_to_product_image" ("fk_product_image_set");
2233
2234
CREATE INDEX "index-spy_product_image_set_to_product_image-fk_product_image" ON "spy_product_image_set_to_product_image" ("fk_product_image");
2235
2236
CREATE SEQUENCE "spy_product_abstract_image_storage_pk_seq";
2237
2238
CREATE TABLE "spy_product_abstract_image_storage"
2239
(
2240
    "id_product_abstract_image_storage" INT8 NOT NULL,
2241
    "fk_product_abstract" INTEGER NOT NULL,
2242
    "data" TEXT,
2243
    "locale" VARCHAR(16) NOT NULL,
2244
    "key" VARCHAR,
2245
    "created_at" TIMESTAMP,
2246
    "updated_at" TIMESTAMP,
2247
    PRIMARY KEY ("id_product_abstract_image_storage"),
2248
    CONSTRAINT "spy_product_abstract_image_storage-unique-key" UNIQUE ("key")
2249
);
2250
2251
CREATE INDEX "spy_product_abstract_image_storage-fk_product_abstract" ON "spy_product_abstract_image_storage" ("fk_product_abstract");
2252
2253
CREATE SEQUENCE "spy_product_concrete_image_storage_pk_seq";
2254
2255
CREATE TABLE "spy_product_concrete_image_storage"
2256
(
2257
    "id_product_concrete_image_storage" INT8 NOT NULL,
2258
    "fk_product" INTEGER NOT NULL,
2259
    "data" TEXT,
2260
    "locale" VARCHAR(16) NOT NULL,
2261
    "key" VARCHAR,
2262
    "created_at" TIMESTAMP,
2263
    "updated_at" TIMESTAMP,
2264
    PRIMARY KEY ("id_product_concrete_image_storage"),
2265
    CONSTRAINT "spy_product_concrete_image_storage-unique-key" UNIQUE ("key")
2266
);
2267
2268
CREATE INDEX "spy_product_concrete_image_storage-fk_product" ON "spy_product_concrete_image_storage" ("fk_product");
2269
2270
CREATE SEQUENCE "spy_product_label_pk_seq";
2271
2272
CREATE TABLE "spy_product_label"
2273
(
2274
    "id_product_label" INTEGER NOT NULL,
2275
    "front_end_reference" VARCHAR,
2276
    "is_active" BOOLEAN DEFAULT \'f\' NOT NULL,
2277
    "is_dynamic" BOOLEAN DEFAULT \'f\' NOT NULL,
2278
    "is_exclusive" BOOLEAN DEFAULT \'f\' NOT NULL,
2279
    "is_published" BOOLEAN DEFAULT \'f\',
2280
    "name" VARCHAR NOT NULL,
2281
    "position" INTEGER NOT NULL,
2282
    "valid_from" TIMESTAMP,
2283
    "valid_to" TIMESTAMP,
2284
    "created_at" TIMESTAMP,
2285
    "updated_at" TIMESTAMP,
2286
    PRIMARY KEY ("id_product_label"),
2287
    CONSTRAINT "spy_product_label-name" UNIQUE ("name")
2288
);
2289
2290
CREATE INDEX "idx-spy_product_label-position" ON "spy_product_label" ("position");
2291
2292
CREATE SEQUENCE "spy_product_label_localized_attributes_pk_seq";
2293
2294
CREATE TABLE "spy_product_label_localized_attributes"
2295
(
2296
    "id_product_label_localized_attributes" INTEGER NOT NULL,
2297
    "fk_locale" INTEGER NOT NULL,
2298
    "fk_product_label" INTEGER NOT NULL,
2299
    "name" VARCHAR,
2300
    PRIMARY KEY ("id_product_label_localized_attributes"),
2301
    CONSTRAINT "spy_product_label_localized_attributes-fk_product_label-fk_loc" UNIQUE ("fk_product_label","fk_locale")
2302
);
2303
2304
CREATE INDEX "idx-spy_product_label_localized_attributes-fk_product_label" ON "spy_product_label_localized_attributes" ("fk_product_label");
2305
2306
CREATE INDEX "index-spy_product_label_localized_attributes-fk_locale" ON "spy_product_label_localized_attributes" ("fk_locale");
2307
2308
CREATE SEQUENCE "spy_product_label_product_abstract_pk_seq";
2309
2310
CREATE TABLE "spy_product_label_product_abstract"
2311
(
2312
    "id_product_label_product_abstract" INTEGER NOT NULL,
2313
    "fk_product_abstract" INTEGER NOT NULL,
2314
    "fk_product_label" INTEGER NOT NULL,
2315
    PRIMARY KEY ("id_product_label_product_abstract"),
2316
    CONSTRAINT "spy_product_label_product_abstract-fk_product_label-fk_pa" UNIQUE ("fk_product_label","fk_product_abstract")
2317
);
2318
2319
CREATE INDEX "idx-spy_product_label_product_abstract-fk_product_label" ON "spy_product_label_product_abstract" ("fk_product_label");
2320
2321
CREATE INDEX "idx-spy_product_label_product_abstract-fk_product_abstract" ON "spy_product_label_product_abstract" ("fk_product_abstract");
2322
2323
CREATE SEQUENCE "spy_product_label_dictionary_storage_pk_seq";
2324
2325
CREATE TABLE "spy_product_label_dictionary_storage"
2326
(
2327
    "id_product_label_dictionary_storage" INT8 NOT NULL,
2328
    "data" TEXT,
2329
    "locale" VARCHAR(16) NOT NULL,
2330
    "key" VARCHAR,
2331
    "created_at" TIMESTAMP,
2332
    "updated_at" TIMESTAMP,
2333
    PRIMARY KEY ("id_product_label_dictionary_storage"),
2334
    CONSTRAINT "spy_product_label_dictionary_storage-unique-key" UNIQUE ("key")
2335
);
2336
2337
CREATE SEQUENCE "spy_product_abstract_label_storage_pk_seq";
2338
2339
CREATE TABLE "spy_product_abstract_label_storage"
2340
(
2341
    "id_product_abstract_label_storage" INT8 NOT NULL,
2342
    "fk_product_abstract" INTEGER NOT NULL,
2343
    "data" TEXT,
2344
    "key" VARCHAR,
2345
    "created_at" TIMESTAMP,
2346
    "updated_at" TIMESTAMP,
2347
    PRIMARY KEY ("id_product_abstract_label_storage"),
2348
    CONSTRAINT "spy_product_abstract_label_storage-unique-key" UNIQUE ("key")
2349
);
2350
2351
CREATE INDEX "spy_product_abstract_label_storage-fk_product_abstract" ON "spy_product_abstract_label_storage" ("fk_product_abstract");
2352
2353
CREATE SEQUENCE "spy_product_option_group_pk_seq";
2354
2355
CREATE TABLE "spy_product_option_group"
2356
(
2357
    "id_product_option_group" INTEGER NOT NULL,
2358
    "fk_tax_set" INTEGER,
2359
    "active" BOOLEAN,
2360
    "name" VARCHAR(255),
2361
    "created_at" TIMESTAMP,
2362
    "updated_at" TIMESTAMP,
2363
    PRIMARY KEY ("id_product_option_group")
2364
);
2365
2366
CREATE INDEX "index-spy_product_option_group-fk_tax_set" ON "spy_product_option_group" ("fk_tax_set");
2367
2368
CREATE TABLE "spy_product_abstract_product_option_group"
2369
(
2370
    "fk_product_abstract" INTEGER NOT NULL,
2371
    "fk_product_option_group" INTEGER NOT NULL,
2372
    PRIMARY KEY ("fk_product_abstract","fk_product_option_group")
2373
);
2374
2375
CREATE SEQUENCE "spy_product_option_value_pk_seq";
2376
2377
CREATE TABLE "spy_product_option_value"
2378
(
2379
    "id_product_option_value" INTEGER NOT NULL,
2380
    "fk_product_option_group" INTEGER NOT NULL,
2381
    "price" INTEGER,
2382
    "sku" VARCHAR(255) NOT NULL,
2383
    "value" VARCHAR(255) NOT NULL,
2384
    "created_at" TIMESTAMP,
2385
    "updated_at" TIMESTAMP,
2386
    PRIMARY KEY ("id_product_option_value"),
2387
    CONSTRAINT "spy_product_option_value-sku" UNIQUE ("sku")
2388
);
2389
2390
COMMENT ON COLUMN "spy_product_option_value"."price" IS \'Deprecated\';
2391
2392
CREATE INDEX "index-spy_product_option_value-fk_product_option_group" ON "spy_product_option_value" ("fk_product_option_group");
2393
2394
CREATE SEQUENCE "spy_product_option_value_price_pk_seq";
2395
2396
CREATE TABLE "spy_product_option_value_price"
2397
(
2398
    "id_product_option_value_price" INTEGER NOT NULL,
2399
    "fk_currency" INTEGER NOT NULL,
2400
    "fk_product_option_value" INTEGER NOT NULL,
2401
    "fk_store" INTEGER,
2402
    "gross_price" INTEGER,
2403
    "net_price" INTEGER,
2404
    PRIMARY KEY ("id_product_option_value_price"),
2405
    CONSTRAINT "spy_product_option_value_price-fk_value-fk_store-fk_currency" UNIQUE ("fk_product_option_value","fk_store","fk_currency")
2406
);
2407
2408
CREATE INDEX "index-spy_product_option_value_price-fk_currency" ON "spy_product_option_value_price" ("fk_currency");
2409
2410
CREATE INDEX "index-spy_product_option_value_price-fk_store" ON "spy_product_option_value_price" ("fk_store");
2411
2412
CREATE INDEX "index-spy_product_option_value_price-fk_product_option_value" ON "spy_product_option_value_price" ("fk_product_option_value");
2413
2414
CREATE SEQUENCE "spy_product_abstract_option_storage_pk_seq";
2415
2416
CREATE TABLE "spy_product_abstract_option_storage"
2417
(
2418
    "id_product_abstract_option_storage" INT8 NOT NULL,
2419
    "fk_product_abstract" INTEGER NOT NULL,
2420
    "data" TEXT,
2421
    "store" VARCHAR(128) NOT NULL,
2422
    "key" VARCHAR,
2423
    "created_at" TIMESTAMP,
2424
    "updated_at" TIMESTAMP,
2425
    PRIMARY KEY ("id_product_abstract_option_storage"),
2426
    CONSTRAINT "spy_product_abstract_option_storage-unique-key" UNIQUE ("key")
2427
);
2428
2429
CREATE INDEX "spy_product_abstract_option_storage-fk_product_abstract" ON "spy_product_abstract_option_storage" ("fk_product_abstract");
2430
2431
CREATE SEQUENCE "spy_product_abstract_page_search_pk_seq";
2432
2433
CREATE TABLE "spy_product_abstract_page_search"
2434
(
2435
    "id_product_abstract_page_search" INT8 NOT NULL,
2436
    "fk_product_abstract" INTEGER NOT NULL,
2437
    "structured_data" TEXT NOT NULL,
2438
    "data" TEXT,
2439
    "store" VARCHAR(128) NOT NULL,
2440
    "locale" VARCHAR(16) NOT NULL,
2441
    "key" VARCHAR,
2442
    "created_at" TIMESTAMP,
2443
    "updated_at" TIMESTAMP,
2444
    PRIMARY KEY ("id_product_abstract_page_search"),
2445
    CONSTRAINT "spy_product_abstract_page_search-unique-key" UNIQUE ("key")
2446
);
2447
2448
CREATE INDEX "spy_product_abstract_page_search-fk_product_abstract" ON "spy_product_abstract_page_search" ("fk_product_abstract");
2449
2450
CREATE SEQUENCE "spy_product_concrete_page_search_pk_seq";
2451
2452
CREATE TABLE "spy_product_concrete_page_search"
2453
(
2454
    "id_product_concrete_page_search" INT8 NOT NULL,
2455
    "fk_product" INTEGER NOT NULL,
2456
    "structured_data" TEXT NOT NULL,
2457
    "data" TEXT,
2458
    "store" VARCHAR(128) NOT NULL,
2459
    "locale" VARCHAR(16) NOT NULL,
2460
    "key" VARCHAR,
2461
    "created_at" TIMESTAMP,
2462
    "updated_at" TIMESTAMP,
2463
    PRIMARY KEY ("id_product_concrete_page_search"),
2464
    CONSTRAINT "spy_product_concrete_page_search-unique-key" UNIQUE ("key")
2465
);
2466
2467
CREATE INDEX "spy_product_concrete_page_search-fk_product" ON "spy_product_concrete_page_search" ("fk_product");
2468
2469
CREATE SEQUENCE "id_product_quantity_pk_seq";
2470
2471
CREATE TABLE "spy_product_quantity"
2472
(
2473
    "id_product_quantity" INTEGER NOT NULL,
2474
    "fk_product" INTEGER NOT NULL,
2475
    "quantity_interval" INTEGER NOT NULL,
2476
    "quantity_max" INTEGER,
2477
    "quantity_min" INTEGER NOT NULL,
2478
    "created_at" TIMESTAMP,
2479
    "updated_at" TIMESTAMP,
2480
    PRIMARY KEY ("id_product_quantity"),
2481
    CONSTRAINT "spy_product_quantity-unique-fk_product" UNIQUE ("fk_product")
2482
);
2483
2484
CREATE INDEX "index-spy_product_quantity-fk_product" ON "spy_product_quantity" ("fk_product");
2485
2486
CREATE SEQUENCE "id_product_quantity_storage_pk_seq";
2487
2488
CREATE TABLE "spy_product_quantity_storage"
2489
(
2490
    "id_product_quantity_storage" INTEGER NOT NULL,
2491
    "fk_product" INTEGER NOT NULL,
2492
    "data" TEXT,
2493
    "key" VARCHAR NOT NULL,
2494
    "created_at" TIMESTAMP,
2495
    "updated_at" TIMESTAMP,
2496
    PRIMARY KEY ("id_product_quantity_storage")
2497
);
2498
2499
CREATE INDEX "spy_product_quantity_storage-fk_product" ON "spy_product_quantity_storage" ("fk_product");
2500
2501
CREATE SEQUENCE "spy_product_relation_type_pk_seq";
2502
2503
CREATE TABLE "spy_product_relation_type"
2504
(
2505
    "id_product_relation_type" INTEGER NOT NULL,
2506
    "key" VARCHAR NOT NULL,
2507
    "created_at" TIMESTAMP,
2508
    "updated_at" TIMESTAMP,
2509
    PRIMARY KEY ("id_product_relation_type")
2510
);
2511
2512
CREATE SEQUENCE "spy_product_relation_pk_seq";
2513
2514
CREATE TABLE "spy_product_relation"
2515
(
2516
    "id_product_relation" INTEGER NOT NULL,
2517
    "fk_product_abstract" INTEGER NOT NULL,
2518
    "fk_product_relation_type" INTEGER NOT NULL,
2519
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
2520
    "is_rebuild_scheduled" BOOLEAN DEFAULT \'f\' NOT NULL,
2521
    "query_set_data" TEXT,
2522
    "created_at" TIMESTAMP,
2523
    "updated_at" TIMESTAMP,
2524
    PRIMARY KEY ("id_product_relation"),
2525
    CONSTRAINT "spy_product-relation-unique-fk_product_abstract" UNIQUE ("fk_product_abstract","fk_product_relation_type")
2526
);
2527
2528
CREATE INDEX "index-spy_product_relation-fk_product_abstract" ON "spy_product_relation" ("fk_product_abstract");
2529
2530
CREATE INDEX "index-spy_product_relation-fk_product_relation_type" ON "spy_product_relation" ("fk_product_relation_type");
2531
2532
CREATE SEQUENCE "spy_product_rel_prod_abs_type_pk_seq";
2533
2534
CREATE TABLE "spy_product_relation_product_abstract"
2535
(
2536
    "id_product_relation_product_abstract" INTEGER NOT NULL,
2537
    "fk_product_abstract" INTEGER NOT NULL,
2538
    "fk_product_relation" INTEGER NOT NULL,
2539
    "order" INTEGER NOT NULL,
2540
    "created_at" TIMESTAMP,
2541
    "updated_at" TIMESTAMP,
2542
    PRIMARY KEY ("id_product_relation_product_abstract")
2543
);
2544
2545
CREATE INDEX "index-spy_product_relation_product_abstract-fk_product_relation" ON "spy_product_relation_product_abstract" ("fk_product_relation");
2546
2547
CREATE INDEX "index-spy_product_relation_product_abstract-fk_product_abstract" ON "spy_product_relation_product_abstract" ("fk_product_abstract");
2548
2549
CREATE SEQUENCE "spy_product_abstract_relation_storage_pk_seq";
2550
2551
CREATE TABLE "spy_product_abstract_relation_storage"
2552
(
2553
    "id_product_abstract_relation_storage" INT8 NOT NULL,
2554
    "fk_product_abstract" INTEGER NOT NULL,
2555
    "data" TEXT,
2556
    "key" VARCHAR,
2557
    "created_at" TIMESTAMP,
2558
    "updated_at" TIMESTAMP,
2559
    PRIMARY KEY ("id_product_abstract_relation_storage"),
2560
    CONSTRAINT "spy_product_abstract_relation_storage-unique-key" UNIQUE ("key")
2561
);
2562
2563
CREATE INDEX "spy_product_abstract_relation_storage-fk_product_abstract" ON "spy_product_abstract_relation_storage" ("fk_product_abstract");
2564
2565
CREATE SEQUENCE "id_product_review_pk_seq";
2566
2567
CREATE TABLE "spy_product_review"
2568
(
2569
    "id_product_review" INTEGER NOT NULL,
2570
    "fk_locale" INTEGER NOT NULL,
2571
    "fk_product_abstract" INTEGER NOT NULL,
2572
    "customer_reference" VARCHAR(255) NOT NULL,
2573
    "description" TEXT,
2574
    "nickname" VARCHAR(255),
2575
    "rating" INTEGER DEFAULT 0 NOT NULL,
2576
    "status" INT2 DEFAULT 0 NOT NULL,
2577
    "summary" TEXT,
2578
    "created_at" TIMESTAMP,
2579
    "updated_at" TIMESTAMP,
2580
    PRIMARY KEY ("id_product_review")
2581
);
2582
2583
CREATE INDEX "spy_product_review-fk_product_abstract" ON "spy_product_review" ("fk_product_abstract");
2584
2585
CREATE INDEX "spy_product_review-fk_locale" ON "spy_product_review" ("fk_locale");
2586
2587
CREATE INDEX "spy_product_review-customer_reference" ON "spy_product_review" ("customer_reference");
2588
2589
CREATE SEQUENCE "spy_product_review_search_pk_seq";
2590
2591
CREATE TABLE "spy_product_review_search"
2592
(
2593
    "id_product_review_search" INT8 NOT NULL,
2594
    "fk_product_review" INTEGER NOT NULL,
2595
    "structured_data" TEXT NOT NULL,
2596
    "data" TEXT,
2597
    "key" VARCHAR,
2598
    "created_at" TIMESTAMP,
2599
    "updated_at" TIMESTAMP,
2600
    PRIMARY KEY ("id_product_review_search"),
2601
    CONSTRAINT "spy_product_review_search-unique-key" UNIQUE ("key")
2602
);
2603
2604
CREATE INDEX "spy_product_review_search-fk_product_review" ON "spy_product_review_search" ("fk_product_review");
2605
2606
CREATE SEQUENCE "spy_product_abstract_review_storage_pk_seq";
2607
2608
CREATE TABLE "spy_product_abstract_review_storage"
2609
(
2610
    "id_product_abstract_review_storage" INT8 NOT NULL,
2611
    "fk_product_abstract" INTEGER NOT NULL,
2612
    "data" TEXT,
2613
    "key" VARCHAR,
2614
    "created_at" TIMESTAMP,
2615
    "updated_at" TIMESTAMP,
2616
    PRIMARY KEY ("id_product_abstract_review_storage"),
2617
    CONSTRAINT "spy_product_abstract_review_storage-unique-key" UNIQUE ("key")
2618
);
2619
2620
CREATE INDEX "spy_product_abstract_review_storage-fk_product_abstract" ON "spy_product_abstract_review_storage" ("fk_product_abstract");
2621
2622
CREATE SEQUENCE "spy_product_search_pk_seq";
2623
2624
CREATE TABLE "spy_product_search"
2625
(
2626
    "id_product_search" INTEGER NOT NULL,
2627
    "fk_locale" INTEGER,
2628
    "fk_product" INTEGER,
2629
    "is_searchable" BOOLEAN DEFAULT \'t\',
2630
    PRIMARY KEY ("id_product_search")
2631
);
2632
2633
CREATE INDEX "spy_product_search-index-fk-product-fk-locale-is_searchable" ON "spy_product_search" ("fk_product","fk_locale","is_searchable");
2634
2635
CREATE TABLE "spy_product_search_attribute_map"
2636
(
2637
    "fk_product_attribute_key" INTEGER NOT NULL,
2638
    "synced" BOOLEAN DEFAULT \'f\',
2639
    "target_field" VARCHAR NOT NULL,
2640
    PRIMARY KEY ("fk_product_attribute_key","target_field")
2641
);
2642
2643
CREATE INDEX "spy_product_search_attribute_map_i_a1d33d" ON "spy_product_search_attribute_map" ("fk_product_attribute_key");
2644
2645
CREATE SEQUENCE "spy_product_search_attribute_pk_seq";
2646
2647
CREATE TABLE "spy_product_search_attribute"
2648
(
2649
    "id_product_search_attribute" INTEGER NOT NULL,
2650
    "fk_product_attribute_key" INTEGER NOT NULL,
2651
    "filter_type" VARCHAR NOT NULL,
2652
    "position" INTEGER DEFAULT 0 NOT NULL,
2653
    "synced" BOOLEAN DEFAULT \'f\',
2654
    PRIMARY KEY ("id_product_search_attribute"),
2655
    CONSTRAINT "spy_product_search_attribute-unique-fk_product_attribute_key" UNIQUE ("fk_product_attribute_key")
2656
);
2657
2658
CREATE SEQUENCE "spy_product_search_config_storage_pk_seq";
2659
2660
CREATE TABLE "spy_product_search_config_storage"
2661
(
2662
    "id_product_search_config_storage" INT8 NOT NULL,
2663
    "data" TEXT,
2664
    "key" VARCHAR,
2665
    "created_at" TIMESTAMP,
2666
    "updated_at" TIMESTAMP,
2667
    PRIMARY KEY ("id_product_search_config_storage"),
2668
    CONSTRAINT "spy_product_search_config_storage-unique-key" UNIQUE ("key")
2669
);
2670
2671
CREATE SEQUENCE "spy_product_set_pk_seq";
2672
2673
CREATE TABLE "spy_product_set"
2674
(
2675
    "id_product_set" INTEGER NOT NULL,
2676
    "is_active" BOOLEAN DEFAULT \'f\' NOT NULL,
2677
    "product_set_key" VARCHAR(255) NOT NULL,
2678
    "weight" INTEGER DEFAULT 0 NOT NULL,
2679
    "created_at" TIMESTAMP,
2680
    "updated_at" TIMESTAMP,
2681
    PRIMARY KEY ("id_product_set"),
2682
    CONSTRAINT "spy_product_set-product_set_key" UNIQUE ("product_set_key")
2683
);
2684
2685
CREATE SEQUENCE "spy_product_abstract_set_pk_seq";
2686
2687
CREATE TABLE "spy_product_abstract_set"
2688
(
2689
    "id_product_abstract_set" INTEGER NOT NULL,
2690
    "fk_product_abstract" INTEGER NOT NULL,
2691
    "fk_product_set" INTEGER NOT NULL,
2692
    "position" INTEGER DEFAULT 0 NOT NULL,
2693
    PRIMARY KEY ("id_product_abstract_set"),
2694
    CONSTRAINT "spy_product_abstract_set-unique-fk_product_set" UNIQUE ("fk_product_set","fk_product_abstract")
2695
);
2696
2697
CREATE INDEX "spy_product_abstract_set-fk_product_set" ON "spy_product_abstract_set" ("fk_product_set");
2698
2699
CREATE INDEX "spy_product_abstract_set-fk_product_abstract" ON "spy_product_abstract_set" ("fk_product_abstract");
2700
2701
CREATE SEQUENCE "spy_product_set_data_pk_seq";
2702
2703
CREATE TABLE "spy_product_set_data"
2704
(
2705
    "id_product_set_data" INTEGER NOT NULL,
2706
    "fk_locale" INTEGER NOT NULL,
2707
    "fk_product_set" INTEGER NOT NULL,
2708
    "description" TEXT,
2709
    "meta_description" TEXT,
2710
    "meta_keywords" TEXT,
2711
    "meta_title" VARCHAR(255),
2712
    "name" VARCHAR NOT NULL,
2713
    "created_at" TIMESTAMP,
2714
    "updated_at" TIMESTAMP,
2715
    PRIMARY KEY ("id_product_set_data"),
2716
    CONSTRAINT "spy_product_set_data-unique-fk_product_set" UNIQUE ("fk_product_set","fk_locale")
2717
);
2718
2719
CREATE INDEX "spy_product_set_data-fk_product_set" ON "spy_product_set_data" ("fk_product_set");
2720
2721
CREATE INDEX "spy_product_set_data-fk_locale" ON "spy_product_set_data" ("fk_locale");
2722
2723
CREATE SEQUENCE "spy_product_set_page_search_pk_seq";
2724
2725
CREATE TABLE "spy_product_set_page_search"
2726
(
2727
    "id_product_set_page_search" INT8 NOT NULL,
2728
    "fk_product_set" INTEGER NOT NULL,
2729
    "structured_data" TEXT NOT NULL,
2730
    "data" TEXT,
2731
    "locale" VARCHAR(16) NOT NULL,
2732
    "key" VARCHAR,
2733
    "created_at" TIMESTAMP,
2734
    "updated_at" TIMESTAMP,
2735
    PRIMARY KEY ("id_product_set_page_search"),
2736
    CONSTRAINT "spy_product_set_page_search-unique-key" UNIQUE ("key")
2737
);
2738
2739
CREATE INDEX "spy_product_set_page_search-fk_product_set" ON "spy_product_set_page_search" ("fk_product_set");
2740
2741
CREATE SEQUENCE "spy_product_set_storage_pk_seq";
2742
2743
CREATE TABLE "spy_product_set_storage"
2744
(
2745
    "id_product_set_storage" INT8 NOT NULL,
2746
    "fk_product_set" INTEGER NOT NULL,
2747
    "data" TEXT,
2748
    "locale" VARCHAR(16) NOT NULL,
2749
    "key" VARCHAR,
2750
    "created_at" TIMESTAMP,
2751
    "updated_at" TIMESTAMP,
2752
    PRIMARY KEY ("id_product_set_storage"),
2753
    CONSTRAINT "spy_product_set_storage-unique-key" UNIQUE ("key")
2754
);
2755
2756
CREATE INDEX "spy_product_set_storage-fk_product_set" ON "spy_product_set_storage" ("fk_product_set");
2757
2758
CREATE SEQUENCE "spy_product_abstract_storage_pk_seq";
2759
2760
CREATE TABLE "spy_product_abstract_storage"
2761
(
2762
    "id_product_abstract_storage" INT8 NOT NULL,
2763
    "fk_product_abstract" INTEGER NOT NULL,
2764
    "data" TEXT,
2765
    "store" VARCHAR(128) NOT NULL,
2766
    "locale" VARCHAR(16) NOT NULL,
2767
    "key" VARCHAR,
2768
    "created_at" TIMESTAMP,
2769
    "updated_at" TIMESTAMP,
2770
    PRIMARY KEY ("id_product_abstract_storage"),
2771
    CONSTRAINT "spy_product_abstract_storage-unique-key" UNIQUE ("key")
2772
);
2773
2774
CREATE INDEX "spy_product_abstract_storage-fk_product_abstract" ON "spy_product_abstract_storage" ("fk_product_abstract");
2775
2776
CREATE SEQUENCE "spy_product_concrete_storage_pk_seq";
2777
2778
CREATE TABLE "spy_product_concrete_storage"
2779
(
2780
    "id_product_concrete_storage" INT8 NOT NULL,
2781
    "fk_product" INTEGER NOT NULL,
2782
    "data" TEXT,
2783
    "locale" VARCHAR(16) NOT NULL,
2784
    "key" VARCHAR,
2785
    "created_at" TIMESTAMP,
2786
    "updated_at" TIMESTAMP,
2787
    PRIMARY KEY ("id_product_concrete_storage"),
2788
    CONSTRAINT "spy_product_concrete_storage-unique-key" UNIQUE ("key")
2789
);
2790
2791
CREATE INDEX "spy_product_concrete_storage-fk_product" ON "spy_product_concrete_storage" ("fk_product");
2792
2793
CREATE SEQUENCE "spy_product_validity_pk_seq";
2794
2795
CREATE TABLE "spy_product_validity"
2796
(
2797
    "id_product_validity" INTEGER NOT NULL,
2798
    "fk_product" INTEGER NOT NULL,
2799
    "valid_from" TIMESTAMP,
2800
    "valid_to" TIMESTAMP,
2801
    PRIMARY KEY ("id_product_validity"),
2802
    CONSTRAINT "spy_product_validity-fk_product-unique" UNIQUE ("fk_product")
2803
);
2804
2805
CREATE INDEX "index-spy_product_validity-fk_product" ON "spy_product_validity" ("fk_product");
2806
2807
CREATE TABLE "spy_propel_heartbeat"
2808
(
2809
    "heartbeat_check" VARCHAR NOT NULL,
2810
    PRIMARY KEY ("heartbeat_check")
2811
);
2812
2813
CREATE SEQUENCE "spy_queue_process_pk_seq";
2814
2815
CREATE TABLE "spy_queue_process"
2816
(
2817
    "id_queue_process" INTEGER NOT NULL,
2818
    "server_id" VARCHAR(255) NOT NULL,
2819
    "process_pid" INTEGER NOT NULL,
2820
    "worker_pid" INTEGER NOT NULL,
2821
    "queue_name" VARCHAR(255) NOT NULL,
2822
    "created_at" TIMESTAMP,
2823
    "updated_at" TIMESTAMP,
2824
    PRIMARY KEY ("id_queue_process"),
2825
    CONSTRAINT "spy_queue_process-unique-key" UNIQUE ("server_id","process_pid","queue_name")
2826
);
2827
2828
CREATE INDEX "spy_queue_process-index-key" ON "spy_queue_process" ("server_id","queue_name");
2829
2830
CREATE SEQUENCE "id_quote_pk_seq";
2831
2832
CREATE TABLE "spy_quote"
2833
(
2834
    "id_quote" INTEGER NOT NULL,
2835
    "fk_store" INTEGER NOT NULL,
2836
    "customer_reference" VARCHAR(255) NOT NULL,
2837
    "quote_data" TEXT NOT NULL,
2838
    "uuid" VARCHAR(255),
2839
    "created_at" TIMESTAMP,
2840
    "updated_at" TIMESTAMP,
2841
    PRIMARY KEY ("id_quote"),
2842
    CONSTRAINT "spy_quote-unique-uuid" UNIQUE ("uuid")
2843
);
2844
2845
CREATE INDEX "spy_quote-fk_store" ON "spy_quote" ("fk_store");
2846
2847
CREATE INDEX "spy_quote-customer_reference" ON "spy_quote" ("customer_reference");
2848
2849
CREATE SEQUENCE "spy_refund_pk_seq";
2850
2851
CREATE TABLE "spy_refund"
2852
(
2853
    "id_refund" INTEGER NOT NULL,
2854
    "fk_sales_order" INTEGER NOT NULL,
2855
    "amount" INTEGER NOT NULL,
2856
    "comment" VARCHAR,
2857
    "created_at" TIMESTAMP,
2858
    PRIMARY KEY ("id_refund")
2859
);
2860
2861
CREATE INDEX "index-spy_refund-fk_sales_order" ON "spy_refund" ("fk_sales_order");
2862
2863
CREATE SEQUENCE "spy_sales_order_pk_seq";
2864
2865
CREATE TABLE "spy_sales_order"
2866
(
2867
    "id_sales_order" INTEGER NOT NULL,
2868
    "fk_locale" INTEGER,
2869
    "fk_sales_order_address_billing" INTEGER NOT NULL,
2870
    "fk_sales_order_address_shipping" INTEGER NOT NULL,
2871
    "cart_note" VARCHAR(255),
2872
    "currency_iso_code" VARCHAR(5),
2873
    "customer_reference" VARCHAR(255),
2874
    "email" VARCHAR(255),
2875
    "first_name" VARCHAR(100),
2876
    "is_test" BOOLEAN DEFAULT \'f\' NOT NULL,
2877
    "last_name" VARCHAR(100),
2878
    "order_reference" VARCHAR(45) NOT NULL,
2879
    "price_mode" INT2,
2880
    "salutation" INT2,
2881
    "store" VARCHAR(255),
2882
    "created_at" TIMESTAMP,
2883
    "updated_at" TIMESTAMP,
2884
    PRIMARY KEY ("id_sales_order"),
2885
    CONSTRAINT "spy_sales_order-order_reference" UNIQUE ("order_reference")
2886
);
2887
2888
CREATE INDEX "spy_sales_order-customer_reference" ON "spy_sales_order" ("customer_reference");
2889
2890
CREATE INDEX "spy_sales_order-store" ON "spy_sales_order" ("store");
2891
2892
CREATE INDEX "spy_sales_order-currency_iso_code" ON "spy_sales_order" ("currency_iso_code");
2893
2894
CREATE INDEX "index-spy_sales_order-fk_sales_order_address_billing" ON "spy_sales_order" ("fk_sales_order_address_billing");
2895
2896
CREATE INDEX "index-spy_sales_order-fk_sales_order_address_shipping" ON "spy_sales_order" ("fk_sales_order_address_shipping");
2897
2898
CREATE INDEX "index-spy_sales_order-fk_locale" ON "spy_sales_order" ("fk_locale");
2899
2900
CREATE SEQUENCE "spy_sales_order_item_pk_seq";
2901
2902
CREATE TABLE "spy_sales_order_item"
2903
(
2904
    "id_sales_order_item" INTEGER NOT NULL,
2905
    "fk_oms_order_item_state" INTEGER NOT NULL,
2906
    "fk_oms_order_process" INTEGER,
2907
    "fk_sales_order" INTEGER NOT NULL,
2908
    "fk_sales_order_item_bundle" INTEGER,
2909
    "canceled_amount" INTEGER DEFAULT 0,
2910
    "cart_note" VARCHAR(255),
2911
    "discount_amount_aggregation" INTEGER DEFAULT 0,
2912
    "discount_amount_full_aggregation" INTEGER DEFAULT 0,
2913
    "expense_price_aggregation" INTEGER DEFAULT 0,
2914
    "gross_price" INTEGER NOT NULL,
2915
    "group_key" VARCHAR(255),
2916
    "is_quantity_splittable" BOOLEAN DEFAULT \'t\' NOT NULL,
2917
    "last_state_change" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
2918
    "name" VARCHAR(255) NOT NULL,
2919
    "net_price" INTEGER DEFAULT 0,
2920
    "price" INTEGER DEFAULT 0,
2921
    "price_to_pay_aggregation" INTEGER DEFAULT 0,
2922
    "product_option_price_aggregation" INTEGER DEFAULT 0,
2923
    "quantity" INTEGER DEFAULT 1 NOT NULL,
2924
    "refundable_amount" INTEGER DEFAULT 0,
2925
    "sku" VARCHAR(255) NOT NULL,
2926
    "subtotal_aggregation" INTEGER,
2927
    "tax_amount" INTEGER DEFAULT 0,
2928
    "tax_amount_after_cancellation" INTEGER DEFAULT 0,
2929
    "tax_amount_full_aggregation" INTEGER DEFAULT 0,
2930
    "tax_rate" NUMERIC(8,2),
2931
    "tax_rate_average_aggregation" NUMERIC(8,2),
2932
    "created_at" TIMESTAMP,
2933
    "updated_at" TIMESTAMP,
2934
    PRIMARY KEY ("id_sales_order_item")
2935
);
2936
2937
COMMENT ON COLUMN "spy_sales_order_item"."discount_amount_aggregation" IS \'/Total discount amount for item/\';
2938
2939
COMMENT ON COLUMN "spy_sales_order_item"."discount_amount_full_aggregation" IS \'/Total discount amount for item with options or item expenses/\';
2940
2941
COMMENT ON COLUMN "spy_sales_order_item"."expense_price_aggregation" IS \'/Total price amount for item from item expenses/\';
2942
2943
COMMENT ON COLUMN "spy_sales_order_item"."gross_price" IS \'/price for one unit including tax, without shipping, coupons/\';
2944
2945
COMMENT ON COLUMN "spy_sales_order_item"."net_price" IS \'/Price for one unit not including tax, without shipping, coupons/\';
2946
2947
COMMENT ON COLUMN "spy_sales_order_item"."price" IS \'/Price for item, can be gross or net price depending on tax mode/\';
2948
2949
COMMENT ON COLUMN "spy_sales_order_item"."price_to_pay_aggregation" IS \'/Total item price to pay after discounts including options or item expenses/\';
2950
2951
COMMENT ON COLUMN "spy_sales_order_item"."product_option_price_aggregation" IS \'/Total price amount for item from options/\';
2952
2953
COMMENT ON COLUMN "spy_sales_order_item"."quantity" IS \'/Quantity ordered for item/\';
2954
2955
COMMENT ON COLUMN "spy_sales_order_item"."refundable_amount" IS \'/Total item refundable amount/\';
2956
2957
COMMENT ON COLUMN "spy_sales_order_item"."subtotal_aggregation" IS \'/Subtotal price amount (item + options + item expenses) before discounts/\';
2958
2959
COMMENT ON COLUMN "spy_sales_order_item"."tax_amount" IS \'/Calculated tax amount based on tax mode/\';
2960
2961
COMMENT ON COLUMN "spy_sales_order_item"."tax_amount_after_cancellation" IS \'/Calculated tax full amount based on tax mode, includes options, item expenses, /\';
2962
2963
COMMENT ON COLUMN "spy_sales_order_item"."tax_amount_full_aggregation" IS \'/Calculated tax full amount based on tax mode, includes options, item expenses/\';
2964
2965
COMMENT ON COLUMN "spy_sales_order_item"."tax_rate_average_aggregation" IS \'/Calculated tax rate, includes options, item expenses, /\';
2966
2967
CREATE INDEX "spy_sales_order_item-sku" ON "spy_sales_order_item" ("sku");
2968
2969
CREATE INDEX "index-spy_sales_order_item-fk_sales_order_item_bundle" ON "spy_sales_order_item" ("fk_sales_order_item_bundle");
2970
2971
CREATE INDEX "index-spy_sales_order_item-fk_sales_order" ON "spy_sales_order_item" ("fk_sales_order");
2972
2973
CREATE INDEX "index-spy_sales_order_item-fk_oms_order_item_state" ON "spy_sales_order_item" ("fk_oms_order_item_state");
2974
2975
CREATE INDEX "index-spy_sales_order_item-fk_oms_order_process" ON "spy_sales_order_item" ("fk_oms_order_process");
2976
2977
CREATE SEQUENCE "spy_sales_discount_pk_seq";
2978
2979
CREATE TABLE "spy_sales_discount"
2980
(
2981
    "id_sales_discount" INTEGER NOT NULL,
2982
    "fk_sales_expense" INTEGER,
2983
    "fk_sales_order" INTEGER,
2984
    "fk_sales_order_item" INTEGER,
2985
    "fk_sales_order_item_option" INTEGER,
2986
    "amount" INTEGER NOT NULL,
2987
    "description" VARCHAR(510),
2988
    "display_name" VARCHAR(255) NOT NULL,
2989
    "name" VARCHAR(255) NOT NULL,
2990
    "created_at" TIMESTAMP,
2991
    "updated_at" TIMESTAMP,
2992
    PRIMARY KEY ("id_sales_discount")
2993
);
2994
2995
CREATE INDEX "index-spy_sales_discount-fk_sales_order" ON "spy_sales_discount" ("fk_sales_order");
2996
2997
CREATE INDEX "index-spy_sales_discount-fk_sales_order_item" ON "spy_sales_discount" ("fk_sales_order_item");
2998
2999
CREATE INDEX "index-spy_sales_discount-fk_sales_expense" ON "spy_sales_discount" ("fk_sales_expense");
3000
3001
CREATE INDEX "index-spy_sales_discount-fk_sales_order_item_option" ON "spy_sales_discount" ("fk_sales_order_item_option");
3002
3003
CREATE SEQUENCE "spy_sales_discount_code_pk_seq";
3004
3005
CREATE TABLE "spy_sales_discount_code"
3006
(
3007
    "id_sales_discount_code" INTEGER NOT NULL,
3008
    "fk_sales_discount" INTEGER NOT NULL,
3009
    "code" VARCHAR(255) NOT NULL,
3010
    "codepool_name" VARCHAR(255) NOT NULL,
3011
    "is_once_per_customer" BOOLEAN DEFAULT \'t\',
3012
    "is_refundable" BOOLEAN DEFAULT \'f\',
3013
    "is_reusable" BOOLEAN DEFAULT \'f\',
3014
    "created_at" TIMESTAMP,
3015
    "updated_at" TIMESTAMP,
3016
    PRIMARY KEY ("id_sales_discount_code")
3017
);
3018
3019
CREATE INDEX "index-spy_sales_discount_code-fk_sales_discount" ON "spy_sales_discount_code" ("fk_sales_discount");
3020
3021
CREATE SEQUENCE "spy_sales_order_item_gift_card_pk_seq";
3022
3023
CREATE TABLE "spy_sales_order_item_gift_card"
3024
(
3025
    "id_sales_order_item_gift_card" INTEGER NOT NULL,
3026
    "fk_sales_order_item" INTEGER NOT NULL,
3027
    "attributes" TEXT,
3028
    "code" VARCHAR(40),
3029
    "pattern" VARCHAR(40),
3030
    "value" INTEGER,
3031
    PRIMARY KEY ("id_sales_order_item_gift_card")
3032
);
3033
3034
CREATE INDEX "index-spy_sales_order_item_gift_card-fk_sales_order_item" ON "spy_sales_order_item_gift_card" ("fk_sales_order_item");
3035
3036
CREATE SEQUENCE "spy_sales_order_item_option_pk_seq";
3037
3038
CREATE TABLE "spy_sales_order_item_option"
3039
(
3040
    "id_sales_order_item_option" INTEGER NOT NULL,
3041
    "fk_sales_order_item" INTEGER NOT NULL,
3042
    "canceled_amount" INTEGER DEFAULT 0,
3043
    "discount_amount_aggregation" INTEGER DEFAULT 0,
3044
    "gross_price" INTEGER DEFAULT 0 NOT NULL,
3045
    "group_name" VARCHAR NOT NULL,
3046
    "net_price" INTEGER DEFAULT 0,
3047
    "price" INTEGER DEFAULT 0,
3048
    "sku" VARCHAR(255) NOT NULL,
3049
    "tax_amount" INTEGER DEFAULT 0,
3050
    "tax_rate" NUMERIC(8,2) NOT NULL,
3051
    "value" VARCHAR NOT NULL,
3052
    "created_at" TIMESTAMP,
3053
    "updated_at" TIMESTAMP,
3054
    PRIMARY KEY ("id_sales_order_item_option")
3055
);
3056
3057
COMMENT ON COLUMN "spy_sales_order_item_option"."discount_amount_aggregation" IS \'/Total discount amount for item/\';
3058
3059
COMMENT ON COLUMN "spy_sales_order_item_option"."net_price" IS \'/Price for one unit not including tax, without shipping, coupons/\';
3060
3061
COMMENT ON COLUMN "spy_sales_order_item_option"."price" IS \'/Price for item, can be gross or net price depending on tax mode/\';
3062
3063
COMMENT ON COLUMN "spy_sales_order_item_option"."tax_amount" IS \'/Calculated tax amount based on tax mode/\';
3064
3065
CREATE INDEX "index-spy_sales_order_item_option-fk_sales_order_item" ON "spy_sales_order_item_option" ("fk_sales_order_item");
3066
3067
CREATE SEQUENCE "spy_sales_order_address_pk_seq";
3068
3069
CREATE TABLE "spy_sales_order_address"
3070
(
3071
    "id_sales_order_address" INTEGER NOT NULL,
3072
    "fk_country" INTEGER NOT NULL,
3073
    "fk_region" INTEGER,
3074
    "address1" VARCHAR(255),
3075
    "address2" VARCHAR(255),
3076
    "address3" VARCHAR(255),
3077
    "cell_phone" VARCHAR(255),
3078
    "city" VARCHAR(255) NOT NULL,
3079
    "comment" VARCHAR(255),
3080
    "company" VARCHAR(255),
3081
    "description" VARCHAR(255),
3082
    "email" VARCHAR(255),
3083
    "first_name" VARCHAR(100) NOT NULL,
3084
    "last_name" VARCHAR(100) NOT NULL,
3085
    "middle_name" VARCHAR(100),
3086
    "phone" VARCHAR(255),
3087
    "po_box" VARCHAR(255),
3088
    "salutation" INT2,
3089
    "zip_code" VARCHAR(15) NOT NULL,
3090
    "created_at" TIMESTAMP,
3091
    "updated_at" TIMESTAMP,
3092
    PRIMARY KEY ("id_sales_order_address")
3093
);
3094
3095
CREATE INDEX "index-spy_sales_order_address-fk_country" ON "spy_sales_order_address" ("fk_country");
3096
3097
CREATE INDEX "index-spy_sales_order_address-fk_region" ON "spy_sales_order_address" ("fk_region");
3098
3099
CREATE SEQUENCE "spy_sales_order_address_history_pk_seq";
3100
3101
CREATE TABLE "spy_sales_order_address_history"
3102
(
3103
    "id_sales_order_address_history" INTEGER NOT NULL,
3104
    "fk_country" INTEGER NOT NULL,
3105
    "fk_region" INTEGER,
3106
    "fk_sales_order_address" INTEGER NOT NULL,
3107
    "address1" VARCHAR(255),
3108
    "address2" VARCHAR(255),
3109
    "address3" VARCHAR(255),
3110
    "cell_phone" VARCHAR(255),
3111
    "city" VARCHAR(255) NOT NULL,
3112
    "comment" VARCHAR(255),
3113
    "company" VARCHAR(255),
3114
    "description" VARCHAR(255),
3115
    "email" VARCHAR(255),
3116
    "first_name" VARCHAR(100) NOT NULL,
3117
    "is_billing" BOOLEAN DEFAULT \'f\',
3118
    "last_name" VARCHAR(100) NOT NULL,
3119
    "middle_name" VARCHAR(100),
3120
    "phone" VARCHAR(255),
3121
    "po_box" VARCHAR(255),
3122
    "salutation" INT2,
3123
    "zip_code" VARCHAR(15) NOT NULL,
3124
    "created_at" TIMESTAMP,
3125
    "updated_at" TIMESTAMP,
3126
    PRIMARY KEY ("id_sales_order_address_history")
3127
);
3128
3129
CREATE INDEX "index-spy_sales_order_address_history-fk_country" ON "spy_sales_order_address_history" ("fk_country");
3130
3131
CREATE INDEX "index-spy_sales_order_address_history-fk_sales_order_address" ON "spy_sales_order_address_history" ("fk_sales_order_address");
3132
3133
CREATE INDEX "index-spy_sales_order_address_history-fk_region" ON "spy_sales_order_address_history" ("fk_region");
3134
3135
CREATE SEQUENCE "spy_sales_order_totals_pk_seq";
3136
3137
CREATE TABLE "spy_sales_order_totals"
3138
(
3139
    "id_sales_order_totals" INTEGER NOT NULL,
3140
    "fk_sales_order" INTEGER DEFAULT 0 NOT NULL,
3141
    "canceled_total" INTEGER DEFAULT 0,
3142
    "discount_total" INTEGER DEFAULT 0,
3143
    "grand_total" INTEGER DEFAULT 0,
3144
    "order_expense_total" INTEGER DEFAULT 0,
3145
    "refund_total" INTEGER DEFAULT 0,
3146
    "subtotal" INTEGER DEFAULT 0,
3147
    "tax_total" INTEGER DEFAULT 0,
3148
    "created_at" TIMESTAMP,
3149
    "updated_at" TIMESTAMP,
3150
    PRIMARY KEY ("id_sales_order_totals")
3151
);
3152
3153
CREATE INDEX "index-spy_sales_order_totals-fk_sales_order" ON "spy_sales_order_totals" ("fk_sales_order");
3154
3155
CREATE SEQUENCE "spy_sales_order_note_pk_seq";
3156
3157
CREATE TABLE "spy_sales_order_note"
3158
(
3159
    "id_sales_order_note" INTEGER NOT NULL,
3160
    "fk_sales_order" INTEGER NOT NULL,
3161
    "command" VARCHAR(255) NOT NULL,
3162
    "message" VARCHAR(255) NOT NULL,
3163
    "success" BOOLEAN NOT NULL,
3164
    "created_at" TIMESTAMP,
3165
    "updated_at" TIMESTAMP,
3166
    PRIMARY KEY ("id_sales_order_note")
3167
);
3168
3169
CREATE INDEX "index-spy_sales_order_note-fk_sales_order" ON "spy_sales_order_note" ("fk_sales_order");
3170
3171
CREATE SEQUENCE "spy_sales_order_comment_pk_seq";
3172
3173
CREATE TABLE "spy_sales_order_comment"
3174
(
3175
    "id_sales_order_comment" INTEGER NOT NULL,
3176
    "fk_sales_order" INTEGER NOT NULL,
3177
    "message" TEXT NOT NULL,
3178
    "username" VARCHAR,
3179
    "created_at" TIMESTAMP,
3180
    "updated_at" TIMESTAMP,
3181
    PRIMARY KEY ("id_sales_order_comment")
3182
);
3183
3184
CREATE INDEX "index-spy_sales_order_comment-fk_sales_order" ON "spy_sales_order_comment" ("fk_sales_order");
3185
3186
CREATE SEQUENCE "spy_sales_expense_pk_seq";
3187
3188
CREATE TABLE "spy_sales_expense"
3189
(
3190
    "id_sales_expense" INTEGER NOT NULL,
3191
    "fk_sales_order" INTEGER,
3192
    "canceled_amount" INTEGER DEFAULT 0,
3193
    "discount_amount_aggregation" INTEGER DEFAULT 0,
3194
    "gross_price" INTEGER NOT NULL,
3195
    "name" VARCHAR(255),
3196
    "net_price" INTEGER DEFAULT 0,
3197
    "price" INTEGER DEFAULT 0,
3198
    "price_to_pay_aggregation" INTEGER DEFAULT 0,
3199
    "refundable_amount" INTEGER DEFAULT 0,
3200
    "tax_amount" INTEGER DEFAULT 0,
3201
    "tax_amount_after_cancellation" INTEGER DEFAULT 0,
3202
    "tax_rate" NUMERIC(8,2),
3203
    "type" VARCHAR(150),
3204
    "created_at" TIMESTAMP,
3205
    "updated_at" TIMESTAMP,
3206
    PRIMARY KEY ("id_sales_expense")
3207
);
3208
3209
COMMENT ON COLUMN "spy_sales_expense"."discount_amount_aggregation" IS \'/Total discount amount for item/\';
3210
3211
COMMENT ON COLUMN "spy_sales_expense"."net_price" IS \'/Price for one unit not including tax, without shipping, coupons/\';
3212
3213
COMMENT ON COLUMN "spy_sales_expense"."price" IS \'/Price for item, can be gross or net price depending on tax mode/\';
3214
3215
COMMENT ON COLUMN "spy_sales_expense"."price_to_pay_aggregation" IS \'/Total item price to pay after discounts/\';
3216
3217
COMMENT ON COLUMN "spy_sales_expense"."refundable_amount" IS \'/Total item refundable amount/\';
3218
3219
COMMENT ON COLUMN "spy_sales_expense"."tax_amount" IS \'/Calculated tax amount based on tax mode/\';
3220
3221
COMMENT ON COLUMN "spy_sales_expense"."tax_amount_after_cancellation" IS \'/Calculated tax full amount based on tax mode, includes options, item expenses, /\';
3222
3223
CREATE INDEX "spy_sales_expense-index-fk_sales_order" ON "spy_sales_expense" ("fk_sales_order","type");
3224
3225
CREATE SEQUENCE "spy_sales_order_item_metadata_pk_seq";
3226
3227
CREATE TABLE "spy_sales_order_item_metadata"
3228
(
3229
    "id_sales_order_item_metadata" INTEGER NOT NULL,
3230
    "fk_sales_order_item" INTEGER NOT NULL,
3231
    "image" TEXT,
3232
    "super_attributes" TEXT NOT NULL,
3233
    "created_at" TIMESTAMP,
3234
    "updated_at" TIMESTAMP,
3235
    PRIMARY KEY ("id_sales_order_item_metadata")
3236
);
3237
3238
CREATE INDEX "spy_sales_order_item_metadata-index-fk_sales_order_item" ON "spy_sales_order_item_metadata" ("fk_sales_order_item");
3239
3240
CREATE SEQUENCE "spy_sales_shipment_pk_seq";
3241
3242
CREATE TABLE "spy_sales_shipment"
3243
(
3244
    "id_sales_shipment" INTEGER NOT NULL,
3245
    "fk_sales_expense" INTEGER,
3246
    "fk_sales_order" INTEGER NOT NULL,
3247
    "carrier_name" VARCHAR(255),
3248
    "delivery_time" VARCHAR(255),
3249
    "name" VARCHAR(255),
3250
    "created_at" TIMESTAMP,
3251
    "updated_at" TIMESTAMP,
3252
    PRIMARY KEY ("id_sales_shipment")
3253
);
3254
3255
CREATE INDEX "index-spy_sales_shipment-fk_sales_order" ON "spy_sales_shipment" ("fk_sales_order");
3256
3257
CREATE INDEX "index-spy_sales_shipment-fk_sales_expense" ON "spy_sales_shipment" ("fk_sales_expense");
3258
3259
CREATE SEQUENCE "id_sales_order_threshold_pk_seq";
3260
3261
CREATE TABLE "spy_sales_order_threshold"
3262
(
3263
    "id_sales_order_threshold" INTEGER NOT NULL,
3264
    "fk_currency" INTEGER NOT NULL,
3265
    "fk_sales_order_threshold_type" INTEGER NOT NULL,
3266
    "fk_store" INTEGER NOT NULL,
3267
    "fee" INTEGER,
3268
    "message_glossary_key" VARCHAR NOT NULL,
3269
    "threshold" INTEGER NOT NULL,
3270
    "created_at" TIMESTAMP,
3271
    "updated_at" TIMESTAMP,
3272
    PRIMARY KEY ("id_sales_order_threshold")
3273
);
3274
3275
CREATE INDEX "index-spy_sales_order_threshold-fk_sales_order_threshold_type" ON "spy_sales_order_threshold" ("fk_sales_order_threshold_type");
3276
3277
CREATE INDEX "index-spy_sales_order_threshold-fk_currency" ON "spy_sales_order_threshold" ("fk_currency");
3278
3279
CREATE INDEX "index-spy_sales_order_threshold-fk_store" ON "spy_sales_order_threshold" ("fk_store");
3280
3281
CREATE SEQUENCE "id_sales_order_threshold_tax_set_pk_seq";
3282
3283
CREATE TABLE "spy_sales_order_threshold_tax_set"
3284
(
3285
    "id_sales_order_threshold_tax_set" INTEGER NOT NULL,
3286
    "fk_tax_set" INTEGER NOT NULL,
3287
    "created_at" TIMESTAMP,
3288
    "updated_at" TIMESTAMP,
3289
    PRIMARY KEY ("id_sales_order_threshold_tax_set")
3290
);
3291
3292
CREATE INDEX "index-spy_sales_order_threshold_tax_set-fk_tax_set" ON "spy_sales_order_threshold_tax_set" ("fk_tax_set");
3293
3294
CREATE SEQUENCE "id_sales_order_threshold_type_pk_seq";
3295
3296
CREATE TABLE "spy_sales_order_threshold_type"
3297
(
3298
    "id_sales_order_threshold_type" INTEGER NOT NULL,
3299
    "key" VARCHAR NOT NULL,
3300
    "threshold_group" VARCHAR NOT NULL,
3301
    "created_at" TIMESTAMP,
3302
    "updated_at" TIMESTAMP,
3303
    PRIMARY KEY ("id_sales_order_threshold_type"),
3304
    CONSTRAINT "spy_sales_order_threshold_type-unique-key" UNIQUE ("key")
3305
);
3306
3307
CREATE SEQUENCE "spy_sales_payment_pk_seq";
3308
3309
CREATE TABLE "spy_sales_payment"
3310
(
3311
    "id_sales_payment" INTEGER NOT NULL,
3312
    "fk_sales_order" INTEGER NOT NULL,
3313
    "fk_sales_payment_method_type" INTEGER NOT NULL,
3314
    "amount" INTEGER NOT NULL,
3315
    "created_at" TIMESTAMP,
3316
    "updated_at" TIMESTAMP,
3317
    PRIMARY KEY ("id_sales_payment")
3318
);
3319
3320
CREATE INDEX "index-spy_sales_payment-fk_sales_order" ON "spy_sales_payment" ("fk_sales_order");
3321
3322
CREATE INDEX "index-spy_sales_payment-fk_sales_payment_method_type" ON "spy_sales_payment" ("fk_sales_payment_method_type");
3323
3324
CREATE SEQUENCE "spy_sales_payment_method_type_pk_seq";
3325
3326
CREATE TABLE "spy_sales_payment_method_type"
3327
(
3328
    "id_sales_payment_method_type" INTEGER NOT NULL,
3329
    "payment_method" VARCHAR NOT NULL,
3330
    "payment_provider" VARCHAR NOT NULL,
3331
    PRIMARY KEY ("id_sales_payment_method_type")
3332
);
3333
3334
CREATE INDEX "spy_sales_payment_method_type-type" ON "spy_sales_payment_method_type" ("payment_provider","payment_method");
3335
3336
CREATE SEQUENCE "spy_sales_reclamation_pk_seq";
3337
3338
CREATE TABLE "spy_sales_reclamation"
3339
(
3340
    "id_sales_reclamation" INTEGER NOT NULL,
3341
    "fk_sales_order" INTEGER NOT NULL,
3342
    "customer_email" VARCHAR(255) NOT NULL,
3343
    "customer_name" VARCHAR(511) NOT NULL,
3344
    "customer_reference" VARCHAR(255),
3345
    "is_open" BOOLEAN NOT NULL,
3346
    "created_at" TIMESTAMP,
3347
    "updated_at" TIMESTAMP,
3348
    PRIMARY KEY ("id_sales_reclamation")
3349
);
3350
3351
CREATE INDEX "index-spy_sales_reclamation-fk_sales_order" ON "spy_sales_reclamation" ("fk_sales_order");
3352
3353
CREATE SEQUENCE "spy_sales_reclamation_item_pk_seq";
3354
3355
CREATE TABLE "spy_sales_reclamation_item"
3356
(
3357
    "id_sales_reclamation_item" INTEGER NOT NULL,
3358
    "fk_sales_order_item" INTEGER NOT NULL,
3359
    "fk_sales_reclamation" INTEGER NOT NULL,
3360
    PRIMARY KEY ("id_sales_reclamation_item")
3361
);
3362
3363
CREATE INDEX "index-spy_sales_reclamation_item-fk_sales_reclamation" ON "spy_sales_reclamation_item" ("fk_sales_reclamation");
3364
3365
CREATE INDEX "index-spy_sales_reclamation_item-fk_sales_order_item" ON "spy_sales_reclamation_item" ("fk_sales_order_item");
3366
3367
CREATE SEQUENCE "spy_sequence_number_pk_seq";
3368
3369
CREATE TABLE "spy_sequence_number"
3370
(
3371
    "id_sequence_number" INTEGER NOT NULL,
3372
    "name" VARCHAR(255) NOT NULL,
3373
    "current_id" INTEGER NOT NULL,
3374
    PRIMARY KEY ("id_sequence_number"),
3375
    CONSTRAINT "spy_sequence_number-name" UNIQUE ("name")
3376
);
3377
3378
CREATE SEQUENCE "spy_shipment_carrier_pk_seq";
3379
3380
CREATE TABLE "spy_shipment_carrier"
3381
(
3382
    "id_shipment_carrier" INTEGER NOT NULL,
3383
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
3384
    "name" VARCHAR(255) NOT NULL,
3385
    PRIMARY KEY ("id_shipment_carrier")
3386
);
3387
3388
CREATE INDEX "spy_shipment_carrier-is_active" ON "spy_shipment_carrier" ("is_active");
3389
3390
CREATE SEQUENCE "spy_shipment_method_pk_seq";
3391
3392
CREATE TABLE "spy_shipment_method"
3393
(
3394
    "id_shipment_method" INTEGER NOT NULL,
3395
    "fk_shipment_carrier" INTEGER NOT NULL,
3396
    "fk_tax_set" INTEGER,
3397
    "availability_plugin" VARCHAR(255),
3398
    "default_price" INTEGER,
3399
    "delivery_time_plugin" VARCHAR(255),
3400
    "is_active" BOOLEAN DEFAULT \'t\' NOT NULL,
3401
    "name" VARCHAR(255) NOT NULL,
3402
    "price_plugin" VARCHAR(255),
3403
    "shipment_method_key" VARCHAR(255),
3404
    PRIMARY KEY ("id_shipment_method")
3405
);
3406
3407
COMMENT ON COLUMN "spy_shipment_method"."default_price" IS \'Deprecated\';
3408
3409
CREATE INDEX "spy_shipment_method-is_active" ON "spy_shipment_method" ("is_active");
3410
3411
CREATE INDEX "index-spy_shipment_method-fk_shipment_carrier" ON "spy_shipment_method" ("fk_shipment_carrier");
3412
3413
CREATE INDEX "index-spy_shipment_method-fk_tax_set" ON "spy_shipment_method" ("fk_tax_set");
3414
3415
CREATE SEQUENCE "spy_shipment_method_price_pk_seq";
3416
3417
CREATE TABLE "spy_shipment_method_price"
3418
(
3419
    "id_shipment_method_price" INTEGER NOT NULL,
3420
    "fk_currency" INTEGER NOT NULL,
3421
    "fk_shipment_method" INTEGER NOT NULL,
3422
    "fk_store" INTEGER,
3423
    "default_gross_price" INTEGER,
3424
    "default_net_price" INTEGER,
3425
    PRIMARY KEY ("id_shipment_method_price"),
3426
    CONSTRAINT "spy_shipment_method_price-fk_shipment_method-fk_currency-fk_s" UNIQUE ("fk_shipment_method","fk_store","fk_currency")
3427
);
3428
3429
CREATE INDEX "index-spy_shipment_method_price-fk_currency" ON "spy_shipment_method_price" ("fk_currency");
3430
3431
CREATE INDEX "index-spy_shipment_method_price-fk_store" ON "spy_shipment_method_price" ("fk_store");
3432
3433
CREATE INDEX "index-spy_shipment_method_price-fk_shipment_method" ON "spy_shipment_method_price" ("fk_shipment_method");
3434
3435
CREATE SEQUENCE "spy_state_machine_transition_log_pk_seq";
3436
3437
CREATE TABLE "spy_state_machine_transition_log"
3438
(
3439
    "id_state_machine_transition_log" INTEGER NOT NULL,
3440
    "fk_state_machine_process" INTEGER NOT NULL,
3441
    "command" VARCHAR,
3442
    "condition" VARCHAR,
3443
    "error_message" TEXT,
3444
    "event" VARCHAR(100),
3445
    "hostname" VARCHAR(128) NOT NULL,
3446
    "identifier" INTEGER NOT NULL,
3447
    "is_error" BOOLEAN,
3448
    "locked" BOOLEAN,
3449
    "params" TEXT,
3450
    "path" VARCHAR(256),
3451
    "source_state" VARCHAR(128),
3452
    "target_state" VARCHAR(128),
3453
    "created_at" TIMESTAMP,
3454
    PRIMARY KEY ("id_state_machine_transition_log")
3455
);
3456
3457
CREATE INDEX "index-spy_state_machine_transition_log-fk_state_machine_process" ON "spy_state_machine_transition_log" ("fk_state_machine_process");
3458
3459
CREATE SEQUENCE "spy_state_machine_process_pk_seq";
3460
3461
CREATE TABLE "spy_state_machine_process"
3462
(
3463
    "id_state_machine_process" INTEGER NOT NULL,
3464
    "name" VARCHAR(255) NOT NULL,
3465
    "state_machine_name" VARCHAR(255) NOT NULL,
3466
    "created_at" TIMESTAMP,
3467
    "updated_at" TIMESTAMP,
3468
    PRIMARY KEY ("id_state_machine_process"),
3469
    CONSTRAINT "spy_state_machine_process-name" UNIQUE ("name","state_machine_name")
3470
);
3471
3472
CREATE INDEX "spy_state_machine_process-state_machine_name" ON "spy_state_machine_process" ("state_machine_name");
3473
3474
CREATE SEQUENCE "spy_state_machine_lock_pk_seq";
3475
3476
CREATE TABLE "spy_state_machine_lock"
3477
(
3478
    "id_state_machine_lock" INTEGER NOT NULL,
3479
    "expires" TIMESTAMP NOT NULL,
3480
    "identifier" VARCHAR(255) NOT NULL,
3481
    "created_at" TIMESTAMP,
3482
    "updated_at" TIMESTAMP,
3483
    PRIMARY KEY ("id_state_machine_lock"),
3484
    CONSTRAINT "spy_state_machine_lock-identifier" UNIQUE ("identifier")
3485
);
3486
3487
CREATE SEQUENCE "spy_state_machine_item_state_pk_seq";
3488
3489
CREATE TABLE "spy_state_machine_item_state"
3490
(
3491
    "id_state_machine_item_state" INTEGER NOT NULL,
3492
    "fk_state_machine_process" INTEGER NOT NULL,
3493
    "description" VARCHAR(255),
3494
    "name" VARCHAR(255) NOT NULL,
3495
    PRIMARY KEY ("id_state_machine_item_state"),
3496
    CONSTRAINT "spy_state_machine_item_state-name" UNIQUE ("name","fk_state_machine_process")
3497
);
3498
3499
CREATE INDEX "index-spy_state_machine_item_state-fk_state_machine_process" ON "spy_state_machine_item_state" ("fk_state_machine_process");
3500
3501
CREATE SEQUENCE "spy_state_machine_item_state_history_pk_seq";
3502
3503
CREATE TABLE "spy_state_machine_item_state_history"
3504
(
3505
    "id_state_machine_item_state_history" INTEGER NOT NULL,
3506
    "fk_state_machine_item_state" INTEGER NOT NULL,
3507
    "identifier" INTEGER NOT NULL,
3508
    "created_at" TIMESTAMP,
3509
    PRIMARY KEY ("id_state_machine_item_state_history")
3510
);
3511
3512
CREATE INDEX "spy_state_machine_item_state_history-identifier" ON "spy_state_machine_item_state_history" ("identifier");
3513
3514
CREATE INDEX "index-spy_state_machine_item_state_history-fk_stat-86748ef1e826" ON "spy_state_machine_item_state_history" ("fk_state_machine_item_state");
3515
3516
CREATE SEQUENCE "spy_state_machine_event_timeout_pk_seq";
3517
3518
CREATE TABLE "spy_state_machine_event_timeout"
3519
(
3520
    "id_state_machine_event_timeout" INTEGER NOT NULL,
3521
    "fk_state_machine_item_state" INTEGER NOT NULL,
3522
    "fk_state_machine_process" INTEGER NOT NULL,
3523
    "event" VARCHAR(255) NOT NULL,
3524
    "identifier" INTEGER NOT NULL,
3525
    "timeout" TIMESTAMP NOT NULL,
3526
    "created_at" TIMESTAMP,
3527
    "updated_at" TIMESTAMP,
3528
    PRIMARY KEY ("id_state_machine_event_timeout"),
3529
    CONSTRAINT "spy_state_machine_item_state-unique-identifier" UNIQUE ("identifier","fk_state_machine_item_state")
3530
);
3531
3532
CREATE INDEX "spy_state_machine_event_timeout-timeout" ON "spy_state_machine_event_timeout" ("timeout");
3533
3534
CREATE INDEX "index-spy_state_machine_event_timeout-fk_state_mac-d2bb0e7f2734" ON "spy_state_machine_event_timeout" ("fk_state_machine_item_state");
3535
3536
CREATE INDEX "index-spy_state_machine_event_timeout-fk_state_machine_process" ON "spy_state_machine_event_timeout" ("fk_state_machine_process");
3537
3538
CREATE SEQUENCE "spy_stock_pk_seq";
3539
3540
CREATE TABLE "spy_stock"
3541
(
3542
    "id_stock" INTEGER NOT NULL,
3543
    "name" VARCHAR(255) NOT NULL,
3544
    PRIMARY KEY ("id_stock"),
3545
    CONSTRAINT "spy_stock-name" UNIQUE ("name")
3546
);
3547
3548
CREATE SEQUENCE "spy_stock_product_pk_seq";
3549
3550
CREATE TABLE "spy_stock_product"
3551
(
3552
    "id_stock_product" INTEGER NOT NULL,
3553
    "fk_product" INTEGER NOT NULL,
3554
    "fk_stock" INTEGER NOT NULL,
3555
    "is_never_out_of_stock" BOOLEAN DEFAULT \'f\',
3556
    "quantity" INTEGER DEFAULT 0,
3557
    PRIMARY KEY ("id_stock_product"),
3558
    CONSTRAINT "spy_stock_product-unique-fk_stock" UNIQUE ("fk_stock","fk_product")
3559
);
3560
3561
CREATE INDEX "spy_stock_product-fk_product" ON "spy_stock_product" ("fk_product");
3562
3563
CREATE INDEX "index-spy_stock_product-fk_stock" ON "spy_stock_product" ("fk_stock");
3564
3565
CREATE SEQUENCE "spy_store_pk_seq";
3566
3567
CREATE TABLE "spy_store"
3568
(
3569
    "id_store" INTEGER NOT NULL,
3570
    "name" VARCHAR(255),
3571
    PRIMARY KEY ("id_store")
3572
);
3573
3574
CREATE SEQUENCE "spy_tax_set_pk_seq";
3575
3576
CREATE TABLE "spy_tax_set"
3577
(
3578
    "id_tax_set" INTEGER NOT NULL,
3579
    "name" VARCHAR(255) NOT NULL,
3580
    "uuid" VARCHAR,
3581
    "created_at" TIMESTAMP,
3582
    "updated_at" TIMESTAMP,
3583
    PRIMARY KEY ("id_tax_set"),
3584
    CONSTRAINT "spy_tax_set-unique-uuid" UNIQUE ("uuid")
3585
);
3586
3587
CREATE SEQUENCE "spy_tax_rate_pk_seq";
3588
3589
CREATE TABLE "spy_tax_rate"
3590
(
3591
    "id_tax_rate" INTEGER NOT NULL,
3592
    "fk_country" INTEGER,
3593
    "name" VARCHAR(255) NOT NULL,
3594
    "rate" NUMERIC(8,2) NOT NULL,
3595
    "created_at" TIMESTAMP,
3596
    "updated_at" TIMESTAMP,
3597
    PRIMARY KEY ("id_tax_rate")
3598
);
3599
3600
CREATE INDEX "index-spy_tax_rate-fk_country" ON "spy_tax_rate" ("fk_country");
3601
3602
CREATE TABLE "spy_tax_set_tax"
3603
(
3604
    "fk_tax_rate" INTEGER NOT NULL,
3605
    "fk_tax_set" INTEGER NOT NULL,
3606
    PRIMARY KEY ("fk_tax_rate","fk_tax_set")
3607
);
3608
3609
CREATE SEQUENCE "id_tax_product_storage_pk_seq";
3610
3611
CREATE TABLE "spy_tax_product_storage"
3612
(
3613
    "id_tax_product_storage" INTEGER NOT NULL,
3614
    "fk_product_abstract" INTEGER NOT NULL,
3615
    "data" TEXT,
3616
    "sku" VARCHAR(255) NOT NULL,
3617
    "key" VARCHAR,
3618
    "created_at" TIMESTAMP,
3619
    "updated_at" TIMESTAMP,
3620
    PRIMARY KEY ("id_tax_product_storage"),
3621
    CONSTRAINT "spy_tax_product_storage-unique-key" UNIQUE ("key")
3622
);
3623
3624
CREATE INDEX "spy_tax_product_storage-fk_product_abstract" ON "spy_tax_product_storage" ("fk_product_abstract");
3625
3626
CREATE SEQUENCE "id_tax_set_storage_pk_seq";
3627
3628
CREATE TABLE "spy_tax_set_storage"
3629
(
3630
    "id_tax_set_storage" INTEGER NOT NULL,
3631
    "fk_tax_set" INTEGER NOT NULL,
3632
    "data" TEXT,
3633
    "key" VARCHAR,
3634
    "created_at" TIMESTAMP,
3635
    "updated_at" TIMESTAMP,
3636
    PRIMARY KEY ("id_tax_set_storage"),
3637
    CONSTRAINT "spy_tax_set_storage-unique-key" UNIQUE ("key")
3638
);
3639
3640
CREATE INDEX "spy_tax_set_storage-fk_tax_set" ON "spy_tax_set_storage" ("fk_tax_set");
3641
3642
CREATE SEQUENCE "spy_touch_pk_seq";
3643
3644
CREATE TABLE "spy_touch"
3645
(
3646
    "id_touch" INTEGER NOT NULL,
3647
    "item_event" INT2 NOT NULL,
3648
    "item_id" INTEGER NOT NULL,
3649
    "item_type" VARCHAR(255) NOT NULL,
3650
    "touched" TIMESTAMP NOT NULL,
3651
    PRIMARY KEY ("id_touch"),
3652
    CONSTRAINT "spy_touch-unique-item_id" UNIQUE ("item_id","item_event","item_type")
3653
);
3654
3655
CREATE INDEX "spy_touch-index-item_id" ON "spy_touch" ("item_id");
3656
3657
CREATE INDEX "index_spy_touch-item_event_item_type_touched" ON "spy_touch" ("item_event","item_type","touched");
3658
3659
CREATE SEQUENCE "spy_touch_storage_pk_seq";
3660
3661
CREATE TABLE "spy_touch_storage"
3662
(
3663
    "id_touch_storage" INTEGER NOT NULL,
3664
    "fk_locale" INTEGER NOT NULL,
3665
    "fk_store" INTEGER,
3666
    "fk_touch" INTEGER NOT NULL,
3667
    "key" VARCHAR NOT NULL,
3668
    PRIMARY KEY ("id_touch_storage"),
3669
    CONSTRAINT "spy_touch_storage-unique-fk_locale" UNIQUE ("fk_locale","key")
3670
);
3671
3672
CREATE INDEX "spy_touch_storage-index-key" ON "spy_touch_storage" ("key");
3673
3674
CREATE INDEX "index-spy_touch_storage-fk_touch" ON "spy_touch_storage" ("fk_touch");
3675
3676
CREATE INDEX "index-spy_touch_storage-fk_store" ON "spy_touch_storage" ("fk_store");
3677
3678
CREATE INDEX "index-spy_touch_storage-fk_locale" ON "spy_touch_storage" ("fk_locale");
3679
3680
CREATE SEQUENCE "spy_touch_search_pk_seq";
3681
3682
CREATE TABLE "spy_touch_search"
3683
(
3684
    "id_touch_search" INTEGER NOT NULL,
3685
    "fk_locale" INTEGER NOT NULL,
3686
    "fk_store" INTEGER,
3687
    "fk_touch" INTEGER NOT NULL,
3688
    "key" VARCHAR NOT NULL,
3689
    PRIMARY KEY ("id_touch_search"),
3690
    CONSTRAINT "spy_touch_search-unique-fk_locale" UNIQUE ("fk_locale","key")
3691
);
3692
3693
CREATE INDEX "spy_touch_search-index-key" ON "spy_touch_search" ("key");
3694
3695
CREATE INDEX "index-spy_touch_search-fk_touch" ON "spy_touch_search" ("fk_touch");
3696
3697
CREATE INDEX "index-spy_touch_search-fk_store" ON "spy_touch_search" ("fk_store");
3698
3699
CREATE INDEX "index-spy_touch_search-fk_locale" ON "spy_touch_search" ("fk_locale");
3700
3701
CREATE SEQUENCE "spy_unauthenticated_customer_access_pk_seq";
3702
3703
CREATE TABLE "spy_unauthenticated_customer_access"
3704
(
3705
    "id_unauthenticated_customer_access" INTEGER NOT NULL,
3706
    "content_type" VARCHAR(100) NOT NULL,
3707
    "is_restricted" BOOLEAN NOT NULL,
3708
    PRIMARY KEY ("id_unauthenticated_customer_access"),
3709
    CONSTRAINT "spy_unauthenticated_customer_access_u_0984b8" UNIQUE ("content_type")
3710
);
3711
3712
CREATE SEQUENCE "unauthenticated_customer_access_storage_pk_seq";
3713
3714
CREATE TABLE "spy_unauthenticated_customer_access_storage"
3715
(
3716
    "id_unauthenticated_customer_access_storage" INTEGER NOT NULL,
3717
    "key" VARCHAR(255) NOT NULL,
3718
    "data" TEXT,
3719
    "created_at" TIMESTAMP,
3720
    "updated_at" TIMESTAMP,
3721
    PRIMARY KEY ("id_unauthenticated_customer_access_storage")
3722
);
3723
3724
CREATE SEQUENCE "spy_url_pk_seq";
3725
3726
CREATE TABLE "spy_url"
3727
(
3728
    "id_url" INTEGER NOT NULL,
3729
    "fk_locale" INTEGER NOT NULL,
3730
    "fk_resource_categorynode" INTEGER,
3731
    "fk_resource_page" INTEGER,
3732
    "fk_resource_product_abstract" INTEGER,
3733
    "fk_resource_product_set" INTEGER,
3734
    "fk_resource_redirect" INTEGER,
3735
    "url" VARCHAR(255) NOT NULL,
3736
    PRIMARY KEY ("id_url"),
3737
    CONSTRAINT "spy_url_unique_key" UNIQUE ("url")
3738
);
3739
3740
CREATE INDEX "spy_url-fk_resource_product_set" ON "spy_url" ("fk_resource_product_set");
3741
3742
CREATE INDEX "index-spy_url-fk_resource_categorynode" ON "spy_url" ("fk_resource_categorynode");
3743
3744
CREATE INDEX "index-spy_url-fk_resource_page" ON "spy_url" ("fk_resource_page");
3745
3746
CREATE INDEX "index-spy_url-fk_resource_product_abstract" ON "spy_url" ("fk_resource_product_abstract");
3747
3748
CREATE INDEX "index-spy_url-fk_locale" ON "spy_url" ("fk_locale");
3749
3750
CREATE INDEX "index-spy_url-fk_resource_redirect" ON "spy_url" ("fk_resource_redirect");
3751
3752
CREATE SEQUENCE "spy_url_redirect_pk_seq";
3753
3754
CREATE TABLE "spy_url_redirect"
3755
(
3756
    "id_url_redirect" INTEGER NOT NULL,
3757
    "status" INTEGER DEFAULT 301 NOT NULL,
3758
    "to_url" VARCHAR(255) NOT NULL,
3759
    PRIMARY KEY ("id_url_redirect")
3760
);
3761
3762
CREATE INDEX "spy_url_redirect-to_url" ON "spy_url_redirect" ("to_url","status");
3763
3764
CREATE SEQUENCE "spy_url_storage_pk_seq";
3765
3766
CREATE TABLE "spy_url_storage"
3767
(
3768
    "id_url_storage" INT8 NOT NULL,
3769
    "fk_categorynode" INTEGER,
3770
    "fk_page" INTEGER,
3771
    "fk_product_abstract" INTEGER,
3772
    "fk_product_set" INTEGER,
3773
    "fk_redirect" INTEGER,
3774
    "fk_url" INTEGER NOT NULL,
3775
    "url" VARCHAR NOT NULL,
3776
    "data" TEXT,
3777
    "key" VARCHAR,
3778
    "created_at" TIMESTAMP,
3779
    "updated_at" TIMESTAMP,
3780
    PRIMARY KEY ("id_url_storage"),
3781
    CONSTRAINT "spy_url_storage-unique-key" UNIQUE ("key")
3782
);
3783
3784
CREATE INDEX "spy_url_storage-fk_url" ON "spy_url_storage" ("fk_url");
3785
3786
CREATE SEQUENCE "spy_url_redirect_storage_pk_seq";
3787
3788
CREATE TABLE "spy_url_redirect_storage"
3789
(
3790
    "id_url_redirect_storage" INT8 NOT NULL,
3791
    "fk_url_redirect" INTEGER NOT NULL,
3792
    "data" TEXT,
3793
    "key" VARCHAR,
3794
    "created_at" TIMESTAMP,
3795
    "updated_at" TIMESTAMP,
3796
    PRIMARY KEY ("id_url_redirect_storage"),
3797
    CONSTRAINT "spy_url_redirect_storage-unique-key" UNIQUE ("key")
3798
);
3799
3800
CREATE INDEX "spy_url_redirect_storage-fk_url_redirect" ON "spy_url_redirect_storage" ("fk_url_redirect");
3801
3802
CREATE SEQUENCE "spy_user_pk_seq";
3803
3804
CREATE TABLE "spy_user"
3805
(
3806
    "id_user" INTEGER NOT NULL,
3807
    "fk_locale" INTEGER,
3808
    "first_name" VARCHAR(45) NOT NULL,
3809
    "is_agent" BOOLEAN,
3810
    "last_login" TIMESTAMP,
3811
    "last_name" VARCHAR(255) NOT NULL,
3812
    "password" VARCHAR(255) NOT NULL,
3813
    "status" INT2 DEFAULT 0 NOT NULL,
3814
    "username" VARCHAR(45) NOT NULL,
3815
    "created_at" TIMESTAMP,
3816
    "updated_at" TIMESTAMP,
3817
    PRIMARY KEY ("id_user"),
3818
    CONSTRAINT "spy_user-username" UNIQUE ("username")
3819
);
3820
3821
CREATE SEQUENCE "id_vault_deposit_pk_seq";
3822
3823
CREATE TABLE "spy_vault_deposit"
3824
(
3825
    "id_vault_deposit" INTEGER NOT NULL,
3826
    "data_type" VARCHAR(255) NOT NULL,
3827
    "data_key" VARCHAR(255) NOT NULL,
3828
    "initial_vector" VARCHAR(255) NOT NULL,
3829
    "cipher_text" TEXT NOT NULL,
3830
    "created_at" TIMESTAMP,
3831
    "updated_at" TIMESTAMP,
3832
    PRIMARY KEY ("id_vault_deposit"),
3833
    CONSTRAINT "spy_vault_deposit-unique-data_type-data_key" UNIQUE ("data_type","data_key")
3834
);
3835
3836
CREATE INDEX "spy_vault_deposit-data_type-data_key" ON "spy_vault_deposit" ("data_type","data_key");
3837
3838
CREATE SEQUENCE "spy_wishlist_pk_seq";
3839
3840
CREATE TABLE "spy_wishlist"
3841
(
3842
    "id_wishlist" INTEGER NOT NULL,
3843
    "fk_customer" INTEGER NOT NULL,
3844
    "name" VARCHAR(255) NOT NULL,
3845
    "created_at" TIMESTAMP,
3846
    "updated_at" TIMESTAMP,
3847
    "uuid" VARCHAR,
3848
    PRIMARY KEY ("id_wishlist"),
3849
    CONSTRAINT "spy_wishlist-unique-fk_customer-name" UNIQUE ("fk_customer","name"),
3850
    CONSTRAINT "spy_wishlist-unique-uuid" UNIQUE ("uuid")
3851
);
3852
3853
CREATE INDEX "index-spy_wishlist-fk_customer" ON "spy_wishlist" ("fk_customer");
3854
3855
CREATE SEQUENCE "spy_wishlist_item_pk_seq";
3856
3857
CREATE TABLE "spy_wishlist_item"
3858
(
3859
    "id_wishlist_item" INTEGER NOT NULL,
3860
    "fk_wishlist" INTEGER NOT NULL,
3861
    "sku" VARCHAR(255) NOT NULL,
3862
    "created_at" TIMESTAMP,
3863
    "updated_at" TIMESTAMP,
3864
    PRIMARY KEY ("id_wishlist_item")
3865
);
3866
3867
CREATE INDEX "index-spy_wishlist_item-fk_wishlist" ON "spy_wishlist_item" ("fk_wishlist");
3868
3869
CREATE INDEX "index-spy_wishlist_item-sku" ON "spy_wishlist_item" ("sku");
3870
3871
CREATE TABLE "spy_acl_role_archive"
3872
(
3873
    "id_acl_role" INTEGER NOT NULL,
3874
    "name" VARCHAR(255) NOT NULL,
3875
    "created_at" TIMESTAMP,
3876
    "updated_at" TIMESTAMP,
3877
    "archived_at" TIMESTAMP,
3878
    PRIMARY KEY ("id_acl_role")
3879
);
3880
3881
CREATE INDEX "spy_acl_role_archive_i_d94269" ON "spy_acl_role_archive" ("name");
3882
3883
CREATE TABLE "spy_acl_rule_archive"
3884
(
3885
    "id_acl_rule" INTEGER NOT NULL,
3886
    "fk_acl_role" INTEGER NOT NULL,
3887
    "bundle" VARCHAR(45) NOT NULL,
3888
    "controller" VARCHAR(45) NOT NULL,
3889
    "action" VARCHAR(45) NOT NULL,
3890
    "type" INT2 NOT NULL,
3891
    "created_at" TIMESTAMP,
3892
    "updated_at" TIMESTAMP,
3893
    "archived_at" TIMESTAMP,
3894
    PRIMARY KEY ("id_acl_rule")
3895
);
3896
3897
CREATE TABLE "spy_acl_group_archive"
3898
(
3899
    "id_acl_group" INTEGER NOT NULL,
3900
    "name" VARCHAR(255) NOT NULL,
3901
    "created_at" TIMESTAMP,
3902
    "updated_at" TIMESTAMP,
3903
    "archived_at" TIMESTAMP,
3904
    PRIMARY KEY ("id_acl_group")
3905
);
3906
3907
CREATE INDEX "spy_acl_group_archive_i_d94269" ON "spy_acl_group_archive" ("name");
3908
3909
CREATE TABLE "spy_auth_reset_password_archive"
3910
(
3911
    "id_auth_reset_password" INTEGER NOT NULL,
3912
    "fk_user" INTEGER NOT NULL,
3913
    "code" VARCHAR(35) NOT NULL,
3914
    "status" INT2 NOT NULL,
3915
    "created_at" TIMESTAMP,
3916
    "updated_at" TIMESTAMP,
3917
    "archived_at" TIMESTAMP,
3918
    PRIMARY KEY ("id_auth_reset_password","fk_user")
3919
);
3920
3921
CREATE INDEX "spy_auth_reset_password_archive_i_4db226" ON "spy_auth_reset_password_archive" ("code");
3922
3923
CREATE TABLE "spy_product_search_attribute_map_archive"
3924
(
3925
    "fk_product_attribute_key" INTEGER NOT NULL,
3926
    "synced" BOOLEAN DEFAULT \'f\',
3927
    "target_field" VARCHAR NOT NULL,
3928
    "archived_at" TIMESTAMP,
3929
    PRIMARY KEY ("fk_product_attribute_key","target_field")
3930
);
3931
3932
CREATE INDEX "spy_product_search_attribute_map_archive_i_a1d33d" ON "spy_product_search_attribute_map_archive" ("fk_product_attribute_key");
3933
3934
CREATE TABLE "spy_product_search_attribute_archive"
3935
(
3936
    "id_product_search_attribute" INTEGER NOT NULL,
3937
    "fk_product_attribute_key" INTEGER NOT NULL,
3938
    "filter_type" VARCHAR NOT NULL,
3939
    "position" INTEGER DEFAULT 0 NOT NULL,
3940
    "synced" BOOLEAN DEFAULT \'f\',
3941
    "archived_at" TIMESTAMP,
3942
    PRIMARY KEY ("id_product_search_attribute")
3943
);
3944
3945
CREATE INDEX "spy_product_search_attribute_archive_i_a1d33d" ON "spy_product_search_attribute_archive" ("fk_product_attribute_key");
3946
3947
CREATE TABLE "spy_user_archive"
3948
(
3949
    "id_user" INTEGER NOT NULL,
3950
    "fk_locale" INTEGER,
3951
    "first_name" VARCHAR(45) NOT NULL,
3952
    "is_agent" BOOLEAN,
3953
    "last_login" TIMESTAMP,
3954
    "last_name" VARCHAR(255) NOT NULL,
3955
    "password" VARCHAR(255) NOT NULL,
3956
    "status" INT2 DEFAULT 0 NOT NULL,
3957
    "username" VARCHAR(45) NOT NULL,
3958
    "created_at" TIMESTAMP,
3959
    "updated_at" TIMESTAMP,
3960
    "archived_at" TIMESTAMP,
3961
    PRIMARY KEY ("id_user")
3962
);
3963
3964
CREATE INDEX "spy_user_archive_i_f86ef3" ON "spy_user_archive" ("username");
3965
3966
ALTER TABLE "spy_acl_rule" ADD CONSTRAINT "spy_acl_rule-fk_acl_role"
3967
    FOREIGN KEY ("fk_acl_role")
3968
    REFERENCES "spy_acl_role" ("id_acl_role")
3969
    ON DELETE CASCADE;
3970
3971
ALTER TABLE "spy_acl_user_has_group" ADD CONSTRAINT "spy_acl_user_has_group-fk_user"
3972
    FOREIGN KEY ("fk_user")
3973
    REFERENCES "spy_user" ("id_user")
3974
    ON DELETE CASCADE;
3975
3976
ALTER TABLE "spy_acl_user_has_group" ADD CONSTRAINT "spy_acl_user_has_group-fk_acl_group"
3977
    FOREIGN KEY ("fk_acl_group")
3978
    REFERENCES "spy_acl_group" ("id_acl_group")
3979
    ON DELETE CASCADE;
3980
3981
ALTER TABLE "spy_acl_groups_has_roles" ADD CONSTRAINT "spy_acl_groups_has_roles-fk_acl_role"
3982
    FOREIGN KEY ("fk_acl_role")
3983
    REFERENCES "spy_acl_role" ("id_acl_role")
3984
    ON DELETE CASCADE;
3985
3986
ALTER TABLE "spy_acl_groups_has_roles" ADD CONSTRAINT "spy_acl_groups_has_roles-fk_acl_group"
3987
    FOREIGN KEY ("fk_acl_group")
3988
    REFERENCES "spy_acl_group" ("id_acl_group")
3989
    ON DELETE CASCADE;
3990
3991
ALTER TABLE "spy_auth_reset_password" ADD CONSTRAINT "spy_auth_reset_password-fk_user"
3992
    FOREIGN KEY ("fk_user")
3993
    REFERENCES "spy_user" ("id_user")
3994
    ON DELETE CASCADE;
3995
3996
ALTER TABLE "spy_availability_abstract" ADD CONSTRAINT "spy_availability_abstract-fk_store"
3997
    FOREIGN KEY ("fk_store")
3998
    REFERENCES "spy_store" ("id_store");
3999
4000
ALTER TABLE "spy_availability" ADD CONSTRAINT "spy_availability-fk_spy_availability_abstract"
4001
    FOREIGN KEY ("fk_availability_abstract")
4002
    REFERENCES "spy_availability_abstract" ("id_availability_abstract");
4003
4004
ALTER TABLE "spy_availability" ADD CONSTRAINT "spy_availability-fk_store"
4005
    FOREIGN KEY ("fk_store")
4006
    REFERENCES "spy_store" ("id_store");
4007
4008
ALTER TABLE "spy_availability_notification_subscription" ADD CONSTRAINT "spy_availability_notification_subscription-fk_store"
4009
    FOREIGN KEY ("fk_store")
4010
    REFERENCES "spy_store" ("id_store");
4011
4012
ALTER TABLE "spy_availability_notification_subscription" ADD CONSTRAINT "spy_availability_notification_subscription-fk_locale"
4013
    FOREIGN KEY ("fk_locale")
4014
    REFERENCES "spy_locale" ("id_locale");
4015
4016
ALTER TABLE "spy_category" ADD CONSTRAINT "spy_category_fk_7e2c46"
4017
    FOREIGN KEY ("fk_category_template")
4018
    REFERENCES "spy_category_template" ("id_category_template");
4019
4020
ALTER TABLE "spy_category_attribute" ADD CONSTRAINT "spy_category_attribute_fk_12b6d0"
4021
    FOREIGN KEY ("fk_locale")
4022
    REFERENCES "spy_locale" ("id_locale");
4023
4024
ALTER TABLE "spy_category_attribute" ADD CONSTRAINT "spy_category_attribute_fk_723c48"
4025
    FOREIGN KEY ("fk_category")
4026
    REFERENCES "spy_category" ("id_category");
4027
4028
ALTER TABLE "spy_category_node" ADD CONSTRAINT "spy_category_node_fk_b54a47"
4029
    FOREIGN KEY ("fk_parent_category_node")
4030
    REFERENCES "spy_category_node" ("id_category_node");
4031
4032
ALTER TABLE "spy_category_node" ADD CONSTRAINT "spy_category_node_fk_723c48"
4033
    FOREIGN KEY ("fk_category")
4034
    REFERENCES "spy_category" ("id_category");
4035
4036
ALTER TABLE "spy_category_closure_table" ADD CONSTRAINT "spy_category_closure_table_fk_d3e44d"
4037
    FOREIGN KEY ("fk_category_node")
4038
    REFERENCES "spy_category_node" ("id_category_node");
4039
4040
ALTER TABLE "spy_category_closure_table" ADD CONSTRAINT "spy_category_closure_table_fk_a3476a"
4041
    FOREIGN KEY ("fk_category_node_descendant")
4042
    REFERENCES "spy_category_node" ("id_category_node");
4043
4044
ALTER TABLE "spy_category_image_set" ADD CONSTRAINT "spy_category_image_set-fk_locale"
4045
    FOREIGN KEY ("fk_locale")
4046
    REFERENCES "spy_locale" ("id_locale");
4047
4048
ALTER TABLE "spy_category_image_set" ADD CONSTRAINT "spy_category_image_set-fk_category"
4049
    FOREIGN KEY ("fk_category")
4050
    REFERENCES "spy_category" ("id_category");
4051
4052
ALTER TABLE "spy_category_image_set_to_category_image" ADD CONSTRAINT "spy_category_image_set_to_category_image-fk_category_image_set"
4053
    FOREIGN KEY ("fk_category_image_set")
4054
    REFERENCES "spy_category_image_set" ("id_category_image_set");
4055
4056
ALTER TABLE "spy_category_image_set_to_category_image" ADD CONSTRAINT "spy_category_image_set_to_category_image-fk_category_image"
4057
    FOREIGN KEY ("fk_category_image")
4058
    REFERENCES "spy_category_image" ("id_category_image");
4059
4060
ALTER TABLE "spy_cms_page" ADD CONSTRAINT "spy_cms_page-fk_template"
4061
    FOREIGN KEY ("fk_template")
4062
    REFERENCES "spy_cms_template" ("id_cms_template")
4063
    ON DELETE CASCADE;
4064
4065
ALTER TABLE "spy_cms_page_localized_attributes" ADD CONSTRAINT "spy_cms_page_localized_attributes-fk_cms_page"
4066
    FOREIGN KEY ("fk_cms_page")
4067
    REFERENCES "spy_cms_page" ("id_cms_page")
4068
    ON UPDATE CASCADE
4069
    ON DELETE CASCADE;
4070
4071
ALTER TABLE "spy_cms_page_localized_attributes" ADD CONSTRAINT "spy_cms_page_localized_attributes-fk_locale"
4072
    FOREIGN KEY ("fk_locale")
4073
    REFERENCES "spy_locale" ("id_locale");
4074
4075
ALTER TABLE "spy_cms_glossary_key_mapping" ADD CONSTRAINT "spy_cms_glossary_key_mapping-fk_page"
4076
    FOREIGN KEY ("fk_page")
4077
    REFERENCES "spy_cms_page" ("id_cms_page")
4078
    ON DELETE CASCADE;
4079
4080
ALTER TABLE "spy_cms_glossary_key_mapping" ADD CONSTRAINT "spy_cms_glossary_key_mapping-fk_glossary_key"
4081
    FOREIGN KEY ("fk_glossary_key")
4082
    REFERENCES "spy_glossary_key" ("id_glossary_key")
4083
    ON DELETE CASCADE;
4084
4085
ALTER TABLE "spy_cms_version" ADD CONSTRAINT "spy_cms_version-fk_cms_page"
4086
    FOREIGN KEY ("fk_cms_page")
4087
    REFERENCES "spy_cms_page" ("id_cms_page")
4088
    ON DELETE CASCADE;
4089
4090
ALTER TABLE "spy_cms_version" ADD CONSTRAINT "spy_cms_version-fk_user"
4091
    FOREIGN KEY ("fk_user")
4092
    REFERENCES "spy_user" ("id_user");
4093
4094
ALTER TABLE "spy_cms_page_store" ADD CONSTRAINT "spy_cms_page_store-fk_cms_page"
4095
    FOREIGN KEY ("fk_cms_page")
4096
    REFERENCES "spy_cms_page" ("id_cms_page");
4097
4098
ALTER TABLE "spy_cms_page_store" ADD CONSTRAINT "spy_cms_page_store-fk_store"
4099
    FOREIGN KEY ("fk_store")
4100
    REFERENCES "spy_store" ("id_store");
4101
4102
ALTER TABLE "spy_cms_block_glossary_key_mapping" ADD CONSTRAINT "spy_cms_block_glossary_key_mapping-fk_cms_block"
4103
    FOREIGN KEY ("fk_cms_block")
4104
    REFERENCES "spy_cms_block" ("id_cms_block")
4105
    ON DELETE CASCADE;
4106
4107
ALTER TABLE "spy_cms_block_glossary_key_mapping" ADD CONSTRAINT "spy_cms_block_glossary_key_mapping-fk_glossary_key"
4108
    FOREIGN KEY ("fk_glossary_key")
4109
    REFERENCES "spy_glossary_key" ("id_glossary_key")
4110
    ON DELETE CASCADE;
4111
4112
ALTER TABLE "spy_cms_block" ADD CONSTRAINT "spy_cms_block-fk_template"
4113
    FOREIGN KEY ("fk_template")
4114
    REFERENCES "spy_cms_block_template" ("id_cms_block_template")
4115
    ON DELETE CASCADE;
4116
4117
ALTER TABLE "spy_cms_block_store" ADD CONSTRAINT "spy_cms_block_store-fk_cms_block"
4118
    FOREIGN KEY ("fk_cms_block")
4119
    REFERENCES "spy_cms_block" ("id_cms_block");
4120
4121
ALTER TABLE "spy_cms_block_store" ADD CONSTRAINT "spy_cms_block_store-fk_store"
4122
    FOREIGN KEY ("fk_store")
4123
    REFERENCES "spy_store" ("id_store");
4124
4125
ALTER TABLE "spy_cms_block_category_connector" ADD CONSTRAINT "spy_cms_block_category_connector-fk_cms_block"
4126
    FOREIGN KEY ("fk_cms_block")
4127
    REFERENCES "spy_cms_block" ("id_cms_block")
4128
    ON DELETE CASCADE;
4129
4130
ALTER TABLE "spy_cms_block_category_connector" ADD CONSTRAINT "spy_cms_block_category_connector-fk_category"
4131
    FOREIGN KEY ("fk_category")
4132
    REFERENCES "spy_category" ("id_category")
4133
    ON DELETE CASCADE;
4134
4135
ALTER TABLE "spy_cms_block_category_connector" ADD CONSTRAINT "spy_cms_block_category_connector-fk_category_template"
4136
    FOREIGN KEY ("fk_category_template")
4137
    REFERENCES "spy_category_template" ("id_category_template")
4138
    ON DELETE CASCADE;
4139
4140
ALTER TABLE "spy_cms_block_category_connector" ADD CONSTRAINT "spy_cms_block_category_connector-fk_cms_block_category_position"
4141
    FOREIGN KEY ("fk_cms_block_category_position")
4142
    REFERENCES "spy_cms_block_category_position" ("id_cms_block_category_position")
4143
    ON DELETE CASCADE;
4144
4145
ALTER TABLE "spy_cms_block_product_connector" ADD CONSTRAINT "spy_cms_block_product_connector-fk_cms_block"
4146
    FOREIGN KEY ("fk_cms_block")
4147
    REFERENCES "spy_cms_block" ("id_cms_block")
4148
    ON DELETE CASCADE;
4149
4150
ALTER TABLE "spy_cms_block_product_connector" ADD CONSTRAINT "spy_cms_block_product_connector-fk_product_abstract"
4151
    FOREIGN KEY ("fk_product_abstract")
4152
    REFERENCES "spy_product_abstract" ("id_product_abstract")
4153
    ON DELETE CASCADE;
4154
4155
ALTER TABLE "spy_content_localized" ADD CONSTRAINT "spy_content_localized-fk_content"
4156
    FOREIGN KEY ("fk_content")
4157
    REFERENCES "spy_content" ("id_content");
4158
4159
ALTER TABLE "spy_content_localized" ADD CONSTRAINT "spy_content_localized-fk_locale"
4160
    FOREIGN KEY ("fk_locale")
4161
    REFERENCES "spy_locale" ("id_locale");
4162
4163
ALTER TABLE "spy_region" ADD CONSTRAINT "spy_region-fk_country"
4164
    FOREIGN KEY ("fk_country")
4165
    REFERENCES "spy_country" ("id_country");
4166
4167
ALTER TABLE "spy_customer" ADD CONSTRAINT "spy_customer-default_billing_address"
4168
    FOREIGN KEY ("default_billing_address")
4169
    REFERENCES "spy_customer_address" ("id_customer_address")
4170
    ON DELETE SET NULL;
4171
4172
ALTER TABLE "spy_customer" ADD CONSTRAINT "spy_customer-default_shipping_address"
4173
    FOREIGN KEY ("default_shipping_address")
4174
    REFERENCES "spy_customer_address" ("id_customer_address")
4175
    ON DELETE SET NULL;
4176
4177
ALTER TABLE "spy_customer" ADD CONSTRAINT "spy_customer-fk_locale"
4178
    FOREIGN KEY ("fk_locale")
4179
    REFERENCES "spy_locale" ("id_locale");
4180
4181
ALTER TABLE "spy_customer" ADD CONSTRAINT "spy_customer-fk_user"
4182
    FOREIGN KEY ("fk_user")
4183
    REFERENCES "spy_user" ("id_user");
4184
4185
ALTER TABLE "spy_customer_address" ADD CONSTRAINT "spy_customer_address-fk_customer"
4186
    FOREIGN KEY ("fk_customer")
4187
    REFERENCES "spy_customer" ("id_customer")
4188
    ON DELETE CASCADE;
4189
4190
ALTER TABLE "spy_customer_address" ADD CONSTRAINT "spy_customer_address-fk_region"
4191
    FOREIGN KEY ("fk_region")
4192
    REFERENCES "spy_region" ("id_region");
4193
4194
ALTER TABLE "spy_customer_address" ADD CONSTRAINT "spy_customer_address-fk_country"
4195
    FOREIGN KEY ("fk_country")
4196
    REFERENCES "spy_country" ("id_country");
4197
4198
ALTER TABLE "spy_customer_group_to_customer" ADD CONSTRAINT "spy_customer_group_to_customer-fk_customer_group"
4199
    FOREIGN KEY ("fk_customer_group")
4200
    REFERENCES "spy_customer_group" ("id_customer_group")
4201
    ON DELETE CASCADE;
4202
4203
ALTER TABLE "spy_customer_group_to_customer" ADD CONSTRAINT "spy_customer_group_to_customer-fk_customer"
4204
    FOREIGN KEY ("fk_customer")
4205
    REFERENCES "spy_customer" ("id_customer");
4206
4207
ALTER TABLE "spy_customer_note" ADD CONSTRAINT "spy_customer_note-fk_customer"
4208
    FOREIGN KEY ("fk_customer")
4209
    REFERENCES "spy_customer" ("id_customer");
4210
4211
ALTER TABLE "spy_customer_note" ADD CONSTRAINT "spy_customer_note-fk_user"
4212
    FOREIGN KEY ("fk_user")
4213
    REFERENCES "spy_user" ("id_user");
4214
4215
ALTER TABLE "spy_discount" ADD CONSTRAINT "spy_discount-fk_discount_voucher_pool"
4216
    FOREIGN KEY ("fk_discount_voucher_pool")
4217
    REFERENCES "spy_discount_voucher_pool" ("id_discount_voucher_pool");
4218
4219
ALTER TABLE "spy_discount" ADD CONSTRAINT "spy_discount-fk_store"
4220
    FOREIGN KEY ("fk_store")
4221
    REFERENCES "spy_store" ("id_store");
4222
4223
ALTER TABLE "spy_discount_store" ADD CONSTRAINT "spy_discount_store-fk_discount"
4224
    FOREIGN KEY ("fk_discount")
4225
    REFERENCES "spy_discount" ("id_discount");
4226
4227
ALTER TABLE "spy_discount_store" ADD CONSTRAINT "spy_discount_store-fk_store"
4228
    FOREIGN KEY ("fk_store")
4229
    REFERENCES "spy_store" ("id_store");
4230
4231
ALTER TABLE "spy_discount_voucher" ADD CONSTRAINT "spy_discount_voucher-fk_discount_voucher_pool"
4232
    FOREIGN KEY ("fk_discount_voucher_pool")
4233
    REFERENCES "spy_discount_voucher_pool" ("id_discount_voucher_pool");
4234
4235
ALTER TABLE "spy_discount_amount" ADD CONSTRAINT "spy_discount_amount-fk_currency"
4236
    FOREIGN KEY ("fk_currency")
4237
    REFERENCES "spy_currency" ("id_currency");
4238
4239
ALTER TABLE "spy_discount_amount" ADD CONSTRAINT "spy_discount_amount-fk_discount"
4240
    FOREIGN KEY ("fk_discount")
4241
    REFERENCES "spy_discount" ("id_discount");
4242
4243
ALTER TABLE "spy_discount_promotion" ADD CONSTRAINT "spy_discount_promotion-fk_discount"
4244
    FOREIGN KEY ("fk_discount")
4245
    REFERENCES "spy_discount" ("id_discount");
4246
4247
ALTER TABLE "pyz_example_state_machine_item" ADD CONSTRAINT "pyz_example_state_machine_item-fk_state_machine_item_state"
4248
    FOREIGN KEY ("fk_state_machine_item_state")
4249
    REFERENCES "spy_state_machine_item_state" ("id_state_machine_item_state");
4250
4251
ALTER TABLE "spy_file" ADD CONSTRAINT "spy_file-fk_file_directory"
4252
    FOREIGN KEY ("fk_file_directory")
4253
    REFERENCES "spy_file_directory" ("id_file_directory");
4254
4255
ALTER TABLE "spy_file_info" ADD CONSTRAINT "spy_file_info-fk_file"
4256
    FOREIGN KEY ("fk_file")
4257
    REFERENCES "spy_file" ("id_file")
4258
    ON DELETE CASCADE;
4259
4260
ALTER TABLE "spy_file_localized_attributes" ADD CONSTRAINT "spy_file_localized_attributes-fk_file"
4261
    FOREIGN KEY ("fk_file")
4262
    REFERENCES "spy_file" ("id_file")
4263
    ON UPDATE CASCADE
4264
    ON DELETE CASCADE;
4265
4266
ALTER TABLE "spy_file_localized_attributes" ADD CONSTRAINT "spy_file_localized_attributes-fk_locale"
4267
    FOREIGN KEY ("fk_locale")
4268
    REFERENCES "spy_locale" ("id_locale");
4269
4270
ALTER TABLE "spy_file_directory" ADD CONSTRAINT "spy_file_directory_fk_47023d"
4271
    FOREIGN KEY ("fk_parent_file_directory")
4272
    REFERENCES "spy_file_directory" ("id_file_directory")
4273
    ON DELETE CASCADE;
4274
4275
ALTER TABLE "spy_file_directory_localized_attributes" ADD CONSTRAINT "spy_file_directory_localized_attributes_fk_52d44c"
4276
    FOREIGN KEY ("fk_file_directory")
4277
    REFERENCES "spy_file_directory" ("id_file_directory")
4278
    ON DELETE CASCADE;
4279
4280
ALTER TABLE "spy_file_directory_localized_attributes" ADD CONSTRAINT "spy_file_directory_localized_attributes_fk_12b6d0"
4281
    FOREIGN KEY ("fk_locale")
4282
    REFERENCES "spy_locale" ("id_locale");
4283
4284
ALTER TABLE "spy_gift_card_product_abstract_configuration_link" ADD CONSTRAINT "spy_gift_card_product_abstract_conf_link-fk_product_abstract"
4285
    FOREIGN KEY ("fk_product_abstract")
4286
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4287
4288
ALTER TABLE "spy_gift_card_product_abstract_configuration_link" ADD CONSTRAINT "spy_gift_card_pa_conf_link-fk_gift_card_pa_conf"
4289
    FOREIGN KEY ("fk_gift_card_product_abstract_configuration")
4290
    REFERENCES "spy_gift_card_product_abstract_configuration" ("id_gift_card_product_abstract_configuration");
4291
4292
ALTER TABLE "spy_gift_card_product_configuration_link" ADD CONSTRAINT "spy_gift_card_product_configuration_link-fk_product"
4293
    FOREIGN KEY ("fk_product")
4294
    REFERENCES "spy_product" ("id_product");
4295
4296
ALTER TABLE "spy_gift_card_product_configuration_link" ADD CONSTRAINT "spy_gift_card_p_conf_link-fk_gift_card_p_conf"
4297
    FOREIGN KEY ("fk_gift_card_product_configuration")
4298
    REFERENCES "spy_gift_card_product_configuration" ("id_gift_card_product_configuration");
4299
4300
ALTER TABLE "spy_payment_gift_card" ADD CONSTRAINT "spy_payment_gift_card-fk_payment"
4301
    FOREIGN KEY ("fk_sales_payment")
4302
    REFERENCES "spy_sales_payment" ("id_sales_payment");
4303
4304
ALTER TABLE "spy_gift_card_balance_log" ADD CONSTRAINT "spy_gift_card_balance_log-fk_gift_card"
4305
    FOREIGN KEY ("fk_gift_card")
4306
    REFERENCES "spy_gift_card" ("id_gift_card");
4307
4308
ALTER TABLE "spy_gift_card_balance_log" ADD CONSTRAINT "spy_gift_card_balance_log-fk_sales_order"
4309
    FOREIGN KEY ("fk_sales_order")
4310
    REFERENCES "spy_sales_order" ("id_sales_order");
4311
4312
ALTER TABLE "spy_glossary_translation" ADD CONSTRAINT "spy_glossary_translation-fk_glossary_key"
4313
    FOREIGN KEY ("fk_glossary_key")
4314
    REFERENCES "spy_glossary_key" ("id_glossary_key")
4315
    ON DELETE CASCADE;
4316
4317
ALTER TABLE "spy_glossary_translation" ADD CONSTRAINT "spy_glossary_translation-fk_locale"
4318
    FOREIGN KEY ("fk_locale")
4319
    REFERENCES "spy_locale" ("id_locale")
4320
    ON DELETE CASCADE;
4321
4322
ALTER TABLE "spy_navigation_node" ADD CONSTRAINT "spy_navigation_node_fk_07636b"
4323
    FOREIGN KEY ("fk_parent_navigation_node")
4324
    REFERENCES "spy_navigation_node" ("id_navigation_node")
4325
    ON DELETE CASCADE;
4326
4327
ALTER TABLE "spy_navigation_node" ADD CONSTRAINT "spy_navigation_node_fk_6f985c"
4328
    FOREIGN KEY ("fk_navigation")
4329
    REFERENCES "spy_navigation" ("id_navigation")
4330
    ON DELETE CASCADE;
4331
4332
ALTER TABLE "spy_navigation_node_localized_attributes" ADD CONSTRAINT "spy_navigation_node_localized_attributes_fk_43843f"
4333
    FOREIGN KEY ("fk_navigation_node")
4334
    REFERENCES "spy_navigation_node" ("id_navigation_node")
4335
    ON DELETE CASCADE;
4336
4337
ALTER TABLE "spy_navigation_node_localized_attributes" ADD CONSTRAINT "spy_navigation_node_localized_attributes_fk_12b6d0"
4338
    FOREIGN KEY ("fk_locale")
4339
    REFERENCES "spy_locale" ("id_locale");
4340
4341
ALTER TABLE "spy_navigation_node_localized_attributes" ADD CONSTRAINT "spy_navigation_node_localized_attributes_fk_76593a"
4342
    FOREIGN KEY ("fk_url")
4343
    REFERENCES "spy_url" ("id_url");
4344
4345
ALTER TABLE "spy_newsletter_subscriber" ADD CONSTRAINT "spy_newsletter_subscriber-fk_customer"
4346
    FOREIGN KEY ("fk_customer")
4347
    REFERENCES "spy_customer" ("id_customer");
4348
4349
ALTER TABLE "spy_newsletter_subscription" ADD CONSTRAINT "spy_newsletter_subscription-fk_newsletter_subscriber"
4350
    FOREIGN KEY ("fk_newsletter_subscriber")
4351
    REFERENCES "spy_newsletter_subscriber" ("id_newsletter_subscriber");
4352
4353
ALTER TABLE "spy_newsletter_subscription" ADD CONSTRAINT "spy_newsletter_subscription-fk_newsletter_type"
4354
    FOREIGN KEY ("fk_newsletter_type")
4355
    REFERENCES "spy_newsletter_type" ("id_newsletter_type");
4356
4357
ALTER TABLE "spy_nopayment_paid" ADD CONSTRAINT "spy_nopayment_paid-fk_sales_order_item"
4358
    FOREIGN KEY ("fk_sales_order_item")
4359
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4360
4361
ALTER TABLE "spy_oauth_access_token" ADD CONSTRAINT "spy_oauth_access_token-identifier"
4362
    FOREIGN KEY ("fk_oauth_client")
4363
    REFERENCES "spy_oauth_client" ("identifier");
4364
4365
ALTER TABLE "spy_oms_transition_log" ADD CONSTRAINT "spy_oms_transition_log-fk_sales_order"
4366
    FOREIGN KEY ("fk_sales_order")
4367
    REFERENCES "spy_sales_order" ("id_sales_order");
4368
4369
ALTER TABLE "spy_oms_transition_log" ADD CONSTRAINT "spy_oms_transition_log-fk_sales_order_item"
4370
    FOREIGN KEY ("fk_sales_order_item")
4371
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4372
4373
ALTER TABLE "spy_oms_transition_log" ADD CONSTRAINT "spy_oms_transition_log-fk_oms_order_process"
4374
    FOREIGN KEY ("fk_oms_order_process")
4375
    REFERENCES "spy_oms_order_process" ("id_oms_order_process");
4376
4377
ALTER TABLE "spy_oms_order_item_state_history" ADD CONSTRAINT "spy_oms_order_item_state_history-fk_sales_order_item"
4378
    FOREIGN KEY ("fk_sales_order_item")
4379
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4380
4381
ALTER TABLE "spy_oms_order_item_state_history" ADD CONSTRAINT "spy_oms_order_item_state_history-fk_oms_order_item_state"
4382
    FOREIGN KEY ("fk_oms_order_item_state")
4383
    REFERENCES "spy_oms_order_item_state" ("id_oms_order_item_state");
4384
4385
ALTER TABLE "spy_oms_event_timeout" ADD CONSTRAINT "spy_oms_event_timeout-fk_sales_order_item"
4386
    FOREIGN KEY ("fk_sales_order_item")
4387
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4388
4389
ALTER TABLE "spy_oms_event_timeout" ADD CONSTRAINT "spy_oms_event_timeout-fk_oms_order_item_state"
4390
    FOREIGN KEY ("fk_oms_order_item_state")
4391
    REFERENCES "spy_oms_order_item_state" ("id_oms_order_item_state");
4392
4393
ALTER TABLE "spy_oms_product_reservation" ADD CONSTRAINT "spy_oms_product_reservation-fk_store"
4394
    FOREIGN KEY ("fk_store")
4395
    REFERENCES "spy_store" ("id_store");
4396
4397
ALTER TABLE "spy_price_product" ADD CONSTRAINT "spy_price_product-fk_product"
4398
    FOREIGN KEY ("fk_product")
4399
    REFERENCES "spy_product" ("id_product");
4400
4401
ALTER TABLE "spy_price_product" ADD CONSTRAINT "spy_price_product-fk_price_type"
4402
    FOREIGN KEY ("fk_price_type")
4403
    REFERENCES "spy_price_type" ("id_price_type");
4404
4405
ALTER TABLE "spy_price_product" ADD CONSTRAINT "spy_price_product-fk_product_abstract"
4406
    FOREIGN KEY ("fk_product_abstract")
4407
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4408
4409
ALTER TABLE "spy_price_product_store" ADD CONSTRAINT "spy_price_product_store-fk_currency"
4410
    FOREIGN KEY ("fk_currency")
4411
    REFERENCES "spy_currency" ("id_currency");
4412
4413
ALTER TABLE "spy_price_product_store" ADD CONSTRAINT "spy_price_product_store-fk_store"
4414
    FOREIGN KEY ("fk_store")
4415
    REFERENCES "spy_store" ("id_store");
4416
4417
ALTER TABLE "spy_price_product_store" ADD CONSTRAINT "spy_price_product_store-fk_price_product"
4418
    FOREIGN KEY ("fk_price_product")
4419
    REFERENCES "spy_price_product" ("id_price_product");
4420
4421
ALTER TABLE "spy_price_product_default" ADD CONSTRAINT "spy_price_product_default-fk_price_product_store"
4422
    FOREIGN KEY ("fk_price_product_store")
4423
    REFERENCES "spy_price_product_store" ("id_price_product_store")
4424
    ON DELETE CASCADE;
4425
4426
ALTER TABLE "spy_price_product_schedule" ADD CONSTRAINT "spy_price_product_schedule-fk_product"
4427
    FOREIGN KEY ("fk_product")
4428
    REFERENCES "spy_product" ("id_product");
4429
4430
ALTER TABLE "spy_price_product_schedule" ADD CONSTRAINT "spy_price_product_schedule-fk_product_abstract"
4431
    FOREIGN KEY ("fk_product_abstract")
4432
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4433
4434
ALTER TABLE "spy_price_product_schedule" ADD CONSTRAINT "spy_price_product_schedule-fk_currency"
4435
    FOREIGN KEY ("fk_currency")
4436
    REFERENCES "spy_currency" ("id_currency");
4437
4438
ALTER TABLE "spy_price_product_schedule" ADD CONSTRAINT "spy_price_product_schedule-fk_store"
4439
    FOREIGN KEY ("fk_store")
4440
    REFERENCES "spy_store" ("id_store");
4441
4442
ALTER TABLE "spy_price_product_schedule" ADD CONSTRAINT "spy_price_product_schedule-fk_price_type"
4443
    FOREIGN KEY ("fk_price_type")
4444
    REFERENCES "spy_price_type" ("id_price_type");
4445
4446
ALTER TABLE "spy_price_product_schedule" ADD CONSTRAINT "spy_price_product_schedule-fk_price_product_schedule_list"
4447
    FOREIGN KEY ("fk_price_product_schedule_list")
4448
    REFERENCES "spy_price_product_schedule_list" ("id_price_product_schedule_list");
4449
4450
ALTER TABLE "spy_price_product_schedule_list" ADD CONSTRAINT "spy_price_product_schedule_list-fk_user"
4451
    FOREIGN KEY ("fk_user")
4452
    REFERENCES "spy_user" ("id_user");
4453
4454
ALTER TABLE "spy_product_abstract" ADD CONSTRAINT "spy_product_abstract-fk_tax_set"
4455
    FOREIGN KEY ("fk_tax_set")
4456
    REFERENCES "spy_tax_set" ("id_tax_set");
4457
4458
ALTER TABLE "spy_product_abstract_localized_attributes" ADD CONSTRAINT "spy_product_abstract_localized_attributes-fk_product_abstract"
4459
    FOREIGN KEY ("fk_product_abstract")
4460
    REFERENCES "spy_product_abstract" ("id_product_abstract")
4461
    ON UPDATE CASCADE
4462
    ON DELETE CASCADE;
4463
4464
ALTER TABLE "spy_product_abstract_localized_attributes" ADD CONSTRAINT "spy_product_abstract_localized_attributes-fk_locale"
4465
    FOREIGN KEY ("fk_locale")
4466
    REFERENCES "spy_locale" ("id_locale");
4467
4468
ALTER TABLE "spy_product_abstract_store" ADD CONSTRAINT "spy_product_abstract_store-fk_product"
4469
    FOREIGN KEY ("fk_product_abstract")
4470
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4471
4472
ALTER TABLE "spy_product_abstract_store" ADD CONSTRAINT "spy_product_abstract_store-fk_store"
4473
    FOREIGN KEY ("fk_store")
4474
    REFERENCES "spy_store" ("id_store");
4475
4476
ALTER TABLE "spy_product" ADD CONSTRAINT "spy_product-fk_product_abstract"
4477
    FOREIGN KEY ("fk_product_abstract")
4478
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4479
4480
ALTER TABLE "spy_product_localized_attributes" ADD CONSTRAINT "spy_product_localized_attributes-fk_product"
4481
    FOREIGN KEY ("fk_product")
4482
    REFERENCES "spy_product" ("id_product")
4483
    ON UPDATE CASCADE
4484
    ON DELETE CASCADE;
4485
4486
ALTER TABLE "spy_product_localized_attributes" ADD CONSTRAINT "spy_product_localized_attributes-fk_locale"
4487
    FOREIGN KEY ("fk_locale")
4488
    REFERENCES "spy_locale" ("id_locale");
4489
4490
ALTER TABLE "spy_product_alternative" ADD CONSTRAINT "spy_product_alternative-fk_product"
4491
    FOREIGN KEY ("fk_product")
4492
    REFERENCES "spy_product" ("id_product");
4493
4494
ALTER TABLE "spy_product_alternative" ADD CONSTRAINT "spy_product_alternative-fk_product_abstract_alternative"
4495
    FOREIGN KEY ("fk_product_abstract_alternative")
4496
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4497
4498
ALTER TABLE "spy_product_alternative" ADD CONSTRAINT "spy_product_alternative-fk_product_concrete_alternative"
4499
    FOREIGN KEY ("fk_product_concrete_alternative")
4500
    REFERENCES "spy_product" ("id_product");
4501
4502
ALTER TABLE "spy_product_management_attribute" ADD CONSTRAINT "spy_pim_attribute-fk_product_attribute_key"
4503
    FOREIGN KEY ("fk_product_attribute_key")
4504
    REFERENCES "spy_product_attribute_key" ("id_product_attribute_key");
4505
4506
ALTER TABLE "spy_product_management_attribute_value" ADD CONSTRAINT "spy_pim_attribute_value-fk_pim_attribute"
4507
    FOREIGN KEY ("fk_product_management_attribute")
4508
    REFERENCES "spy_product_management_attribute" ("id_product_management_attribute");
4509
4510
ALTER TABLE "spy_product_management_attribute_value_translation" ADD CONSTRAINT "spy_pim_attribute_value-fk_locale"
4511
    FOREIGN KEY ("fk_locale")
4512
    REFERENCES "spy_locale" ("id_locale");
4513
4514
ALTER TABLE "spy_product_management_attribute_value_translation" ADD CONSTRAINT "spy_pim_attribute_value_translation-fk_pim_attribute_value"
4515
    FOREIGN KEY ("fk_product_management_attribute_value")
4516
    REFERENCES "spy_product_management_attribute_value" ("id_product_management_attribute_value");
4517
4518
ALTER TABLE "spy_product_bundle" ADD CONSTRAINT "spy_product_bundle-fk_bundled_product"
4519
    FOREIGN KEY ("fk_bundled_product")
4520
    REFERENCES "spy_product" ("id_product")
4521
    ON UPDATE CASCADE
4522
    ON DELETE CASCADE;
4523
4524
ALTER TABLE "spy_product_bundle" ADD CONSTRAINT "spy_product_bundle-fk_product"
4525
    FOREIGN KEY ("fk_product")
4526
    REFERENCES "spy_product" ("id_product")
4527
    ON UPDATE CASCADE
4528
    ON DELETE CASCADE;
4529
4530
ALTER TABLE "spy_product_category" ADD CONSTRAINT "spy_product_category-fk_category"
4531
    FOREIGN KEY ("fk_category")
4532
    REFERENCES "spy_category" ("id_category");
4533
4534
ALTER TABLE "spy_product_category" ADD CONSTRAINT "spy_product_category-fk_product_abstract"
4535
    FOREIGN KEY ("fk_product_abstract")
4536
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4537
4538
ALTER TABLE "spy_product_category_filter" ADD CONSTRAINT "spy_product_category_filter-fk_category"
4539
    FOREIGN KEY ("fk_category")
4540
    REFERENCES "spy_category" ("id_category");
4541
4542
ALTER TABLE "spy_product_discontinued" ADD CONSTRAINT "spy_product_discontinued-fk_product"
4543
    FOREIGN KEY ("fk_product")
4544
    REFERENCES "spy_product" ("id_product");
4545
4546
ALTER TABLE "spy_product_discontinued_note" ADD CONSTRAINT "spy_product_discontinued_note-fk_product_discontinued"
4547
    FOREIGN KEY ("fk_product_discontinued")
4548
    REFERENCES "spy_product_discontinued" ("id_product_discontinued");
4549
4550
ALTER TABLE "spy_product_discontinued_note" ADD CONSTRAINT "spy_product_discontinued_note-fk_locale"
4551
    FOREIGN KEY ("fk_locale")
4552
    REFERENCES "spy_locale" ("id_locale");
4553
4554
ALTER TABLE "spy_product_abstract_group" ADD CONSTRAINT "spy_product_abstract_group-fk_product_group"
4555
    FOREIGN KEY ("fk_product_group")
4556
    REFERENCES "spy_product_group" ("id_product_group");
4557
4558
ALTER TABLE "spy_product_abstract_group" ADD CONSTRAINT "spy_product_abstract_group-fk_product_abstract"
4559
    FOREIGN KEY ("fk_product_abstract")
4560
    REFERENCES "spy_product_abstract" ("id_product_abstract")
4561
    ON DELETE CASCADE;
4562
4563
ALTER TABLE "spy_product_image_set" ADD CONSTRAINT "spy_product_image_set-fk_locale"
4564
    FOREIGN KEY ("fk_locale")
4565
    REFERENCES "spy_locale" ("id_locale");
4566
4567
ALTER TABLE "spy_product_image_set" ADD CONSTRAINT "spy_product_image_set-fk_product"
4568
    FOREIGN KEY ("fk_product")
4569
    REFERENCES "spy_product" ("id_product");
4570
4571
ALTER TABLE "spy_product_image_set" ADD CONSTRAINT "spy_product_image_set-fk_product_abstract"
4572
    FOREIGN KEY ("fk_product_abstract")
4573
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4574
4575
ALTER TABLE "spy_product_image_set" ADD CONSTRAINT "spy_product_image_set-fk_resource_product_set"
4576
    FOREIGN KEY ("fk_resource_product_set")
4577
    REFERENCES "spy_product_set" ("id_product_set");
4578
4579
ALTER TABLE "spy_product_image_set_to_product_image" ADD CONSTRAINT "spy_product_image_set_to_product_image-fk_product_image_set"
4580
    FOREIGN KEY ("fk_product_image_set")
4581
    REFERENCES "spy_product_image_set" ("id_product_image_set");
4582
4583
ALTER TABLE "spy_product_image_set_to_product_image" ADD CONSTRAINT "spy_product_image_set_to_product_image-fk_product_image"
4584
    FOREIGN KEY ("fk_product_image")
4585
    REFERENCES "spy_product_image" ("id_product_image");
4586
4587
ALTER TABLE "spy_product_label_localized_attributes" ADD CONSTRAINT "spy_product_label_localized_attributes_fk_3dcfb4"
4588
    FOREIGN KEY ("fk_product_label")
4589
    REFERENCES "spy_product_label" ("id_product_label");
4590
4591
ALTER TABLE "spy_product_label_localized_attributes" ADD CONSTRAINT "spy_product_label_localized_attributes_fk_12b6d0"
4592
    FOREIGN KEY ("fk_locale")
4593
    REFERENCES "spy_locale" ("id_locale");
4594
4595
ALTER TABLE "spy_product_label_product_abstract" ADD CONSTRAINT "spy_product_label_product_abstract_fk_3dcfb4"
4596
    FOREIGN KEY ("fk_product_label")
4597
    REFERENCES "spy_product_label" ("id_product_label");
4598
4599
ALTER TABLE "spy_product_label_product_abstract" ADD CONSTRAINT "spy_product_label_product_abstract_fk_371a4f"
4600
    FOREIGN KEY ("fk_product_abstract")
4601
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4602
4603
ALTER TABLE "spy_product_option_group" ADD CONSTRAINT "spy_product_option_group-fk_tax_set"
4604
    FOREIGN KEY ("fk_tax_set")
4605
    REFERENCES "spy_tax_set" ("id_tax_set")
4606
    ON DELETE SET NULL;
4607
4608
ALTER TABLE "spy_product_abstract_product_option_group" ADD CONSTRAINT "spy_product_abstract-fk_product_abstract"
4609
    FOREIGN KEY ("fk_product_abstract")
4610
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4611
4612
ALTER TABLE "spy_product_abstract_product_option_group" ADD CONSTRAINT "spy_product_abstract-fk_product_option_group"
4613
    FOREIGN KEY ("fk_product_option_group")
4614
    REFERENCES "spy_product_option_group" ("id_product_option_group");
4615
4616
ALTER TABLE "spy_product_option_value" ADD CONSTRAINT "spy_product_option_value-fk_product_option_group"
4617
    FOREIGN KEY ("fk_product_option_group")
4618
    REFERENCES "spy_product_option_group" ("id_product_option_group");
4619
4620
ALTER TABLE "spy_product_option_value_price" ADD CONSTRAINT "spy_product_option_value_price-fk_currency"
4621
    FOREIGN KEY ("fk_currency")
4622
    REFERENCES "spy_currency" ("id_currency");
4623
4624
ALTER TABLE "spy_product_option_value_price" ADD CONSTRAINT "spy_product_option_value_price-fk_store"
4625
    FOREIGN KEY ("fk_store")
4626
    REFERENCES "spy_store" ("id_store");
4627
4628
ALTER TABLE "spy_product_option_value_price" ADD CONSTRAINT "spy_product_option_value_price-fk_product_option_value"
4629
    FOREIGN KEY ("fk_product_option_value")
4630
    REFERENCES "spy_product_option_value" ("id_product_option_value")
4631
    ON DELETE CASCADE;
4632
4633
ALTER TABLE "spy_product_quantity" ADD CONSTRAINT "spy_product_quantity-fk_product"
4634
    FOREIGN KEY ("fk_product")
4635
    REFERENCES "spy_product" ("id_product");
4636
4637
ALTER TABLE "spy_product_relation" ADD CONSTRAINT "spy_product-relation-fk_product_abstract"
4638
    FOREIGN KEY ("fk_product_abstract")
4639
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4640
4641
ALTER TABLE "spy_product_relation" ADD CONSTRAINT "spy_product-relation-type-fk_product_abstract"
4642
    FOREIGN KEY ("fk_product_relation_type")
4643
    REFERENCES "spy_product_relation_type" ("id_product_relation_type");
4644
4645
ALTER TABLE "spy_product_relation_product_abstract" ADD CONSTRAINT "spy_product-rel-prod-rel-fk_product_relation"
4646
    FOREIGN KEY ("fk_product_relation")
4647
    REFERENCES "spy_product_relation" ("id_product_relation");
4648
4649
ALTER TABLE "spy_product_relation_product_abstract" ADD CONSTRAINT "spy_product-rel-prod-abs-fk_product_abstract"
4650
    FOREIGN KEY ("fk_product_abstract")
4651
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4652
4653
ALTER TABLE "spy_product_review" ADD CONSTRAINT "spy_product_review-fk_product_abstract"
4654
    FOREIGN KEY ("fk_product_abstract")
4655
    REFERENCES "spy_product_abstract" ("id_product_abstract");
4656
4657
ALTER TABLE "spy_product_review" ADD CONSTRAINT "spy_product_review-fk_locale"
4658
    FOREIGN KEY ("fk_locale")
4659
    REFERENCES "spy_locale" ("id_locale");
4660
4661
ALTER TABLE "spy_product_search" ADD CONSTRAINT "spy_product_search-fk_product"
4662
    FOREIGN KEY ("fk_product")
4663
    REFERENCES "spy_product" ("id_product");
4664
4665
ALTER TABLE "spy_product_search" ADD CONSTRAINT "spy_product_search-fk_locale"
4666
    FOREIGN KEY ("fk_locale")
4667
    REFERENCES "spy_locale" ("id_locale");
4668
4669
ALTER TABLE "spy_product_search_attribute_map" ADD CONSTRAINT "spy_product_search_attribute_map-fk_product_attribute_key"
4670
    FOREIGN KEY ("fk_product_attribute_key")
4671
    REFERENCES "spy_product_attribute_key" ("id_product_attribute_key")
4672
    ON DELETE CASCADE;
4673
4674
ALTER TABLE "spy_product_search_attribute" ADD CONSTRAINT "spy_product_search_attribute-fk_product_attribute_key"
4675
    FOREIGN KEY ("fk_product_attribute_key")
4676
    REFERENCES "spy_product_attribute_key" ("id_product_attribute_key");
4677
4678
ALTER TABLE "spy_product_abstract_set" ADD CONSTRAINT "spy_product_abstract_set-fk_product_set"
4679
    FOREIGN KEY ("fk_product_set")
4680
    REFERENCES "spy_product_set" ("id_product_set");
4681
4682
ALTER TABLE "spy_product_abstract_set" ADD CONSTRAINT "spy_product_abstract_set-fk_product_abstract"
4683
    FOREIGN KEY ("fk_product_abstract")
4684
    REFERENCES "spy_product_abstract" ("id_product_abstract")
4685
    ON DELETE CASCADE;
4686
4687
ALTER TABLE "spy_product_set_data" ADD CONSTRAINT "spy_product_set_data-fk_product_set"
4688
    FOREIGN KEY ("fk_product_set")
4689
    REFERENCES "spy_product_set" ("id_product_set")
4690
    ON DELETE CASCADE;
4691
4692
ALTER TABLE "spy_product_set_data" ADD CONSTRAINT "spy_product_set_data-fk_locale"
4693
    FOREIGN KEY ("fk_locale")
4694
    REFERENCES "spy_locale" ("id_locale");
4695
4696
ALTER TABLE "spy_product_validity" ADD CONSTRAINT "spy_product_validity-fk_product"
4697
    FOREIGN KEY ("fk_product")
4698
    REFERENCES "spy_product" ("id_product");
4699
4700
ALTER TABLE "spy_quote" ADD CONSTRAINT "spy_quote-fk_store"
4701
    FOREIGN KEY ("fk_store")
4702
    REFERENCES "spy_store" ("id_store");
4703
4704
ALTER TABLE "spy_refund" ADD CONSTRAINT "spy_refund-fk_sales_order"
4705
    FOREIGN KEY ("fk_sales_order")
4706
    REFERENCES "spy_sales_order" ("id_sales_order");
4707
4708
ALTER TABLE "spy_sales_order" ADD CONSTRAINT "spy_sales_order-fk_sales_order_address_billing"
4709
    FOREIGN KEY ("fk_sales_order_address_billing")
4710
    REFERENCES "spy_sales_order_address" ("id_sales_order_address");
4711
4712
ALTER TABLE "spy_sales_order" ADD CONSTRAINT "spy_sales_order-fk_sales_order_address_shipping"
4713
    FOREIGN KEY ("fk_sales_order_address_shipping")
4714
    REFERENCES "spy_sales_order_address" ("id_sales_order_address");
4715
4716
ALTER TABLE "spy_sales_order" ADD CONSTRAINT "spy_sales_order-fk_locale"
4717
    FOREIGN KEY ("fk_locale")
4718
    REFERENCES "spy_locale" ("id_locale");
4719
4720
ALTER TABLE "spy_sales_order_item" ADD CONSTRAINT "spy_sales_order_item-fk_sales_order_item_bundle"
4721
    FOREIGN KEY ("fk_sales_order_item_bundle")
4722
    REFERENCES "spy_sales_order_item_bundle" ("id_sales_order_item_bundle");
4723
4724
ALTER TABLE "spy_sales_order_item" ADD CONSTRAINT "spy_sales_order_item-fk_sales_order"
4725
    FOREIGN KEY ("fk_sales_order")
4726
    REFERENCES "spy_sales_order" ("id_sales_order");
4727
4728
ALTER TABLE "spy_sales_order_item" ADD CONSTRAINT "spy_sales_order_item-fk_oms_order_item_state"
4729
    FOREIGN KEY ("fk_oms_order_item_state")
4730
    REFERENCES "spy_oms_order_item_state" ("id_oms_order_item_state");
4731
4732
ALTER TABLE "spy_sales_order_item" ADD CONSTRAINT "spy_sales_order_item-fk_oms_order_process"
4733
    FOREIGN KEY ("fk_oms_order_process")
4734
    REFERENCES "spy_oms_order_process" ("id_oms_order_process");
4735
4736
ALTER TABLE "spy_sales_discount" ADD CONSTRAINT "spy_sales_discount-fk_sales_order"
4737
    FOREIGN KEY ("fk_sales_order")
4738
    REFERENCES "spy_sales_order" ("id_sales_order");
4739
4740
ALTER TABLE "spy_sales_discount" ADD CONSTRAINT "spy_sales_discount-fk_sales_order_item"
4741
    FOREIGN KEY ("fk_sales_order_item")
4742
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4743
4744
ALTER TABLE "spy_sales_discount" ADD CONSTRAINT "spy_sales_discount-fk_sales_expense"
4745
    FOREIGN KEY ("fk_sales_expense")
4746
    REFERENCES "spy_sales_expense" ("id_sales_expense");
4747
4748
ALTER TABLE "spy_sales_discount" ADD CONSTRAINT "spy_sales_discount-fk_sales_order_item_option"
4749
    FOREIGN KEY ("fk_sales_order_item_option")
4750
    REFERENCES "spy_sales_order_item_option" ("id_sales_order_item_option");
4751
4752
ALTER TABLE "spy_sales_discount_code" ADD CONSTRAINT "spy_sales_discount_code-fk_sales_discount"
4753
    FOREIGN KEY ("fk_sales_discount")
4754
    REFERENCES "spy_sales_discount" ("id_sales_discount");
4755
4756
ALTER TABLE "spy_sales_order_item_gift_card" ADD CONSTRAINT "spy_sales_order_item_gift_card-fk_sales_order_item"
4757
    FOREIGN KEY ("fk_sales_order_item")
4758
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4759
4760
ALTER TABLE "spy_sales_order_item_option" ADD CONSTRAINT "spy_sales_order_item_option-fk_sales_order_item"
4761
    FOREIGN KEY ("fk_sales_order_item")
4762
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4763
4764
ALTER TABLE "spy_sales_order_address" ADD CONSTRAINT "spy_sales_order_address-fk_country"
4765
    FOREIGN KEY ("fk_country")
4766
    REFERENCES "spy_country" ("id_country");
4767
4768
ALTER TABLE "spy_sales_order_address" ADD CONSTRAINT "spy_sales_order_address-fk_region"
4769
    FOREIGN KEY ("fk_region")
4770
    REFERENCES "spy_region" ("id_region");
4771
4772
ALTER TABLE "spy_sales_order_address_history" ADD CONSTRAINT "spy_sales_order_address_history-fk_country"
4773
    FOREIGN KEY ("fk_country")
4774
    REFERENCES "spy_country" ("id_country");
4775
4776
ALTER TABLE "spy_sales_order_address_history" ADD CONSTRAINT "spy_sales_order_address_history-fk_sales_order_address"
4777
    FOREIGN KEY ("fk_sales_order_address")
4778
    REFERENCES "spy_sales_order_address" ("id_sales_order_address");
4779
4780
ALTER TABLE "spy_sales_order_address_history" ADD CONSTRAINT "spy_sales_order_address_history-fk_region"
4781
    FOREIGN KEY ("fk_region")
4782
    REFERENCES "spy_region" ("id_region");
4783
4784
ALTER TABLE "spy_sales_order_totals" ADD CONSTRAINT "spy_sales_order_totals-fk_sales_order"
4785
    FOREIGN KEY ("fk_sales_order")
4786
    REFERENCES "spy_sales_order" ("id_sales_order");
4787
4788
ALTER TABLE "spy_sales_order_note" ADD CONSTRAINT "spy_sales_order_note-fk_sales_order"
4789
    FOREIGN KEY ("fk_sales_order")
4790
    REFERENCES "spy_sales_order" ("id_sales_order");
4791
4792
ALTER TABLE "spy_sales_order_comment" ADD CONSTRAINT "spy_sales_order_comment-fk_sales_order"
4793
    FOREIGN KEY ("fk_sales_order")
4794
    REFERENCES "spy_sales_order" ("id_sales_order");
4795
4796
ALTER TABLE "spy_sales_expense" ADD CONSTRAINT "spy_sales_expense-fk_sales_order"
4797
    FOREIGN KEY ("fk_sales_order")
4798
    REFERENCES "spy_sales_order" ("id_sales_order");
4799
4800
ALTER TABLE "spy_sales_order_item_metadata" ADD CONSTRAINT "spy_sales_order_item_metadata-fk_sales_order_item"
4801
    FOREIGN KEY ("fk_sales_order_item")
4802
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4803
4804
ALTER TABLE "spy_sales_shipment" ADD CONSTRAINT "spy_sales_shipment-fk_sales_order"
4805
    FOREIGN KEY ("fk_sales_order")
4806
    REFERENCES "spy_sales_order" ("id_sales_order");
4807
4808
ALTER TABLE "spy_sales_shipment" ADD CONSTRAINT "spy_sales_shipment-fk_sales_expense"
4809
    FOREIGN KEY ("fk_sales_expense")
4810
    REFERENCES "spy_sales_expense" ("id_sales_expense");
4811
4812
ALTER TABLE "spy_sales_order_threshold" ADD CONSTRAINT "spy_sales_order_threshold-fk_sales_order_threshold_type"
4813
    FOREIGN KEY ("fk_sales_order_threshold_type")
4814
    REFERENCES "spy_sales_order_threshold_type" ("id_sales_order_threshold_type");
4815
4816
ALTER TABLE "spy_sales_order_threshold" ADD CONSTRAINT "spy_sales_order_threshold-fk_currency"
4817
    FOREIGN KEY ("fk_currency")
4818
    REFERENCES "spy_currency" ("id_currency");
4819
4820
ALTER TABLE "spy_sales_order_threshold" ADD CONSTRAINT "spy_sales_order_threshold-fk_store"
4821
    FOREIGN KEY ("fk_store")
4822
    REFERENCES "spy_store" ("id_store");
4823
4824
ALTER TABLE "spy_sales_order_threshold_tax_set" ADD CONSTRAINT "spy_sales_order_threshold_tax_set-fk_tax_set"
4825
    FOREIGN KEY ("fk_tax_set")
4826
    REFERENCES "spy_tax_set" ("id_tax_set");
4827
4828
ALTER TABLE "spy_sales_payment" ADD CONSTRAINT "spy_sales_payment-fk_sales_order"
4829
    FOREIGN KEY ("fk_sales_order")
4830
    REFERENCES "spy_sales_order" ("id_sales_order");
4831
4832
ALTER TABLE "spy_sales_payment" ADD CONSTRAINT "spy_sales_payment-fk_sales_payment_method_type"
4833
    FOREIGN KEY ("fk_sales_payment_method_type")
4834
    REFERENCES "spy_sales_payment_method_type" ("id_sales_payment_method_type");
4835
4836
ALTER TABLE "spy_sales_reclamation" ADD CONSTRAINT "spy_sales_reclamation-fk_sales_order"
4837
    FOREIGN KEY ("fk_sales_order")
4838
    REFERENCES "spy_sales_order" ("id_sales_order");
4839
4840
ALTER TABLE "spy_sales_reclamation_item" ADD CONSTRAINT "spy_sales_reclamation_item-fk_sales_reclamation"
4841
    FOREIGN KEY ("fk_sales_reclamation")
4842
    REFERENCES "spy_sales_reclamation" ("id_sales_reclamation");
4843
4844
ALTER TABLE "spy_sales_reclamation_item" ADD CONSTRAINT "spy_sales_reclamation_item-fk_sales_order_item"
4845
    FOREIGN KEY ("fk_sales_order_item")
4846
    REFERENCES "spy_sales_order_item" ("id_sales_order_item");
4847
4848
ALTER TABLE "spy_shipment_method" ADD CONSTRAINT "spy_shipment_method-fk_shipment_carrier"
4849
    FOREIGN KEY ("fk_shipment_carrier")
4850
    REFERENCES "spy_shipment_carrier" ("id_shipment_carrier");
4851
4852
ALTER TABLE "spy_shipment_method" ADD CONSTRAINT "spy_shipment_method-fk_tax_set"
4853
    FOREIGN KEY ("fk_tax_set")
4854
    REFERENCES "spy_tax_set" ("id_tax_set");
4855
4856
ALTER TABLE "spy_shipment_method_price" ADD CONSTRAINT "spy_shipment_method_price-fk_currency"
4857
    FOREIGN KEY ("fk_currency")
4858
    REFERENCES "spy_currency" ("id_currency");
4859
4860
ALTER TABLE "spy_shipment_method_price" ADD CONSTRAINT "spy_shipment_method_price-fk_store"
4861
    FOREIGN KEY ("fk_store")
4862
    REFERENCES "spy_store" ("id_store");
4863
4864
ALTER TABLE "spy_shipment_method_price" ADD CONSTRAINT "spy_shipment_method_price-fk_shipment_method"
4865
    FOREIGN KEY ("fk_shipment_method")
4866
    REFERENCES "spy_shipment_method" ("id_shipment_method");
4867
4868
ALTER TABLE "spy_state_machine_transition_log" ADD CONSTRAINT "spy_state_machine_transition_log-fk_state_machine_process"
4869
    FOREIGN KEY ("fk_state_machine_process")
4870
    REFERENCES "spy_state_machine_process" ("id_state_machine_process");
4871
4872
ALTER TABLE "spy_state_machine_item_state" ADD CONSTRAINT "spy_state_machine_item_state-fk_state_machine_process"
4873
    FOREIGN KEY ("fk_state_machine_process")
4874
    REFERENCES "spy_state_machine_process" ("id_state_machine_process");
4875
4876
ALTER TABLE "spy_state_machine_item_state_history" ADD CONSTRAINT "spy_state_machine_item_state_h-fk_state_machine_item_state"
4877
    FOREIGN KEY ("fk_state_machine_item_state")
4878
    REFERENCES "spy_state_machine_item_state" ("id_state_machine_item_state");
4879
4880
ALTER TABLE "spy_state_machine_event_timeout" ADD CONSTRAINT "spy_state_machine_event_timeout-fk_state_machine_item_state"
4881
    FOREIGN KEY ("fk_state_machine_item_state")
4882
    REFERENCES "spy_state_machine_item_state" ("id_state_machine_item_state");
4883
4884
ALTER TABLE "spy_state_machine_event_timeout" ADD CONSTRAINT "spy_state_machine_event_timeout-fk_state_machine_process"
4885
    FOREIGN KEY ("fk_state_machine_process")
4886
    REFERENCES "spy_state_machine_process" ("id_state_machine_process");
4887
4888
ALTER TABLE "spy_stock_product" ADD CONSTRAINT "spy_stock_product-fk_product"
4889
    FOREIGN KEY ("fk_product")
4890
    REFERENCES "spy_product" ("id_product");
4891
4892
ALTER TABLE "spy_stock_product" ADD CONSTRAINT "spy_stock_product-fk_stock"
4893
    FOREIGN KEY ("fk_stock")
4894
    REFERENCES "spy_stock" ("id_stock");
4895
4896
ALTER TABLE "spy_tax_rate" ADD CONSTRAINT "spy_tax_rate-fk_country"
4897
    FOREIGN KEY ("fk_country")
4898
    REFERENCES "spy_country" ("id_country");
4899
4900
ALTER TABLE "spy_tax_set_tax" ADD CONSTRAINT "spy_tax_set_tax-fk_tax_set"
4901
    FOREIGN KEY ("fk_tax_set")
4902
    REFERENCES "spy_tax_set" ("id_tax_set")
4903
    ON DELETE CASCADE;
4904
4905
ALTER TABLE "spy_tax_set_tax" ADD CONSTRAINT "spy_tax_set_tax-fk_tax_rate"
4906
    FOREIGN KEY ("fk_tax_rate")
4907
    REFERENCES "spy_tax_rate" ("id_tax_rate");
4908
4909
ALTER TABLE "spy_touch_storage" ADD CONSTRAINT "spy_touch_storage-fk_touch"
4910
    FOREIGN KEY ("fk_touch")
4911
    REFERENCES "spy_touch" ("id_touch");
4912
4913
ALTER TABLE "spy_touch_storage" ADD CONSTRAINT "spy_touch_storage-fk_store"
4914
    FOREIGN KEY ("fk_store")
4915
    REFERENCES "spy_store" ("id_store");
4916
4917
ALTER TABLE "spy_touch_storage" ADD CONSTRAINT "spy_touch_storage-fk_locale"
4918
    FOREIGN KEY ("fk_locale")
4919
    REFERENCES "spy_locale" ("id_locale");
4920
4921
ALTER TABLE "spy_touch_search" ADD CONSTRAINT "spy_touch_search-fk_touch"
4922
    FOREIGN KEY ("fk_touch")
4923
    REFERENCES "spy_touch" ("id_touch");
4924
4925
ALTER TABLE "spy_touch_search" ADD CONSTRAINT "spy_touch_search-fk_store"
4926
    FOREIGN KEY ("fk_store")
4927
    REFERENCES "spy_store" ("id_store");
4928
4929
ALTER TABLE "spy_touch_search" ADD CONSTRAINT "spy_touch_search-fk_locale"
4930
    FOREIGN KEY ("fk_locale")
4931
    REFERENCES "spy_locale" ("id_locale");
4932
4933
ALTER TABLE "spy_url" ADD CONSTRAINT "spy_url-fk_resource_categorynode"
4934
    FOREIGN KEY ("fk_resource_categorynode")
4935
    REFERENCES "spy_category_node" ("id_category_node")
4936
    ON DELETE CASCADE;
4937
4938
ALTER TABLE "spy_url" ADD CONSTRAINT "spy_url-fk_resource_page"
4939
    FOREIGN KEY ("fk_resource_page")
4940
    REFERENCES "spy_cms_page" ("id_cms_page")
4941
    ON DELETE CASCADE;
4942
4943
ALTER TABLE "spy_url" ADD CONSTRAINT "spy_url-fk_resource_product_set"
4944
    FOREIGN KEY ("fk_resource_product_set")
4945
    REFERENCES "spy_product_set" ("id_product_set")
4946
    ON DELETE CASCADE;
4947
4948
ALTER TABLE "spy_url" ADD CONSTRAINT "spy_url-fk_resource_product_abstract"
4949
    FOREIGN KEY ("fk_resource_product_abstract")
4950
    REFERENCES "spy_product_abstract" ("id_product_abstract")
4951
    ON DELETE CASCADE;
4952
4953
ALTER TABLE "spy_url" ADD CONSTRAINT "spy_url-fk_locale"
4954
    FOREIGN KEY ("fk_locale")
4955
    REFERENCES "spy_locale" ("id_locale")
4956
    ON DELETE CASCADE;
4957
4958
ALTER TABLE "spy_url" ADD CONSTRAINT "spy_url-fk_resource_redirect"
4959
    FOREIGN KEY ("fk_resource_redirect")
4960
    REFERENCES "spy_url_redirect" ("id_url_redirect")
4961
    ON DELETE CASCADE;
4962
4963
ALTER TABLE "spy_user" ADD CONSTRAINT "spy_user-fk_locale"
4964
    FOREIGN KEY ("fk_locale")
4965
    REFERENCES "spy_locale" ("id_locale");
4966
4967
ALTER TABLE "spy_wishlist" ADD CONSTRAINT "spy_wishlist-fk_customer"
4968
    FOREIGN KEY ("fk_customer")
4969
    REFERENCES "spy_customer" ("id_customer");
4970
4971
ALTER TABLE "spy_wishlist_item" ADD CONSTRAINT "spy_wishlist_item-fk_wishlist"
4972
    FOREIGN KEY ("fk_wishlist")
4973
    REFERENCES "spy_wishlist" ("id_wishlist");
4974
4975
ALTER TABLE "spy_wishlist_item" ADD CONSTRAINT "spy_wishlist_item-sku"
4976
    FOREIGN KEY ("sku")
4977
    REFERENCES "spy_product" ("sku");
4978
4979
COMMIT;
4980
',
4981
);
4982
    }
4983
4984
    /**
4985
     * Get the SQL statements for the Down migration
4986
     *
4987
     * @return array list of the SQL strings to execute for the Down migration
4988
     *               the keys being the datasources
4989
     */
4990
    public function getDownSQL()
4991
    {
4992
        return array (
4993
  'zed' => '
4994
BEGIN;
4995
4996
DROP TABLE IF EXISTS "spy_acl_role" CASCADE;
4997
4998
DROP SEQUENCE "spy_acl_role_pk_seq";
4999
5000
DROP TABLE IF EXISTS "spy_acl_rule" CASCADE;
5001
5002
DROP SEQUENCE "spy_acl_rule_pk_seq";
5003
5004
DROP TABLE IF EXISTS "spy_acl_group" CASCADE;
5005
5006
DROP SEQUENCE "spy_acl_group_pk_seq";
5007
5008
DROP TABLE IF EXISTS "spy_acl_user_has_group" CASCADE;
5009
5010
DROP TABLE IF EXISTS "spy_acl_groups_has_roles" CASCADE;
5011
5012
DROP TABLE IF EXISTS "spy_auth_reset_password" CASCADE;
5013
5014
DROP SEQUENCE "spy_auth_reset_password_pk_seq";
5015
5016
DROP TABLE IF EXISTS "spy_availability_abstract" CASCADE;
5017
5018
DROP SEQUENCE "spy_availability_abstract_pk_seq";
5019
5020
DROP TABLE IF EXISTS "spy_availability" CASCADE;
5021
5022
DROP SEQUENCE "spy_availability_pk_seq";
5023
5024
DROP TABLE IF EXISTS "spy_availability_storage" CASCADE;
5025
5026
DROP SEQUENCE "spy_availability_storage_pk_seq";
5027
5028
DROP TABLE IF EXISTS "spy_availability_notification_subscription" CASCADE;
5029
5030
DROP SEQUENCE "id_availability_notification_subscription_pk_seq";
5031
5032
DROP TABLE IF EXISTS "spy_category" CASCADE;
5033
5034
DROP SEQUENCE "spy_category_pk_seq";
5035
5036
DROP TABLE IF EXISTS "spy_category_attribute" CASCADE;
5037
5038
DROP SEQUENCE "spy_category_attribute_pk_seq";
5039
5040
DROP TABLE IF EXISTS "spy_category_node" CASCADE;
5041
5042
DROP SEQUENCE "spy_category_node_pk_seq";
5043
5044
DROP TABLE IF EXISTS "spy_category_closure_table" CASCADE;
5045
5046
DROP SEQUENCE "spy_category_closure_table_pk_seq";
5047
5048
DROP TABLE IF EXISTS "spy_category_image_set" CASCADE;
5049
5050
DROP SEQUENCE "spy_category_image_set_pk_seq";
5051
5052
DROP TABLE IF EXISTS "spy_category_image" CASCADE;
5053
5054
DROP SEQUENCE "spy_category_image_pk_seq";
5055
5056
DROP TABLE IF EXISTS "spy_category_image_set_to_category_image" CASCADE;
5057
5058
DROP SEQUENCE "spy_category_image_set_to_category_image_pk_seq";
5059
5060
DROP TABLE IF EXISTS "spy_category_image_storage" CASCADE;
5061
5062
DROP SEQUENCE "spy_category_image_storage_pk_seq";
5063
5064
DROP TABLE IF EXISTS "spy_category_node_page_search" CASCADE;
5065
5066
DROP SEQUENCE "spy_category_node_page_search_pk_seq";
5067
5068
DROP TABLE IF EXISTS "spy_category_tree_storage" CASCADE;
5069
5070
DROP SEQUENCE "spy_category_tree_storage_pk_seq";
5071
5072
DROP TABLE IF EXISTS "spy_category_node_storage" CASCADE;
5073
5074
DROP SEQUENCE "spy_category_node_storage_pk_seq";
5075
5076
DROP TABLE IF EXISTS "spy_category_template" CASCADE;
5077
5078
DROP SEQUENCE "spy_category_template_pk_seq";
5079
5080
DROP TABLE IF EXISTS "spy_cms_template" CASCADE;
5081
5082
DROP SEQUENCE "spy_cms_template_pk_seq";
5083
5084
DROP TABLE IF EXISTS "spy_cms_page" CASCADE;
5085
5086
DROP SEQUENCE "spy_cms_page_pk_seq";
5087
5088
DROP TABLE IF EXISTS "spy_cms_page_localized_attributes" CASCADE;
5089
5090
DROP SEQUENCE "spy_cms_page_localized_attributes_pk_seq";
5091
5092
DROP TABLE IF EXISTS "spy_cms_glossary_key_mapping" CASCADE;
5093
5094
DROP SEQUENCE "spy_cms_glossary_key_mapping_pk_seq";
5095
5096
DROP TABLE IF EXISTS "spy_cms_version" CASCADE;
5097
5098
DROP SEQUENCE "spy_cms_version_pk_seq";
5099
5100
DROP TABLE IF EXISTS "spy_cms_page_store" CASCADE;
5101
5102
DROP SEQUENCE "id_cms_page_store_pk_seq";
5103
5104
DROP TABLE IF EXISTS "spy_cms_block_template" CASCADE;
5105
5106
DROP SEQUENCE "spy_cms_block_template_pk_seq";
5107
5108
DROP TABLE IF EXISTS "spy_cms_block_glossary_key_mapping" CASCADE;
5109
5110
DROP SEQUENCE "spy_cms_block_glossary_key_mapping_pk_seq";
5111
5112
DROP TABLE IF EXISTS "spy_cms_block" CASCADE;
5113
5114
DROP SEQUENCE "spy_cms_block_pk_seq";
5115
5116
DROP TABLE IF EXISTS "spy_cms_block_store" CASCADE;
5117
5118
DROP SEQUENCE "id_cms_block_store_pk_seq";
5119
5120
DROP TABLE IF EXISTS "spy_cms_block_category_connector" CASCADE;
5121
5122
DROP SEQUENCE "spy_cms_block_category_connector_pk_seq";
5123
5124
DROP TABLE IF EXISTS "spy_cms_block_category_position" CASCADE;
5125
5126
DROP SEQUENCE "spy_cms_block_category_position_pk_seq";
5127
5128
DROP TABLE IF EXISTS "spy_cms_block_category_storage" CASCADE;
5129
5130
DROP SEQUENCE "spy_cms_block_category_storage_pk_seq";
5131
5132
DROP TABLE IF EXISTS "spy_cms_block_product_connector" CASCADE;
5133
5134
DROP SEQUENCE "spy_cms_block_product_connector_pk_seq";
5135
5136
DROP TABLE IF EXISTS "spy_cms_block_product_storage" CASCADE;
5137
5138
DROP SEQUENCE "spy_cms_block_product_storage_pk_seq";
5139
5140
DROP TABLE IF EXISTS "spy_cms_block_storage" CASCADE;
5141
5142
DROP SEQUENCE "spy_cms_block_storage_pk_seq";
5143
5144
DROP TABLE IF EXISTS "spy_cms_page_search" CASCADE;
5145
5146
DROP SEQUENCE "spy_cms_page_search_pk_seq";
5147
5148
DROP TABLE IF EXISTS "spy_cms_page_storage" CASCADE;
5149
5150
DROP SEQUENCE "spy_cms_page_storage_pk_seq";
5151
5152
DROP TABLE IF EXISTS "spy_content" CASCADE;
5153
5154
DROP SEQUENCE "spy_content_pk_seq";
5155
5156
DROP TABLE IF EXISTS "spy_content_localized" CASCADE;
5157
5158
DROP SEQUENCE "spy_content_localized_pk_seq";
5159
5160
DROP TABLE IF EXISTS "spy_content_storage" CASCADE;
5161
5162
DROP SEQUENCE "spy_content_storage_pk_seq";
5163
5164
DROP TABLE IF EXISTS "spy_country" CASCADE;
5165
5166
DROP SEQUENCE "spy_country_pk_seq";
5167
5168
DROP TABLE IF EXISTS "spy_region" CASCADE;
5169
5170
DROP SEQUENCE "spy_region_pk_seq";
5171
5172
DROP TABLE IF EXISTS "spy_currency" CASCADE;
5173
5174
DROP SEQUENCE "spy_currency_pk_seq";
5175
5176
DROP TABLE IF EXISTS "spy_customer" CASCADE;
5177
5178
DROP SEQUENCE "spy_customer_pk_seq";
5179
5180
DROP TABLE IF EXISTS "spy_customer_address" CASCADE;
5181
5182
DROP SEQUENCE "spy_customer_address_pk_seq";
5183
5184
DROP TABLE IF EXISTS "spy_customer_group" CASCADE;
5185
5186
DROP SEQUENCE "spy_customer_group_pk_seq";
5187
5188
DROP TABLE IF EXISTS "spy_customer_group_to_customer" CASCADE;
5189
5190
DROP SEQUENCE "spy_customer_group_to_customer_pk_seq";
5191
5192
DROP TABLE IF EXISTS "spy_customer_note" CASCADE;
5193
5194
DROP SEQUENCE "spy_customer_note_pk_seq";
5195
5196
DROP TABLE IF EXISTS "spy_discount" CASCADE;
5197
5198
DROP SEQUENCE "spy_discount_pk_seq";
5199
5200
DROP TABLE IF EXISTS "spy_discount_store" CASCADE;
5201
5202
DROP SEQUENCE "id_discount_store_pk_seq";
5203
5204
DROP TABLE IF EXISTS "spy_discount_voucher_pool" CASCADE;
5205
5206
DROP SEQUENCE "spy_discount_voucher_pool_pk_seq";
5207
5208
DROP TABLE IF EXISTS "spy_discount_voucher" CASCADE;
5209
5210
DROP SEQUENCE "spy_discount_voucher_pk_seq";
5211
5212
DROP TABLE IF EXISTS "spy_discount_amount" CASCADE;
5213
5214
DROP SEQUENCE "spy_discount_amount_pk_seq";
5215
5216
DROP TABLE IF EXISTS "spy_discount_promotion" CASCADE;
5217
5218
DROP SEQUENCE "spy_discount_promotion_pk_seq";
5219
5220
DROP TABLE IF EXISTS "spy_event_behavior_entity_change" CASCADE;
5221
5222
DROP SEQUENCE "spy_event_behavior_entity_change_pk_seq";
5223
5224
DROP TABLE IF EXISTS "pyz_example_state_machine_item" CASCADE;
5225
5226
DROP SEQUENCE "pyz_example_state_machine_item_pk_seq";
5227
5228
DROP TABLE IF EXISTS "spy_file" CASCADE;
5229
5230
DROP SEQUENCE "spy_file_pk_seq";
5231
5232
DROP TABLE IF EXISTS "spy_file_info" CASCADE;
5233
5234
DROP SEQUENCE "spy_file_info_pk_seq";
5235
5236
DROP TABLE IF EXISTS "spy_file_localized_attributes" CASCADE;
5237
5238
DROP SEQUENCE "spy_file_localized_attributes_pk_seq";
5239
5240
DROP TABLE IF EXISTS "spy_file_directory" CASCADE;
5241
5242
DROP SEQUENCE "spy_file_directory_pk_seq";
5243
5244
DROP TABLE IF EXISTS "spy_file_directory_localized_attributes" CASCADE;
5245
5246
DROP SEQUENCE "spy_file_directory_localized_attributes_pk_seq";
5247
5248
DROP TABLE IF EXISTS "spy_mime_type" CASCADE;
5249
5250
DROP SEQUENCE "spy_mime_type_pk_seq";
5251
5252
DROP TABLE IF EXISTS "spy_file_storage" CASCADE;
5253
5254
DROP SEQUENCE "spy_file_storage_pk_seq";
5255
5256
DROP TABLE IF EXISTS "spy_gift_card" CASCADE;
5257
5258
DROP SEQUENCE "spy_gift_card_pk_seq";
5259
5260
DROP TABLE IF EXISTS "spy_gift_card_product_abstract_configuration" CASCADE;
5261
5262
DROP SEQUENCE "spy_gift_card_product_abstract_configuration_pk_seq";
5263
5264
DROP TABLE IF EXISTS "spy_gift_card_product_abstract_configuration_link" CASCADE;
5265
5266
DROP SEQUENCE "spy_gift_card_product_abstract_configuration_link_pk_seq";
5267
5268
DROP TABLE IF EXISTS "spy_gift_card_product_configuration" CASCADE;
5269
5270
DROP SEQUENCE "spy_gift_card_product_configuration_pk_seq";
5271
5272
DROP TABLE IF EXISTS "spy_gift_card_product_configuration_link" CASCADE;
5273
5274
DROP SEQUENCE "spy_gift_card_product_configuration_link_pk_seq";
5275
5276
DROP TABLE IF EXISTS "spy_payment_gift_card" CASCADE;
5277
5278
DROP SEQUENCE "spy_payment_gift_card_pk_seq";
5279
5280
DROP TABLE IF EXISTS "spy_gift_card_balance_log" CASCADE;
5281
5282
DROP SEQUENCE "spy_gift_card_balance_log_pk_seq";
5283
5284
DROP TABLE IF EXISTS "spy_glossary_key" CASCADE;
5285
5286
DROP SEQUENCE "spy_glossary_key_pk_seq";
5287
5288
DROP TABLE IF EXISTS "spy_glossary_translation" CASCADE;
5289
5290
DROP SEQUENCE "spy_glossary_translation_pk_seq";
5291
5292
DROP TABLE IF EXISTS "spy_glossary_storage" CASCADE;
5293
5294
DROP SEQUENCE "spy_glossary_storage_pk_seq";
5295
5296
DROP TABLE IF EXISTS "spy_locale" CASCADE;
5297
5298
DROP SEQUENCE "spy_locale_pk_seq";
5299
5300
DROP TABLE IF EXISTS "spy_navigation" CASCADE;
5301
5302
DROP SEQUENCE "spy_navigation_pk_seq";
5303
5304
DROP TABLE IF EXISTS "spy_navigation_node" CASCADE;
5305
5306
DROP SEQUENCE "spy_navigation_node_pk_seq";
5307
5308
DROP TABLE IF EXISTS "spy_navigation_node_localized_attributes" CASCADE;
5309
5310
DROP SEQUENCE "spy_navigation_node_localized_attributes_pk_seq";
5311
5312
DROP TABLE IF EXISTS "spy_navigation_storage" CASCADE;
5313
5314
DROP SEQUENCE "spy_navigation_storage_pk_seq";
5315
5316
DROP TABLE IF EXISTS "spy_newsletter_subscriber" CASCADE;
5317
5318
DROP SEQUENCE "spy_newsletter_subscriber_pk_seq";
5319
5320
DROP TABLE IF EXISTS "spy_newsletter_type" CASCADE;
5321
5322
DROP SEQUENCE "spy_newsletter_type_pk_seq";
5323
5324
DROP TABLE IF EXISTS "spy_newsletter_subscription" CASCADE;
5325
5326
DROP TABLE IF EXISTS "spy_nopayment_paid" CASCADE;
5327
5328
DROP SEQUENCE "spy_nopayment_paid_pk_seq";
5329
5330
DROP TABLE IF EXISTS "spy_oauth_access_token" CASCADE;
5331
5332
DROP SEQUENCE "spy_oauth_access_token_pk_seq";
5333
5334
DROP TABLE IF EXISTS "spy_oauth_client" CASCADE;
5335
5336
DROP SEQUENCE "spy_oauth_client_pk_seq";
5337
5338
DROP TABLE IF EXISTS "spy_oauth_scope" CASCADE;
5339
5340
DROP SEQUENCE "spy_oauth_scope_pk_seq";
5341
5342
DROP TABLE IF EXISTS "spy_oms_transition_log" CASCADE;
5343
5344
DROP SEQUENCE "spy_oms_transition_log_pk_seq";
5345
5346
DROP TABLE IF EXISTS "spy_oms_order_process" CASCADE;
5347
5348
DROP SEQUENCE "spy_oms_order_process_pk_seq";
5349
5350
DROP TABLE IF EXISTS "spy_oms_state_machine_lock" CASCADE;
5351
5352
DROP SEQUENCE "spy_oms_state_machine_lock_pk_seq";
5353
5354
DROP TABLE IF EXISTS "spy_oms_order_item_state" CASCADE;
5355
5356
DROP SEQUENCE "spy_oms_order_item_state_pk_seq";
5357
5358
DROP TABLE IF EXISTS "spy_oms_order_item_state_history" CASCADE;
5359
5360
DROP SEQUENCE "spy_oms_order_item_state_history_pk_seq";
5361
5362
DROP TABLE IF EXISTS "spy_oms_event_timeout" CASCADE;
5363
5364
DROP SEQUENCE "spy_oms_event_timeout_pk_seq";
5365
5366
DROP TABLE IF EXISTS "spy_oms_product_reservation" CASCADE;
5367
5368
DROP SEQUENCE "spy_oms_product_reservation_pk_seq";
5369
5370
DROP TABLE IF EXISTS "spy_oms_product_reservation_store" CASCADE;
5371
5372
DROP SEQUENCE "spy_oms_product_reservation_store_pk_seq";
5373
5374
DROP TABLE IF EXISTS "spy_oms_product_reservation_change_version" CASCADE;
5375
5376
DROP SEQUENCE "spy_oms_product_reservation_change_version_pk_seq";
5377
5378
DROP TABLE IF EXISTS "spy_oms_product_reservation_last_exported_version" CASCADE;
5379
5380
DROP TABLE IF EXISTS "spy_permission" CASCADE;
5381
5382
DROP SEQUENCE "spy_permission_pk_seq";
5383
5384
DROP TABLE IF EXISTS "spy_price_product" CASCADE;
5385
5386
DROP SEQUENCE "spy_price_product_pk_seq";
5387
5388
DROP TABLE IF EXISTS "spy_price_type" CASCADE;
5389
5390
DROP SEQUENCE "spy_price_type_pk_seq";
5391
5392
DROP TABLE IF EXISTS "spy_price_product_store" CASCADE;
5393
5394
DROP SEQUENCE "spy_price_product_store_pk_seq";
5395
5396
DROP TABLE IF EXISTS "spy_price_product_default" CASCADE;
5397
5398
DROP SEQUENCE "spy_price_product_default_pk_seq";
5399
5400
DROP TABLE IF EXISTS "spy_price_product_schedule" CASCADE;
5401
5402
DROP SEQUENCE "spy_price_product_schedule_pk_seq";
5403
5404
DROP TABLE IF EXISTS "spy_price_product_schedule_list" CASCADE;
5405
5406
DROP SEQUENCE "spy_price_product_schedule_list_pk_seq";
5407
5408
DROP TABLE IF EXISTS "spy_price_product_abstract_storage" CASCADE;
5409
5410
DROP SEQUENCE "spy_price_product_abstract_storage_pk_seq";
5411
5412
DROP TABLE IF EXISTS "spy_price_product_concrete_storage" CASCADE;
5413
5414
DROP SEQUENCE "spy_price_product_concrete_storage_pk_seq";
5415
5416
DROP TABLE IF EXISTS "spy_product_abstract" CASCADE;
5417
5418
DROP SEQUENCE "spy_product_abstract_pk_seq";
5419
5420
DROP TABLE IF EXISTS "spy_product_abstract_localized_attributes" CASCADE;
5421
5422
DROP SEQUENCE "spy_product_abstract_localized_attributes_pk_seq";
5423
5424
DROP TABLE IF EXISTS "spy_product_abstract_store" CASCADE;
5425
5426
DROP SEQUENCE "id_product_abstract_store_pk_seq";
5427
5428
DROP TABLE IF EXISTS "spy_product" CASCADE;
5429
5430
DROP SEQUENCE "spy_product_pk_seq";
5431
5432
DROP TABLE IF EXISTS "spy_product_localized_attributes" CASCADE;
5433
5434
DROP SEQUENCE "spy_product_localized_attributes_pk_seq";
5435
5436
DROP TABLE IF EXISTS "spy_product_attribute_key" CASCADE;
5437
5438
DROP SEQUENCE "spy_product_attribute_key_pk_seq";
5439
5440
DROP TABLE IF EXISTS "spy_product_alternative" CASCADE;
5441
5442
DROP SEQUENCE "spy_product_alternative_pk_seq";
5443
5444
DROP TABLE IF EXISTS "spy_product_alternative_storage" CASCADE;
5445
5446
DROP SEQUENCE "id_product_alternative_storage_pk_seq";
5447
5448
DROP TABLE IF EXISTS "spy_product_replacement_for_storage" CASCADE;
5449
5450
DROP SEQUENCE "id_product_replacement_for_storage_pk_seq";
5451
5452
DROP TABLE IF EXISTS "spy_product_management_attribute" CASCADE;
5453
5454
DROP SEQUENCE "spy_product_management_attribute_pk_seq";
5455
5456
DROP TABLE IF EXISTS "spy_product_management_attribute_value" CASCADE;
5457
5458
DROP SEQUENCE "spy_product_management_attribute_value_pk_seq";
5459
5460
DROP TABLE IF EXISTS "spy_product_management_attribute_value_translation" CASCADE;
5461
5462
DROP SEQUENCE "spy_product_management_attribute_value_translation_pk_seq";
5463
5464
DROP TABLE IF EXISTS "spy_sales_order_item_bundle" CASCADE;
5465
5466
DROP SEQUENCE "spy_sales_order_item_bundle_pk_seq";
5467
5468
DROP TABLE IF EXISTS "spy_product_bundle" CASCADE;
5469
5470
DROP SEQUENCE "spy_product_bundle_pk_seq";
5471
5472
DROP TABLE IF EXISTS "spy_product_category" CASCADE;
5473
5474
DROP SEQUENCE "spy_product_category_pk_seq";
5475
5476
DROP TABLE IF EXISTS "spy_product_category_filter" CASCADE;
5477
5478
DROP SEQUENCE "spy_product_category_filter_pk_seq";
5479
5480
DROP TABLE IF EXISTS "spy_product_category_filter_storage" CASCADE;
5481
5482
DROP SEQUENCE "spy_product_category_filter_storage_pk_seq";
5483
5484
DROP TABLE IF EXISTS "spy_product_abstract_category_storage" CASCADE;
5485
5486
DROP SEQUENCE "spy_product_abstract_category_storage_pk_seq";
5487
5488
DROP TABLE IF EXISTS "spy_product_discontinued" CASCADE;
5489
5490
DROP SEQUENCE "id_product_discontinued_pk_seq";
5491
5492
DROP TABLE IF EXISTS "spy_product_discontinued_note" CASCADE;
5493
5494
DROP SEQUENCE "id_product_discontinued_note_pk_seq";
5495
5496
DROP TABLE IF EXISTS "spy_product_discontinued_storage" CASCADE;
5497
5498
DROP SEQUENCE "id_product_discontinued_storage_pk_seq";
5499
5500
DROP TABLE IF EXISTS "spy_product_group" CASCADE;
5501
5502
DROP SEQUENCE "spy_product_group_pk_seq";
5503
5504
DROP TABLE IF EXISTS "spy_product_abstract_group" CASCADE;
5505
5506
DROP TABLE IF EXISTS "spy_product_abstract_group_storage" CASCADE;
5507
5508
DROP SEQUENCE "spy_product_abstract_group_storage_pk_seq";
5509
5510
DROP TABLE IF EXISTS "spy_product_image_set" CASCADE;
5511
5512
DROP SEQUENCE "spy_product_image_set_pk_seq";
5513
5514
DROP TABLE IF EXISTS "spy_product_image" CASCADE;
5515
5516
DROP SEQUENCE "spy_product_image_pk_seq";
5517
5518
DROP TABLE IF EXISTS "spy_product_image_set_to_product_image" CASCADE;
5519
5520
DROP SEQUENCE "spy_product_image_set_to_product_image_pk_seq";
5521
5522
DROP TABLE IF EXISTS "spy_product_abstract_image_storage" CASCADE;
5523
5524
DROP SEQUENCE "spy_product_abstract_image_storage_pk_seq";
5525
5526
DROP TABLE IF EXISTS "spy_product_concrete_image_storage" CASCADE;
5527
5528
DROP SEQUENCE "spy_product_concrete_image_storage_pk_seq";
5529
5530
DROP TABLE IF EXISTS "spy_product_label" CASCADE;
5531
5532
DROP SEQUENCE "spy_product_label_pk_seq";
5533
5534
DROP TABLE IF EXISTS "spy_product_label_localized_attributes" CASCADE;
5535
5536
DROP SEQUENCE "spy_product_label_localized_attributes_pk_seq";
5537
5538
DROP TABLE IF EXISTS "spy_product_label_product_abstract" CASCADE;
5539
5540
DROP SEQUENCE "spy_product_label_product_abstract_pk_seq";
5541
5542
DROP TABLE IF EXISTS "spy_product_label_dictionary_storage" CASCADE;
5543
5544
DROP SEQUENCE "spy_product_label_dictionary_storage_pk_seq";
5545
5546
DROP TABLE IF EXISTS "spy_product_abstract_label_storage" CASCADE;
5547
5548
DROP SEQUENCE "spy_product_abstract_label_storage_pk_seq";
5549
5550
DROP TABLE IF EXISTS "spy_product_option_group" CASCADE;
5551
5552
DROP SEQUENCE "spy_product_option_group_pk_seq";
5553
5554
DROP TABLE IF EXISTS "spy_product_abstract_product_option_group" CASCADE;
5555
5556
DROP TABLE IF EXISTS "spy_product_option_value" CASCADE;
5557
5558
DROP SEQUENCE "spy_product_option_value_pk_seq";
5559
5560
DROP TABLE IF EXISTS "spy_product_option_value_price" CASCADE;
5561
5562
DROP SEQUENCE "spy_product_option_value_price_pk_seq";
5563
5564
DROP TABLE IF EXISTS "spy_product_abstract_option_storage" CASCADE;
5565
5566
DROP SEQUENCE "spy_product_abstract_option_storage_pk_seq";
5567
5568
DROP TABLE IF EXISTS "spy_product_abstract_page_search" CASCADE;
5569
5570
DROP SEQUENCE "spy_product_abstract_page_search_pk_seq";
5571
5572
DROP TABLE IF EXISTS "spy_product_concrete_page_search" CASCADE;
5573
5574
DROP SEQUENCE "spy_product_concrete_page_search_pk_seq";
5575
5576
DROP TABLE IF EXISTS "spy_product_quantity" CASCADE;
5577
5578
DROP SEQUENCE "id_product_quantity_pk_seq";
5579
5580
DROP TABLE IF EXISTS "spy_product_quantity_storage" CASCADE;
5581
5582
DROP SEQUENCE "id_product_quantity_storage_pk_seq";
5583
5584
DROP TABLE IF EXISTS "spy_product_relation_type" CASCADE;
5585
5586
DROP SEQUENCE "spy_product_relation_type_pk_seq";
5587
5588
DROP TABLE IF EXISTS "spy_product_relation" CASCADE;
5589
5590
DROP SEQUENCE "spy_product_relation_pk_seq";
5591
5592
DROP TABLE IF EXISTS "spy_product_relation_product_abstract" CASCADE;
5593
5594
DROP SEQUENCE "spy_product_rel_prod_abs_type_pk_seq";
5595
5596
DROP TABLE IF EXISTS "spy_product_abstract_relation_storage" CASCADE;
5597
5598
DROP SEQUENCE "spy_product_abstract_relation_storage_pk_seq";
5599
5600
DROP TABLE IF EXISTS "spy_product_review" CASCADE;
5601
5602
DROP SEQUENCE "id_product_review_pk_seq";
5603
5604
DROP TABLE IF EXISTS "spy_product_review_search" CASCADE;
5605
5606
DROP SEQUENCE "spy_product_review_search_pk_seq";
5607
5608
DROP TABLE IF EXISTS "spy_product_abstract_review_storage" CASCADE;
5609
5610
DROP SEQUENCE "spy_product_abstract_review_storage_pk_seq";
5611
5612
DROP TABLE IF EXISTS "spy_product_search" CASCADE;
5613
5614
DROP SEQUENCE "spy_product_search_pk_seq";
5615
5616
DROP TABLE IF EXISTS "spy_product_search_attribute_map" CASCADE;
5617
5618
DROP TABLE IF EXISTS "spy_product_search_attribute" CASCADE;
5619
5620
DROP SEQUENCE "spy_product_search_attribute_pk_seq";
5621
5622
DROP TABLE IF EXISTS "spy_product_search_config_storage" CASCADE;
5623
5624
DROP SEQUENCE "spy_product_search_config_storage_pk_seq";
5625
5626
DROP TABLE IF EXISTS "spy_product_set" CASCADE;
5627
5628
DROP SEQUENCE "spy_product_set_pk_seq";
5629
5630
DROP TABLE IF EXISTS "spy_product_abstract_set" CASCADE;
5631
5632
DROP SEQUENCE "spy_product_abstract_set_pk_seq";
5633
5634
DROP TABLE IF EXISTS "spy_product_set_data" CASCADE;
5635
5636
DROP SEQUENCE "spy_product_set_data_pk_seq";
5637
5638
DROP TABLE IF EXISTS "spy_product_set_page_search" CASCADE;
5639
5640
DROP SEQUENCE "spy_product_set_page_search_pk_seq";
5641
5642
DROP TABLE IF EXISTS "spy_product_set_storage" CASCADE;
5643
5644
DROP SEQUENCE "spy_product_set_storage_pk_seq";
5645
5646
DROP TABLE IF EXISTS "spy_product_abstract_storage" CASCADE;
5647
5648
DROP SEQUENCE "spy_product_abstract_storage_pk_seq";
5649
5650
DROP TABLE IF EXISTS "spy_product_concrete_storage" CASCADE;
5651
5652
DROP SEQUENCE "spy_product_concrete_storage_pk_seq";
5653
5654
DROP TABLE IF EXISTS "spy_product_validity" CASCADE;
5655
5656
DROP SEQUENCE "spy_product_validity_pk_seq";
5657
5658
DROP TABLE IF EXISTS "spy_propel_heartbeat" CASCADE;
5659
5660
DROP TABLE IF EXISTS "spy_queue_process" CASCADE;
5661
5662
DROP SEQUENCE "spy_queue_process_pk_seq";
5663
5664
DROP TABLE IF EXISTS "spy_quote" CASCADE;
5665
5666
DROP SEQUENCE "id_quote_pk_seq";
5667
5668
DROP TABLE IF EXISTS "spy_refund" CASCADE;
5669
5670
DROP SEQUENCE "spy_refund_pk_seq";
5671
5672
DROP TABLE IF EXISTS "spy_sales_order" CASCADE;
5673
5674
DROP SEQUENCE "spy_sales_order_pk_seq";
5675
5676
DROP TABLE IF EXISTS "spy_sales_order_item" CASCADE;
5677
5678
DROP SEQUENCE "spy_sales_order_item_pk_seq";
5679
5680
DROP TABLE IF EXISTS "spy_sales_discount" CASCADE;
5681
5682
DROP SEQUENCE "spy_sales_discount_pk_seq";
5683
5684
DROP TABLE IF EXISTS "spy_sales_discount_code" CASCADE;
5685
5686
DROP SEQUENCE "spy_sales_discount_code_pk_seq";
5687
5688
DROP TABLE IF EXISTS "spy_sales_order_item_gift_card" CASCADE;
5689
5690
DROP SEQUENCE "spy_sales_order_item_gift_card_pk_seq";
5691
5692
DROP TABLE IF EXISTS "spy_sales_order_item_option" CASCADE;
5693
5694
DROP SEQUENCE "spy_sales_order_item_option_pk_seq";
5695
5696
DROP TABLE IF EXISTS "spy_sales_order_address" CASCADE;
5697
5698
DROP SEQUENCE "spy_sales_order_address_pk_seq";
5699
5700
DROP TABLE IF EXISTS "spy_sales_order_address_history" CASCADE;
5701
5702
DROP SEQUENCE "spy_sales_order_address_history_pk_seq";
5703
5704
DROP TABLE IF EXISTS "spy_sales_order_totals" CASCADE;
5705
5706
DROP SEQUENCE "spy_sales_order_totals_pk_seq";
5707
5708
DROP TABLE IF EXISTS "spy_sales_order_note" CASCADE;
5709
5710
DROP SEQUENCE "spy_sales_order_note_pk_seq";
5711
5712
DROP TABLE IF EXISTS "spy_sales_order_comment" CASCADE;
5713
5714
DROP SEQUENCE "spy_sales_order_comment_pk_seq";
5715
5716
DROP TABLE IF EXISTS "spy_sales_expense" CASCADE;
5717
5718
DROP SEQUENCE "spy_sales_expense_pk_seq";
5719
5720
DROP TABLE IF EXISTS "spy_sales_order_item_metadata" CASCADE;
5721
5722
DROP SEQUENCE "spy_sales_order_item_metadata_pk_seq";
5723
5724
DROP TABLE IF EXISTS "spy_sales_shipment" CASCADE;
5725
5726
DROP SEQUENCE "spy_sales_shipment_pk_seq";
5727
5728
DROP TABLE IF EXISTS "spy_sales_order_threshold" CASCADE;
5729
5730
DROP SEQUENCE "id_sales_order_threshold_pk_seq";
5731
5732
DROP TABLE IF EXISTS "spy_sales_order_threshold_tax_set" CASCADE;
5733
5734
DROP SEQUENCE "id_sales_order_threshold_tax_set_pk_seq";
5735
5736
DROP TABLE IF EXISTS "spy_sales_order_threshold_type" CASCADE;
5737
5738
DROP SEQUENCE "id_sales_order_threshold_type_pk_seq";
5739
5740
DROP TABLE IF EXISTS "spy_sales_payment" CASCADE;
5741
5742
DROP SEQUENCE "spy_sales_payment_pk_seq";
5743
5744
DROP TABLE IF EXISTS "spy_sales_payment_method_type" CASCADE;
5745
5746
DROP SEQUENCE "spy_sales_payment_method_type_pk_seq";
5747
5748
DROP TABLE IF EXISTS "spy_sales_reclamation" CASCADE;
5749
5750
DROP SEQUENCE "spy_sales_reclamation_pk_seq";
5751
5752
DROP TABLE IF EXISTS "spy_sales_reclamation_item" CASCADE;
5753
5754
DROP SEQUENCE "spy_sales_reclamation_item_pk_seq";
5755
5756
DROP TABLE IF EXISTS "spy_sequence_number" CASCADE;
5757
5758
DROP SEQUENCE "spy_sequence_number_pk_seq";
5759
5760
DROP TABLE IF EXISTS "spy_shipment_carrier" CASCADE;
5761
5762
DROP SEQUENCE "spy_shipment_carrier_pk_seq";
5763
5764
DROP TABLE IF EXISTS "spy_shipment_method" CASCADE;
5765
5766
DROP SEQUENCE "spy_shipment_method_pk_seq";
5767
5768
DROP TABLE IF EXISTS "spy_shipment_method_price" CASCADE;
5769
5770
DROP SEQUENCE "spy_shipment_method_price_pk_seq";
5771
5772
DROP TABLE IF EXISTS "spy_state_machine_transition_log" CASCADE;
5773
5774
DROP SEQUENCE "spy_state_machine_transition_log_pk_seq";
5775
5776
DROP TABLE IF EXISTS "spy_state_machine_process" CASCADE;
5777
5778
DROP SEQUENCE "spy_state_machine_process_pk_seq";
5779
5780
DROP TABLE IF EXISTS "spy_state_machine_lock" CASCADE;
5781
5782
DROP SEQUENCE "spy_state_machine_lock_pk_seq";
5783
5784
DROP TABLE IF EXISTS "spy_state_machine_item_state" CASCADE;
5785
5786
DROP SEQUENCE "spy_state_machine_item_state_pk_seq";
5787
5788
DROP TABLE IF EXISTS "spy_state_machine_item_state_history" CASCADE;
5789
5790
DROP SEQUENCE "spy_state_machine_item_state_history_pk_seq";
5791
5792
DROP TABLE IF EXISTS "spy_state_machine_event_timeout" CASCADE;
5793
5794
DROP SEQUENCE "spy_state_machine_event_timeout_pk_seq";
5795
5796
DROP TABLE IF EXISTS "spy_stock" CASCADE;
5797
5798
DROP SEQUENCE "spy_stock_pk_seq";
5799
5800
DROP TABLE IF EXISTS "spy_stock_product" CASCADE;
5801
5802
DROP SEQUENCE "spy_stock_product_pk_seq";
5803
5804
DROP TABLE IF EXISTS "spy_store" CASCADE;
5805
5806
DROP SEQUENCE "spy_store_pk_seq";
5807
5808
DROP TABLE IF EXISTS "spy_tax_set" CASCADE;
5809
5810
DROP SEQUENCE "spy_tax_set_pk_seq";
5811
5812
DROP TABLE IF EXISTS "spy_tax_rate" CASCADE;
5813
5814
DROP SEQUENCE "spy_tax_rate_pk_seq";
5815
5816
DROP TABLE IF EXISTS "spy_tax_set_tax" CASCADE;
5817
5818
DROP TABLE IF EXISTS "spy_tax_product_storage" CASCADE;
5819
5820
DROP SEQUENCE "id_tax_product_storage_pk_seq";
5821
5822
DROP TABLE IF EXISTS "spy_tax_set_storage" CASCADE;
5823
5824
DROP SEQUENCE "id_tax_set_storage_pk_seq";
5825
5826
DROP TABLE IF EXISTS "spy_touch" CASCADE;
5827
5828
DROP SEQUENCE "spy_touch_pk_seq";
5829
5830
DROP TABLE IF EXISTS "spy_touch_storage" CASCADE;
5831
5832
DROP SEQUENCE "spy_touch_storage_pk_seq";
5833
5834
DROP TABLE IF EXISTS "spy_touch_search" CASCADE;
5835
5836
DROP SEQUENCE "spy_touch_search_pk_seq";
5837
5838
DROP TABLE IF EXISTS "spy_unauthenticated_customer_access" CASCADE;
5839
5840
DROP SEQUENCE "spy_unauthenticated_customer_access_pk_seq";
5841
5842
DROP TABLE IF EXISTS "spy_unauthenticated_customer_access_storage" CASCADE;
5843
5844
DROP SEQUENCE "unauthenticated_customer_access_storage_pk_seq";
5845
5846
DROP TABLE IF EXISTS "spy_url" CASCADE;
5847
5848
DROP SEQUENCE "spy_url_pk_seq";
5849
5850
DROP TABLE IF EXISTS "spy_url_redirect" CASCADE;
5851
5852
DROP SEQUENCE "spy_url_redirect_pk_seq";
5853
5854
DROP TABLE IF EXISTS "spy_url_storage" CASCADE;
5855
5856
DROP SEQUENCE "spy_url_storage_pk_seq";
5857
5858
DROP TABLE IF EXISTS "spy_url_redirect_storage" CASCADE;
5859
5860
DROP SEQUENCE "spy_url_redirect_storage_pk_seq";
5861
5862
DROP TABLE IF EXISTS "spy_user" CASCADE;
5863
5864
DROP SEQUENCE "spy_user_pk_seq";
5865
5866
DROP TABLE IF EXISTS "spy_vault_deposit" CASCADE;
5867
5868
DROP SEQUENCE "id_vault_deposit_pk_seq";
5869
5870
DROP TABLE IF EXISTS "spy_wishlist" CASCADE;
5871
5872
DROP SEQUENCE "spy_wishlist_pk_seq";
5873
5874
DROP TABLE IF EXISTS "spy_wishlist_item" CASCADE;
5875
5876
DROP SEQUENCE "spy_wishlist_item_pk_seq";
5877
5878
DROP TABLE IF EXISTS "spy_acl_role_archive" CASCADE;
5879
5880
DROP TABLE IF EXISTS "spy_acl_rule_archive" CASCADE;
5881
5882
DROP TABLE IF EXISTS "spy_acl_group_archive" CASCADE;
5883
5884
DROP TABLE IF EXISTS "spy_auth_reset_password_archive" CASCADE;
5885
5886
DROP TABLE IF EXISTS "spy_product_search_attribute_map_archive" CASCADE;
5887
5888
DROP TABLE IF EXISTS "spy_product_search_attribute_archive" CASCADE;
5889
5890
DROP TABLE IF EXISTS "spy_user_archive" CASCADE;
5891
5892
COMMIT;
5893
',
5894
);
5895
    }
5896
5897
}