lavkach3

Форк
0
/
c91e663a5810_init.py 
1079 строк · 71.9 Кб
1
"""init
2

3
Revision ID: c91e663a5810
4
Revises: 
5
Create Date: 2024-09-06 10:34:52.401816
6

7
"""
8
from alembic import op
9
import sqlalchemy as sa
10
import sqlalchemy_utils
11
from sqlalchemy.dialects import postgresql
12

13
# revision identifiers, used by Alembic.
14
revision = 'c91e663a5810'
15
down_revision = None
16
branch_labels = None
17
depends_on = None
18

19

20
def upgrade():
21
    # ### commands auto generated by Alembic - please adjust! ###
22
    op.create_table('company',
23
                    sa.Column('id', sa.Uuid(), nullable=False),
24
                    sa.Column('title', sa.String(), nullable=False),
25
                    sa.Column('external_number', sa.String(), nullable=True),
26
                    sa.Column('country', sqlalchemy_utils.types.country.CountryType(length=2),
27
                              nullable=False),
28
                    sa.Column('locale', sqlalchemy_utils.types.locale.LocaleType(), nullable=False),
29
                    sa.Column('currency', sqlalchemy_utils.types.currency.CurrencyType(length=3),
30
                              nullable=False),
31
                    sa.Column('created_at', sa.DateTime(),
32
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
33
                              nullable=False),
34
                    sa.Column('updated_at', sa.DateTime(),
35
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
36
                              nullable=True),
37
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
38
                    sa.PrimaryKeyConstraint('id'),
39
                    sa.UniqueConstraint('external_number')
40
                    )
41
    op.create_index(op.f('ix_company_id'), 'company', ['id'], unique=False)
42
    op.create_index(op.f('ix_company_lsn'), 'company', ['lsn'], unique=False)
43
    op.create_index(op.f('ix_company_title'), 'company', ['title'], unique=False)
44
    op.create_table('bus',
45
                    sa.Column('id', sa.Uuid(), nullable=False),
46
                    sa.Column('cache_tag',
47
                              sa.Enum('GET_USER_LIST', 'WS_SESSION', 'MESSAGE', 'MODEL', 'REFRESH','LOGOUT',
48
                                      name='cachetag'), nullable=False),
49
                    sa.Column('message', sa.String(), nullable=False),
50
                    sa.Column('status',
51
                              sa.Enum('NEW', 'PROCESSING', 'ERROR', 'DELIVERED', name='busstatus'),
52
                              nullable=False),
53
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
54
                    sa.Column('company_id', sa.Uuid(), nullable=False),
55
                    sa.Column('created_at', sa.DateTime(),
56
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
57
                              nullable=False),
58
                    sa.Column('updated_at', sa.DateTime(),
59
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
60
                              nullable=True),
61
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
62
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
63
                    sa.PrimaryKeyConstraint('id')
64
                    )
65
    op.create_index(op.f('ix_bus_cache_tag'), 'bus', ['cache_tag'], unique=False)
66
    op.create_index(op.f('ix_bus_company_id'), 'bus', ['company_id'], unique=False)
67
    op.create_index(op.f('ix_bus_id'), 'bus', ['id'], unique=False)
68
    op.create_index(op.f('ix_bus_lsn'), 'bus', ['lsn'], unique=False)
69
    op.create_index(op.f('ix_bus_status'), 'bus', ['status'], unique=False)
70
    op.create_table('lot',
71
                    sa.Column('id', sa.Uuid(), nullable=False),
72
                    sa.Column('expiration_datetime', sa.DateTime(timezone=True), nullable=True),
73
                    sa.Column('product_id', sa.Uuid(), nullable=True),
74
                    sa.Column('external_number', sa.String(), nullable=False),
75
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
76
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
77
                    sa.Column('company_id', sa.Uuid(), nullable=False),
78
                    sa.Column('created_at', sa.DateTime(),
79
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
80
                              nullable=False),
81
                    sa.Column('updated_at', sa.DateTime(),
82
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
83
                              nullable=True),
84
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
85
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
86
                    sa.PrimaryKeyConstraint('id'),
87
                    sa.UniqueConstraint('external_number'),
88
                    sa.UniqueConstraint('external_number', 'product_id', 'partner_id',
89
                                        name='_lot_ex_pr_par_id_uc')
90
                    )
91
    op.create_index(op.f('ix_lot_company_id'), 'lot', ['company_id'], unique=False)
92
    op.create_index(op.f('ix_lot_id'), 'lot', ['id'], unique=False)
93
    op.create_index(op.f('ix_lot_lsn'), 'lot', ['lsn'], unique=False)
94
    op.create_index(op.f('ix_lot_partner_id'), 'lot', ['partner_id'], unique=False)
95
    op.create_index(op.f('ix_lot_product_id'), 'lot', ['product_id'], unique=False)
96
    op.create_table('order_type',
97
                    sa.Column('prefix', sa.String(), nullable=False),
98
                    sa.Column('title', sa.String(), nullable=False),
99
                    sa.Column('id', sa.Uuid(), nullable=False),
100
                    sa.Column('order_class',
101
                              sa.Enum('INCOMING', 'OUTGOING', 'INTERNAL', name='orderclass'),
102
                              nullable=False),
103
                    sa.Column('allowed_location_src_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
104
                              nullable=False),
105
                    sa.Column('exclude_location_src_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
106
                              nullable=False),
107
                    sa.Column('allowed_location_dest_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
108
                              nullable=False),
109
                    sa.Column('exclude_location_dest_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
110
                              nullable=False),
111
                    sa.Column('allowed_location_type_src_ids', sa.ARRAY(sa.Uuid()),
112
                              server_default='{}', nullable=False),
113
                    sa.Column('exclude_location_type_src_ids', sa.ARRAY(sa.Uuid()),
114
                              server_default='{}', nullable=False),
115
                    sa.Column('allowed_location_type_dest_ids', sa.ARRAY(sa.Uuid()),
116
                              server_default='{}', nullable=False),
117
                    sa.Column('exclude_location_type_dest_ids', sa.ARRAY(sa.Uuid()),
118
                              server_default='{}', nullable=False),
119
                    sa.Column('allowed_location_class_src_ids', sa.ARRAY(sa.String()),
120
                              server_default='{}', nullable=False),
121
                    sa.Column('exclude_location_class_src_ids', sa.ARRAY(sa.String()),
122
                              server_default='{}', nullable=False),
123
                    sa.Column('allowed_location_class_dest_ids', sa.ARRAY(sa.String()),
124
                              server_default='{}', nullable=False),
125
                    sa.Column('exclude_location_class_dest_ids', sa.ARRAY(sa.String()),
126
                              server_default='{}', nullable=False),
127
                    sa.Column('order_type_id', sa.Uuid(), nullable=True),
128
                    sa.Column('backorder_action_type',
129
                              sa.Enum('ASK', 'ALWAYS', 'NEVER', name='backorderaction'),
130
                              nullable=False),
131
                    sa.Column('store_id', sa.Uuid(), nullable=True),
132
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
133
                    sa.Column('reservation_method',
134
                              sa.Enum('AT_CONFIRM', 'MANUAL', 'AT_DATE', 'TIME_BEFORE_DATE',
135
                                      name='reservationmethod'), nullable=False),
136
                    sa.Column('reservation_time_before', sa.Integer(), nullable=True),
137
                    sa.Column('allowed_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
138
                              nullable=False),
139
                    sa.Column('exclude_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
140
                              nullable=False),
141
                    sa.Column('is_homogeneity', sa.Boolean(), nullable=False),
142
                    sa.Column('is_allow_create_package', sa.Boolean(), nullable=False),
143
                    sa.Column('is_can_create_order_manualy', sa.Boolean(), nullable=False),
144
                    sa.Column('is_overdelivery', sa.Boolean(), nullable=False),
145
                    sa.Column('barcode', sa.String(), nullable=False),
146
                    sa.Column('strategy',
147
                              sa.Enum('FEFO', 'FIFO', 'LIFO', 'LEFO', name='putawaystrategy'),
148
                              nullable=False),
149
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
150
                    sa.Column('company_id', sa.Uuid(), nullable=False),
151
                    sa.Column('created_at', sa.DateTime(),
152
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
153
                              nullable=False),
154
                    sa.Column('updated_at', sa.DateTime(),
155
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
156
                              nullable=True),
157
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
158
                    sa.Column('created_by', sa.Uuid(), nullable=False),
159
                    sa.Column('edited_by', sa.Uuid(), nullable=False),
160
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
161
                    sa.ForeignKeyConstraint(['order_type_id'], ['order_type.id'],
162
                                            ondelete='CASCADE'),
163
                    sa.PrimaryKeyConstraint('id'),
164
                    sa.UniqueConstraint('title', 'company_id',
165
                                        name='_order_type_companyid_title_uc')
166
                    )
167
    op.create_index(op.f('ix_order_type_allowed_location_class_dest_ids'), 'order_type',
168
                    ['allowed_location_class_dest_ids'], unique=False)
169
    op.create_index(op.f('ix_order_type_allowed_location_class_src_ids'), 'order_type',
170
                    ['allowed_location_class_src_ids'], unique=False)
171
    op.create_index(op.f('ix_order_type_allowed_location_dest_ids'), 'order_type',
172
                    ['allowed_location_dest_ids'], unique=False)
173
    op.create_index(op.f('ix_order_type_allowed_location_src_ids'), 'order_type',
174
                    ['allowed_location_src_ids'], unique=False)
175
    op.create_index(op.f('ix_order_type_allowed_location_type_dest_ids'), 'order_type',
176
                    ['allowed_location_type_dest_ids'], unique=False)
177
    op.create_index(op.f('ix_order_type_allowed_location_type_src_ids'), 'order_type',
178
                    ['allowed_location_type_src_ids'], unique=False)
179
    op.create_index(op.f('ix_order_type_allowed_package_ids'), 'order_type',
180
                    ['allowed_package_ids'], unique=False)
181
    op.create_index(op.f('ix_order_type_company_id'), 'order_type', ['company_id'], unique=False)
182
    op.create_index(op.f('ix_order_type_created_by'), 'order_type', ['created_by'], unique=False)
183
    op.create_index(op.f('ix_order_type_edited_by'), 'order_type', ['edited_by'], unique=False)
184
    op.create_index(op.f('ix_order_type_exclude_location_class_dest_ids'), 'order_type',
185
                    ['exclude_location_class_dest_ids'], unique=False)
186
    op.create_index(op.f('ix_order_type_exclude_location_class_src_ids'), 'order_type',
187
                    ['exclude_location_class_src_ids'], unique=False)
188
    op.create_index(op.f('ix_order_type_exclude_location_dest_ids'), 'order_type',
189
                    ['exclude_location_dest_ids'], unique=False)
190
    op.create_index(op.f('ix_order_type_exclude_location_src_ids'), 'order_type',
191
                    ['exclude_location_src_ids'], unique=False)
192
    op.create_index(op.f('ix_order_type_exclude_location_type_dest_ids'), 'order_type',
193
                    ['exclude_location_type_dest_ids'], unique=False)
194
    op.create_index(op.f('ix_order_type_exclude_location_type_src_ids'), 'order_type',
195
                    ['exclude_location_type_src_ids'], unique=False)
196
    op.create_index(op.f('ix_order_type_exclude_package_ids'), 'order_type',
197
                    ['exclude_package_ids'], unique=False)
198
    op.create_index(op.f('ix_order_type_id'), 'order_type', ['id'], unique=False)
199
    op.create_index(op.f('ix_order_type_lsn'), 'order_type', ['lsn'], unique=False)
200
    op.create_index(op.f('ix_order_type_partner_id'), 'order_type', ['partner_id'], unique=False)
201
    op.create_index(op.f('ix_order_type_prefix'), 'order_type', ['prefix'], unique=False)
202
    op.create_index(op.f('ix_order_type_store_id'), 'order_type', ['store_id'], unique=False)
203
    op.create_index(op.f('ix_order_type_title'), 'order_type', ['title'], unique=False)
204
    op.create_table('product_category',
205
                    sa.Column('id', sa.Uuid(), nullable=False),
206
                    sa.Column('external_number', sa.String(), nullable=True),
207
                    sa.Column('title', sa.String(), nullable=False),
208
                    sa.Column('product_category_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
209
                              nullable=False),
210
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
211
                    sa.Column('company_id', sa.Uuid(), nullable=False),
212
                    sa.Column('created_at', sa.DateTime(),
213
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
214
                              nullable=False),
215
                    sa.Column('updated_at', sa.DateTime(),
216
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
217
                              nullable=True),
218
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
219
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
220
                    sa.PrimaryKeyConstraint('id'),
221
                    sa.UniqueConstraint('external_number', 'company_id',
222
                                        name='_product_category_company_id_uc')
223
                    )
224
    op.create_index(op.f('ix_product_category_company_id'), 'product_category', ['company_id'],
225
                    unique=False)
226
    op.create_index(op.f('ix_product_category_id'), 'product_category', ['id'], unique=False)
227
    op.create_index(op.f('ix_product_category_lsn'), 'product_category', ['lsn'], unique=False)
228
    op.create_index(op.f('ix_product_category_product_category_ids'), 'product_category',
229
                    ['product_category_ids'], unique=False)
230
    op.create_index(op.f('ix_product_category_title'), 'product_category', ['title'], unique=False)
231
    op.create_table('product_storage_type',
232
                    sa.Column('product_id', sa.Uuid(), nullable=False),
233
                    sa.Column('storage_uom_id', sa.Uuid(), nullable=True),
234
                    sa.Column('storage_image_url', sa.String(), nullable=True),
235
                    sa.Column('allowed_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
236
                              nullable=False),
237
                    sa.Column('exclude_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
238
                              nullable=False),
239
                    sa.Column('is_homogeneity', sa.Boolean(), nullable=False),
240
                    sa.Column('is_mix_products', sa.Boolean(), nullable=True),
241
                    sa.Column('storage_type_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
242
                              nullable=False),
243
                    sa.Column('id', sa.Uuid(), nullable=False),
244
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
245
                    sa.Column('company_id', sa.Uuid(), nullable=False),
246
                    sa.Column('created_at', sa.DateTime(),
247
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
248
                              nullable=False),
249
                    sa.Column('updated_at', sa.DateTime(),
250
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
251
                              nullable=True),
252
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
253
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
254
                    sa.PrimaryKeyConstraint('id'),
255
                    sa.UniqueConstraint('product_id', 'company_id',
256
                                        name='stor_type_product_company_id_uc')
257
                    )
258
    op.create_index(op.f('ix_product_storage_type_allowed_package_ids'), 'product_storage_type',
259
                    ['allowed_package_ids'], unique=False)
260
    op.create_index(op.f('ix_product_storage_type_company_id'), 'product_storage_type',
261
                    ['company_id'], unique=False)
262
    op.create_index(op.f('ix_product_storage_type_exclude_package_ids'), 'product_storage_type',
263
                    ['exclude_package_ids'], unique=False)
264
    op.create_index(op.f('ix_product_storage_type_id'), 'product_storage_type', ['id'],
265
                    unique=False)
266
    op.create_index(op.f('ix_product_storage_type_lsn'), 'product_storage_type', ['lsn'],
267
                    unique=False)
268
    op.create_index(op.f('ix_product_storage_type_product_id'), 'product_storage_type',
269
                    ['product_id'], unique=False)
270
    op.create_table('role',
271
                    sa.Column('id', sa.Uuid(), nullable=False),
272
                    sa.Column('title', sa.String(), nullable=False),
273
                    sa.Column('role_ids', sa.ARRAY(sa.Uuid()), server_default='{}', nullable=False,
274
                              comment='Список дочерних ролей'),
275
                    sa.Column('permission_allow_list', postgresql.ARRAY(sa.String()),
276
                              server_default='{}', nullable=False),
277
                    sa.Column('permission_deny_list', postgresql.ARRAY(sa.String()),
278
                              server_default='{}', nullable=False),
279
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
280
                    sa.Column('company_id', sa.Uuid(), nullable=False),
281
                    sa.Column('created_at', sa.DateTime(),
282
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
283
                              nullable=False),
284
                    sa.Column('updated_at', sa.DateTime(),
285
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
286
                              nullable=True),
287
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
288
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
289
                    sa.PrimaryKeyConstraint('id'),
290
                    sa.UniqueConstraint('title', 'company_id', name='_role_company_id_uc')
291
                    )
292
    op.create_index(op.f('ix_role_company_id'), 'role', ['company_id'], unique=False)
293
    op.create_index(op.f('ix_role_id'), 'role', ['id'], unique=False)
294
    op.create_index(op.f('ix_role_lsn'), 'role', ['lsn'], unique=False)
295
    op.create_index(op.f('ix_role_permission_allow_list'), 'role', ['permission_allow_list'],
296
                    unique=False)
297
    op.create_index(op.f('ix_role_role_ids'), 'role', ['role_ids'], unique=False)
298
    op.create_index(op.f('ix_role_title'), 'role', ['title'], unique=False)
299
    op.create_table('storage_type',
300
                    sa.Column('id', sa.Uuid(), nullable=False),
301
                    sa.Column('title', sa.String(), nullable=False),
302
                    sa.Column('priority', sa.Integer(), nullable=False),
303
                    sa.Column('location_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
304
                              nullable=False),
305
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
306
                    sa.Column('company_id', sa.Uuid(), nullable=False),
307
                    sa.Column('created_at', sa.DateTime(),
308
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
309
                              nullable=False),
310
                    sa.Column('updated_at', sa.DateTime(),
311
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
312
                              nullable=True),
313
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
314
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
315
                    sa.PrimaryKeyConstraint('id')
316
                    )
317
    op.create_index(op.f('ix_storage_type_company_id'), 'storage_type', ['company_id'],
318
                    unique=False)
319
    op.create_index(op.f('ix_storage_type_id'), 'storage_type', ['id'], unique=False)
320
    op.create_index(op.f('ix_storage_type_lsn'), 'storage_type', ['lsn'], unique=False)
321
    op.create_table('store',
322
                    sa.Column('id', sa.Uuid(), nullable=False),
323
                    sa.Column('title', sa.String(), nullable=False),
324
                    sa.Column('external_number', sa.String(), nullable=True),
325
                    sa.Column('address', sa.String(), nullable=False),
326
                    sa.Column('source', sa.String(), nullable=False),
327
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
328
                    sa.Column('company_id', sa.Uuid(), nullable=False),
329
                    sa.Column('created_at', sa.DateTime(),
330
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
331
                              nullable=False),
332
                    sa.Column('updated_at', sa.DateTime(),
333
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
334
                              nullable=True),
335
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
336
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
337
                    sa.PrimaryKeyConstraint('id'),
338
                    sa.UniqueConstraint('external_number')
339
                    )
340
    op.create_index(op.f('ix_store_company_id'), 'store', ['company_id'], unique=False)
341
    op.create_index(op.f('ix_store_id'), 'store', ['id'], unique=False)
342
    op.create_index(op.f('ix_store_lsn'), 'store', ['lsn'], unique=False)
343
    op.create_index(op.f('ix_store_title'), 'store', ['title'], unique=False)
344
    op.create_table('uom_category',
345
                    sa.Column('id', sa.Uuid(), nullable=False),
346
                    sa.Column('title', sa.String(), nullable=False),
347
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
348
                    sa.Column('company_id', sa.Uuid(), nullable=False),
349
                    sa.Column('created_at', sa.DateTime(),
350
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
351
                              nullable=False),
352
                    sa.Column('updated_at', sa.DateTime(),
353
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
354
                              nullable=True),
355
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
356
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
357
                    sa.PrimaryKeyConstraint('id')
358
                    )
359
    op.create_index(op.f('ix_uom_category_company_id'), 'uom_category', ['company_id'],
360
                    unique=False)
361
    op.create_index(op.f('ix_uom_category_id'), 'uom_category', ['id'], unique=False)
362
    op.create_index(op.f('ix_uom_category_lsn'), 'uom_category', ['lsn'], unique=False)
363
    op.create_index(op.f('ix_uom_category_title'), 'uom_category', ['title'], unique=False)
364
    op.create_table('location_type',
365
                    sa.Column('title', sa.String(), nullable=False),
366
                    sa.Column('store_id', sa.Uuid(), nullable=True),
367
                    sa.Column('allowed_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
368
                              nullable=False),
369
                    sa.Column('exclude_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
370
                              nullable=False),
371
                    sa.Column('is_homogeneity', sa.Boolean(), nullable=True),
372
                    sa.Column('strategy',
373
                              sa.Enum('FEFO', 'FIFO', 'LIFO', 'LEFO', name='putawaystrategy'),
374
                              nullable=True),
375
                    sa.Column('is_can_negative', sa.Boolean(), server_default=sa.text('false'),
376
                              nullable=True),
377
                    sa.Column('id', sa.Uuid(), nullable=False),
378
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
379
                    sa.Column('company_id', sa.Uuid(), nullable=False),
380
                    sa.Column('created_at', sa.DateTime(),
381
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
382
                              nullable=False),
383
                    sa.Column('updated_at', sa.DateTime(),
384
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
385
                              nullable=True),
386
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
387
                    sa.Column('location_class',
388
                              sa.Enum('PARTNER', 'PLACE', 'RESOURCE', 'PACKAGE', 'ZONE', 'LOST',
389
                                      'INVENTORY', 'SCRAP', 'SCRAPPED', 'BUFFER',
390
                                      name='locationclass'), nullable=False),
391
                    sa.Column('lot_id', sa.Uuid(), nullable=True),
392
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
393
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
394
                    sa.ForeignKeyConstraint(['lot_id'], ['lot.id'], ondelete='SET NULL'),
395
                    sa.PrimaryKeyConstraint('id')
396
                    )
397
    op.create_index(op.f('ix_location_type_allowed_package_ids'), 'location_type',
398
                    ['allowed_package_ids'], unique=False)
399
    op.create_index(op.f('ix_location_type_company_id'), 'location_type', ['company_id'],
400
                    unique=False)
401
    op.create_index(op.f('ix_location_type_exclude_package_ids'), 'location_type',
402
                    ['exclude_package_ids'], unique=False)
403
    op.create_index(op.f('ix_location_type_id'), 'location_type', ['id'], unique=False)
404
    op.create_index(op.f('ix_location_type_is_can_negative'), 'location_type', ['is_can_negative'],
405
                    unique=False)
406
    op.create_index(op.f('ix_location_type_is_homogeneity'), 'location_type', ['is_homogeneity'],
407
                    unique=False)
408
    op.create_index(op.f('ix_location_type_location_class'), 'location_type', ['location_class'],
409
                    unique=False)
410
    op.create_index(op.f('ix_location_type_lot_id'), 'location_type', ['lot_id'], unique=False)
411
    op.create_index(op.f('ix_location_type_lsn'), 'location_type', ['lsn'], unique=False)
412
    op.create_index(op.f('ix_location_type_partner_id'), 'location_type', ['partner_id'],
413
                    unique=False)
414
    op.create_index(op.f('ix_location_type_store_id'), 'location_type', ['store_id'], unique=False)
415
    op.create_index(op.f('ix_location_type_title'), 'location_type', ['title'], unique=False)
416
    op.create_table('order',
417
                    sa.Column('number', sa.String(), nullable=False),
418
                    sa.Column('order_type_id', sa.Uuid(), nullable=False),
419
                    sa.Column('order_id', sa.Uuid(), nullable=True),
420
                    sa.Column('external_number', sa.String(), nullable=True),
421
                    sa.Column('store_id', sa.Uuid(), nullable=False),
422
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
423
                    sa.Column('lot_id', sa.Uuid(), nullable=True),
424
                    sa.Column('origin_type', sa.String(), nullable=True),
425
                    sa.Column('origin_number', sa.String(), nullable=True),
426
                    sa.Column('planned_datetime', sa.DateTime(timezone=True), nullable=True),
427
                    sa.Column('actual_datetime', sa.DateTime(timezone=True), nullable=True),
428
                    sa.Column('expiration_datetime', sa.DateTime(timezone=True), nullable=True),
429
                    sa.Column('user_ids', sa.ARRAY(sa.Uuid()), server_default='{}', nullable=False),
430
                    sa.Column('description', sa.String(), nullable=True),
431
                    sa.Column('status', sa.Enum('DRAFT', 'WAITING', 'CONFIRMED', 'ASSIGNED', 'DONE',
432
                                                'CANCELED', name='orderstatus'), nullable=False),
433
                    sa.Column('id', sa.Uuid(), nullable=False),
434
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
435
                    sa.Column('company_id', sa.Uuid(), nullable=False),
436
                    sa.Column('created_at', sa.DateTime(),
437
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
438
                              nullable=False),
439
                    sa.Column('updated_at', sa.DateTime(),
440
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
441
                              nullable=True),
442
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
443
                    sa.Column('created_by', sa.Uuid(), nullable=False),
444
                    sa.Column('edited_by', sa.Uuid(), nullable=False),
445
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
446
                    sa.ForeignKeyConstraint(['lot_id'], ['lot.id'], ondelete='SET NULL'),
447
                    sa.ForeignKeyConstraint(['order_id'], ['order.id'], ondelete='CASCADE'),
448
                    sa.ForeignKeyConstraint(['order_type_id'], ['order_type.id'],
449
                                            ondelete='CASCADE'),
450
                    sa.PrimaryKeyConstraint('id'),
451
                    sa.UniqueConstraint('external_number', 'company_id',
452
                                        name='_order_companyid_external_number_uc')
453
                    )
454
    op.create_index(op.f('ix_order_company_id'), 'order', ['company_id'], unique=False)
455
    op.create_index(op.f('ix_order_created_by'), 'order', ['created_by'], unique=False)
456
    op.create_index(op.f('ix_order_edited_by'), 'order', ['edited_by'], unique=False)
457
    op.create_index(op.f('ix_order_id'), 'order', ['id'], unique=False)
458
    op.create_index(op.f('ix_order_lsn'), 'order', ['lsn'], unique=False)
459
    op.create_index(op.f('ix_order_number'), 'order', ['number'], unique=False)
460
    op.create_index(op.f('ix_order_origin_number'), 'order', ['origin_number'], unique=False)
461
    op.create_index(op.f('ix_order_origin_type'), 'order', ['origin_type'], unique=False)
462
    op.create_index(op.f('ix_order_partner_id'), 'order', ['partner_id'], unique=False)
463
    op.create_index(op.f('ix_order_store_id'), 'order', ['store_id'], unique=False)
464
    op.create_index(op.f('ix_order_user_ids'), 'order', ['user_ids'], unique=False)
465
    op.create_table('uom',
466
                    sa.Column('id', sa.Uuid(), nullable=False),
467
                    sa.Column('title', sa.String(), nullable=False),
468
                    sa.Column('uom_category_id', sa.Uuid(), nullable=True),
469
                    sa.Column('type', sa.String(), nullable=False),
470
                    sa.Column('ratio', sa.Numeric(precision=12, scale=2), nullable=False),
471
                    sa.Column('precision', sa.Numeric(precision=12, scale=2), nullable=False),
472
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
473
                    sa.Column('company_id', sa.Uuid(), nullable=False),
474
                    sa.Column('created_at', sa.DateTime(),
475
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
476
                              nullable=False),
477
                    sa.Column('updated_at', sa.DateTime(),
478
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
479
                              nullable=True),
480
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
481
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
482
                    sa.ForeignKeyConstraint(['uom_category_id'], ['uom_category.id'], ),
483
                    sa.PrimaryKeyConstraint('id')
484
                    )
485
    op.create_index(op.f('ix_uom_company_id'), 'uom', ['company_id'], unique=False)
486
    op.create_index(op.f('ix_uom_id'), 'uom', ['id'], unique=False)
487
    op.create_index(op.f('ix_uom_lsn'), 'uom', ['lsn'], unique=False)
488
    op.create_index(op.f('ix_uom_title'), 'uom', ['title'], unique=False)
489
    op.create_index(op.f('ix_uom_type'), 'uom', ['type'], unique=False)
490
    op.create_table('user',
491
                    sa.Column('id', sa.Uuid(), nullable=False),
492
                    sa.Column('external_number', sa.String(), nullable=True),
493
                    sa.Column('password', sqlalchemy_utils.types.password.PasswordType(
494

495
                    ),
496
                              nullable=False),
497
                    sa.Column('email', sqlalchemy_utils.types.email.EmailType(length=255),
498
                              nullable=True),
499
                    sa.Column('country', sqlalchemy_utils.types.country.CountryType(length=2),
500
                              nullable=False),
501
                    sa.Column('locale', sqlalchemy_utils.types.locale.LocaleType(),
502
                              nullable=False),
503
                    sa.Column('phone_number',
504
                              sqlalchemy_utils.types.phone_number.PhoneNumberType(length=20),
505
                              nullable=True),
506
                    sa.Column('nickname', sa.String(), nullable=False),
507
                    sa.Column('is_admin', sa.Boolean(), nullable=False),
508
                    sa.Column('type', sa.String(), nullable=False),
509
                    sa.Column('store_id', sa.Uuid(), nullable=True),
510
                    sa.Column('company_id', sa.Uuid(), nullable=True),
511
                    sa.Column('company_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
512
                              nullable=False),
513
                    sa.Column('role_ids', sa.ARRAY(sa.Uuid()), server_default='{}', nullable=False),
514
                    sa.Column('created_at', sa.DateTime(),
515
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
516
                              nullable=False),
517
                    sa.Column('updated_at', sa.DateTime(),
518
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
519
                              nullable=True),
520
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
521
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
522
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
523
                    sa.ForeignKeyConstraint(['store_id'], ['store.id'], ),
524
                    sa.PrimaryKeyConstraint('id'),
525
                    sa.UniqueConstraint('email', 'company_ids', name='_user_company_id_uc')
526
                    )
527
    op.create_index(op.f('ix_user_company_id'), 'user', ['company_id'], unique=False)
528
    op.create_index(op.f('ix_user_company_ids'), 'user', ['company_ids'], unique=False)
529
    op.create_index(op.f('ix_user_id'), 'user', ['id'], unique=False)
530
    op.create_index(op.f('ix_user_lsn'), 'user', ['lsn'], unique=False)
531
    op.create_index(op.f('ix_user_role_ids'), 'user', ['role_ids'], unique=False)
532
    op.create_index(op.f('ix_user_store_id'), 'user', ['store_id'], unique=False)
533
    op.create_table('location',
534
                    sa.Column('title', sa.String(), nullable=False),
535
                    sa.Column('store_id', sa.Uuid(), nullable=True),
536
                    sa.Column('location_class',
537
                              sa.Enum('PARTNER', 'PLACE', 'RESOURCE', 'PACKAGE', 'ZONE', 'LOST',
538
                                      'INVENTORY', 'SCRAP', 'SCRAPPED', 'BUFFER',
539
                                      name='locationclass'), nullable=False),
540
                    sa.Column('location_type_id', sa.Uuid(), nullable=False),
541
                    sa.Column('location_id', sa.Uuid(), nullable=True),
542
                    sa.Column('is_active', sa.Boolean(), nullable=True),
543
                    sa.Column('allowed_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
544
                              nullable=False),
545
                    sa.Column('exclude_package_ids', sa.ARRAY(sa.Uuid()), server_default='{}',
546
                              nullable=False),
547
                    sa.Column('is_can_negative', sa.Boolean(), server_default=sa.text('false'),
548
                              nullable=True),
549
                    sa.Column('id', sa.Uuid(), nullable=False),
550
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
551
                    sa.Column('company_id', sa.Uuid(), nullable=False),
552
                    sa.Column('created_at', sa.DateTime(),
553
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
554
                              nullable=False),
555
                    sa.Column('updated_at', sa.DateTime(),
556
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
557
                              nullable=True),
558
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
559
                    sa.Column('lot_id', sa.Uuid(), nullable=True),
560
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
561
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
562
                    sa.ForeignKeyConstraint(['location_id'], ['location.id'], ),
563
                    sa.ForeignKeyConstraint(['location_type_id'], ['location_type.id'], ),
564
                    sa.ForeignKeyConstraint(['lot_id'], ['lot.id'], ondelete='SET NULL'),
565
                    sa.PrimaryKeyConstraint('id')
566
                    )
567
    op.create_index(op.f('ix_location_allowed_package_ids'), 'location', ['allowed_package_ids'],
568
                    unique=False)
569
    op.create_index(op.f('ix_location_company_id'), 'location', ['company_id'], unique=False)
570
    op.create_index(op.f('ix_location_exclude_package_ids'), 'location', ['exclude_package_ids'],
571
                    unique=False)
572
    op.create_index(op.f('ix_location_id'), 'location', ['id'], unique=False)
573
    op.create_index(op.f('ix_location_is_can_negative'), 'location', ['is_can_negative'],
574
                    unique=False)
575
    op.create_index(op.f('ix_location_location_class'), 'location', ['location_class'],
576
                    unique=False)
577
    op.create_index(op.f('ix_location_location_id'), 'location', ['location_id'], unique=False)
578
    op.create_index(op.f('ix_location_location_type_id'), 'location', ['location_type_id'],
579
                    unique=False)
580
    op.create_index(op.f('ix_location_lot_id'), 'location', ['lot_id'], unique=False)
581
    op.create_index(op.f('ix_location_lsn'), 'location', ['lsn'], unique=False)
582
    op.create_index(op.f('ix_location_partner_id'), 'location', ['partner_id'], unique=False)
583
    op.create_index(op.f('ix_location_store_id'), 'location', ['store_id'], unique=False)
584
    op.create_index(op.f('ix_location_title'), 'location', ['title'], unique=False)
585
    op.create_table('partner',
586
                    sa.Column('id', sa.Uuid(), nullable=False),
587
                    sa.Column('title', sa.String(), nullable=False),
588
                    sa.Column('type',
589
                              sa.Enum('PARTNER', 'CONTACT', 'SUBPARTNER', 'INTERCOMPANY', 'STORE',
590
                                      'USER', name='partnertype'), nullable=False),
591
                    sa.Column('external_number', sa.String(), nullable=True),
592
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
593
                    sa.Column('phone_number',
594
                              sqlalchemy_utils.types.phone_number.PhoneNumberType(length=20),
595
                              nullable=True),
596
                    sa.Column('email', sqlalchemy_utils.types.email.EmailType(length=255),
597
                              nullable=True),
598
                    sa.Column('country', sqlalchemy_utils.types.country.CountryType(length=2),
599
                              nullable=False),
600
                    sa.Column('created_by', sa.Uuid(), nullable=False),
601
                    sa.Column('locale', sqlalchemy_utils.types.locale.LocaleType(),
602
                              nullable=False),
603
                    sa.Column('currency', sqlalchemy_utils.types.currency.CurrencyType(length=3),
604
                              nullable=False),
605
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
606
                    sa.Column('company_id', sa.Uuid(), nullable=False),
607
                    sa.Column('created_at', sa.DateTime(),
608
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
609
                              nullable=False),
610
                    sa.Column('updated_at', sa.DateTime(),
611
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
612
                              nullable=True),
613
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
614
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
615
                    sa.ForeignKeyConstraint(['created_by'], ['user.id'], ),
616
                    sa.ForeignKeyConstraint(['partner_id'], ['partner.id'], ),
617
                    sa.PrimaryKeyConstraint('id'),
618
                    sa.UniqueConstraint('external_number')
619
                    )
620
    op.create_index(op.f('ix_partner_company_id'), 'partner', ['company_id'], unique=False)
621
    op.create_index(op.f('ix_partner_created_by'), 'partner', ['created_by'], unique=False)
622
    op.create_index(op.f('ix_partner_id'), 'partner', ['id'], unique=False)
623
    op.create_index(op.f('ix_partner_lsn'), 'partner', ['lsn'], unique=False)
624
    op.create_index(op.f('ix_partner_partner_id'), 'partner', ['partner_id'], unique=False)
625
    op.create_index(op.f('ix_partner_title'), 'partner', ['title'], unique=False)
626
    op.create_table('product',
627
                    sa.Column('id', sa.Uuid(), nullable=False),
628
                    sa.Column('title', sa.String(), nullable=False),
629
                    sa.Column('description', sa.String(), nullable=True),
630
                    sa.Column('image_url', sa.String(), nullable=True),
631
                    sa.Column('external_number', sa.String(), nullable=True),
632
                    sa.Column('product_type', sa.String(), nullable=False),
633
                    sa.Column('uom_id', sa.Uuid(), nullable=False),
634
                    sa.Column('product_category_id', sa.Uuid(), nullable=False),
635
                    sa.Column('barcode_list', postgresql.ARRAY(sa.String()), server_default='{}',
636
                              nullable=False),
637
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
638
                    sa.Column('company_id', sa.Uuid(), nullable=False),
639
                    sa.Column('created_at', sa.DateTime(),
640
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
641
                              nullable=False),
642
                    sa.Column('updated_at', sa.DateTime(),
643
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
644
                              nullable=True),
645
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
646
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
647
                    sa.ForeignKeyConstraint(['product_category_id'], ['product_category.id'], ),
648
                    sa.ForeignKeyConstraint(['uom_id'], ['uom.id'], ),
649
                    sa.PrimaryKeyConstraint('id'),
650
                    sa.UniqueConstraint('external_number', 'company_id',
651
                                        name='_product_company_id_uc')
652
                    )
653
    op.create_index(op.f('ix_product_barcode_list'), 'product', ['barcode_list'], unique=False)
654
    op.create_index(op.f('ix_product_company_id'), 'product', ['company_id'], unique=False)
655
    op.create_index(op.f('ix_product_id'), 'product', ['id'], unique=False)
656
    op.create_index(op.f('ix_product_lsn'), 'product', ['lsn'], unique=False)
657
    op.create_index(op.f('ix_product_product_category_id'), 'product', ['product_category_id'],
658
                    unique=False)
659
    op.create_index(op.f('ix_product_title'), 'product', ['title'], unique=False)
660
    op.create_index(op.f('ix_product_uom_id'), 'product', ['uom_id'], unique=False)
661
    op.create_table('move_log',
662
                    sa.Column('product_id', sa.Uuid(), nullable=False),
663
                    sa.Column('store_id', sa.Uuid(), nullable=False),
664
                    sa.Column('location_class',
665
                              sa.Enum('PARTNER', 'PLACE', 'RESOURCE', 'PACKAGE', 'ZONE', 'LOST',
666
                                      'INVENTORY', 'SCRAP', 'SCRAPPED', 'BUFFER',
667
                                      name='locationclass'), nullable=False),
668
                    sa.Column('location_type_id', sa.Uuid(), nullable=False),
669
                    sa.Column('location_id', sa.Uuid(), nullable=True),
670
                    sa.Column('lot_id', sa.Uuid(), nullable=True),
671
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
672
                    sa.Column('quantity', sa.Float(), nullable=False),
673
                    sa.Column('reserved_quantity', sa.Float(), nullable=False),
674
                    sa.Column('id', sa.Uuid(), nullable=False),
675
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
676
                    sa.Column('company_id', sa.Uuid(), nullable=False),
677
                    sa.Column('created_at', sa.DateTime(),
678
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
679
                              nullable=False),
680
                    sa.Column('updated_at', sa.DateTime(),
681
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
682
                              nullable=True),
683
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
684
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
685
                    sa.ForeignKeyConstraint(['location_id'], ['location.id'], ondelete='SET NULL'),
686
                    sa.ForeignKeyConstraint(['location_type_id'], ['location_type.id'],
687
                                            ondelete='SET NULL'),
688
                    sa.ForeignKeyConstraint(['lot_id'], ['lot.id'], ondelete='SET NULL'),
689
                    sa.PrimaryKeyConstraint('id')
690
                    )
691
    op.create_index(op.f('ix_move_log_company_id'), 'move_log', ['company_id'], unique=False)
692
    op.create_index(op.f('ix_move_log_id'), 'move_log', ['id'], unique=False)
693
    op.create_index(op.f('ix_move_log_location_class'), 'move_log', ['location_class'],
694
                    unique=False)
695
    op.create_index(op.f('ix_move_log_location_id'), 'move_log', ['location_id'], unique=False)
696
    op.create_index(op.f('ix_move_log_location_type_id'), 'move_log', ['location_type_id'],
697
                    unique=False)
698
    op.create_index(op.f('ix_move_log_lot_id'), 'move_log', ['lot_id'], unique=False)
699
    op.create_index(op.f('ix_move_log_lsn'), 'move_log', ['lsn'], unique=False)
700
    op.create_index(op.f('ix_move_log_partner_id'), 'move_log', ['partner_id'], unique=False)
701
    op.create_index(op.f('ix_move_log_product_id'), 'move_log', ['product_id'], unique=False)
702
    op.create_index(op.f('ix_move_log_store_id'), 'move_log', ['store_id'], unique=False)
703
    op.create_table('quant',
704
                    sa.Column('quantity', sa.Float(), nullable=False),
705
                    sa.Column('reserved_quantity', sa.Float(), nullable=False),
706
                    sa.Column('incoming_quantity', sa.Float(), nullable=False),
707
                    sa.Column('expiration_datetime', sa.DateTime(timezone=True), nullable=True),
708
                    sa.Column('uom_id', sa.Uuid(), nullable=False),
709
                    sa.Column('move_ids', sa.ARRAY(sa.Uuid()), server_default='{}', nullable=False),
710
                    sa.Column('id', sa.Uuid(), nullable=False),
711
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
712
                    sa.Column('company_id', sa.Uuid(), nullable=False),
713
                    sa.Column('created_at', sa.DateTime(),
714
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
715
                              nullable=False),
716
                    sa.Column('updated_at', sa.DateTime(),
717
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
718
                              nullable=True),
719
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
720
                    sa.Column('product_id', sa.Uuid(), nullable=False),
721
                    sa.Column('location_type_id', sa.Uuid(), nullable=True),
722
                    sa.Column('location_id', sa.Uuid(), nullable=True),
723
                    sa.Column('store_id', sa.Uuid(), nullable=False),
724
                    sa.Column('location_class',
725
                              sa.Enum('PARTNER', 'PLACE', 'RESOURCE', 'PACKAGE', 'ZONE', 'LOST',
726
                                      'INVENTORY', 'SCRAP', 'SCRAPPED', 'BUFFER',
727
                                      name='locationclass'), nullable=False),
728
                    sa.Column('lot_id', sa.Uuid(), nullable=True),
729
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
730
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
731
                    sa.ForeignKeyConstraint(['location_id'], ['location.id'], ondelete='SET NULL'),
732
                    sa.ForeignKeyConstraint(['location_type_id'], ['location_type.id'],
733
                                            ondelete='SET NULL'),
734
                    sa.ForeignKeyConstraint(['lot_id'], ['lot.id'], ondelete='SET NULL'),
735
                    sa.PrimaryKeyConstraint('id'),
736
                    sa.UniqueConstraint('store_id', 'location_id', 'lot_id', 'expiration_datetime',
737
                                        name='_quant_st_loc_lot_ex_id_uc')
738
                    )
739
    op.create_index(op.f('ix_quant_company_id'), 'quant', ['company_id'], unique=False)
740
    op.create_index(op.f('ix_quant_id'), 'quant', ['id'], unique=False)
741
    op.create_index(op.f('ix_quant_location_class'), 'quant', ['location_class'], unique=False)
742
    op.create_index(op.f('ix_quant_location_id'), 'quant', ['location_id'], unique=False)
743
    op.create_index(op.f('ix_quant_location_type_id'), 'quant', ['location_type_id'], unique=False)
744
    op.create_index(op.f('ix_quant_lot_id'), 'quant', ['lot_id'], unique=False)
745
    op.create_index(op.f('ix_quant_lsn'), 'quant', ['lsn'], unique=False)
746
    op.create_index(op.f('ix_quant_move_ids'), 'quant', ['move_ids'], unique=False)
747
    op.create_index(op.f('ix_quant_partner_id'), 'quant', ['partner_id'], unique=False)
748
    op.create_index(op.f('ix_quant_product_id'), 'quant', ['product_id'], unique=False)
749
    op.create_index(op.f('ix_quant_store_id'), 'quant', ['store_id'], unique=False)
750
    op.create_index(op.f('ix_quant_uom_id'), 'quant', ['uom_id'], unique=False)
751
    op.create_table('move',
752
                    sa.Column('type', sa.Enum('PRODUCT', 'PACKAGE', name='movetype'),
753
                              nullable=False),
754
                    sa.Column('move_id', sa.Uuid(), nullable=True),
755
                    sa.Column('store_id', sa.Uuid(), nullable=False),
756
                    sa.Column('order_type_id', sa.Uuid(), nullable=True),
757
                    sa.Column('order_id', sa.Uuid(), nullable=True),
758
                    sa.Column('location_src_id', sa.Uuid(), nullable=True),
759
                    sa.Column('location_dest_id', sa.Uuid(), nullable=True),
760
                    sa.Column('lot_id', sa.Uuid(), nullable=True),
761
                    sa.Column('location_id', sa.Uuid(), nullable=True),
762
                    sa.Column('product_id', sa.Uuid(), nullable=True),
763
                    sa.Column('partner_id', sa.Uuid(), nullable=True),
764
                    sa.Column('quantity', sa.Float(), nullable=False),
765
                    sa.Column('uom_id', sa.Uuid(), nullable=False),
766
                    sa.Column('quant_src_id', sa.Uuid(), nullable=True),
767
                    sa.Column('quant_dest_id', sa.Uuid(), nullable=True),
768
                    sa.Column('status',
769
                              sa.Enum('CREATED', 'CONFIRMED', 'WAITING', 'ASSIGNED', 'PROCESSING',
770
                                      'DONE', 'CANCELED', name='movestatus'), nullable=False),
771
                    sa.Column('id', sa.Uuid(), nullable=False),
772
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
773
                    sa.Column('company_id', sa.Uuid(), nullable=False),
774
                    sa.Column('created_at', sa.DateTime(),
775
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
776
                              nullable=False),
777
                    sa.Column('updated_at', sa.DateTime(),
778
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
779
                              nullable=True),
780
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
781
                    sa.Column('created_by', sa.Uuid(), nullable=False),
782
                    sa.Column('edited_by', sa.Uuid(), nullable=False),
783
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
784
                    sa.ForeignKeyConstraint(['location_dest_id'], ['location.id'],
785
                                            ondelete='SET NULL'),
786
                    sa.ForeignKeyConstraint(['location_id'], ['location.id'], ondelete='SET NULL'),
787
                    sa.ForeignKeyConstraint(['location_src_id'], ['location.id'],
788
                                            ondelete='SET NULL'),
789
                    sa.ForeignKeyConstraint(['lot_id'], ['lot.id'], ondelete='SET NULL'),
790
                    sa.ForeignKeyConstraint(['move_id'], ['move.id'], ondelete='RESTRICT'),
791
                    sa.ForeignKeyConstraint(['order_id'], ['order.id'], ondelete='RESTRICT'),
792
                    sa.ForeignKeyConstraint(['order_type_id'], ['order_type.id'],
793
                                            ondelete='RESTRICT'),
794
                    sa.ForeignKeyConstraint(['quant_dest_id'], ['quant.id'], ondelete='SET NULL'),
795
                    sa.ForeignKeyConstraint(['quant_src_id'], ['quant.id'], ondelete='SET NULL'),
796
                    sa.PrimaryKeyConstraint('id')
797
                    )
798
    op.create_index(op.f('ix_move_company_id'), 'move', ['company_id'], unique=False)
799
    op.create_index(op.f('ix_move_created_by'), 'move', ['created_by'], unique=False)
800
    op.create_index(op.f('ix_move_edited_by'), 'move', ['edited_by'], unique=False)
801
    op.create_index(op.f('ix_move_id'), 'move', ['id'], unique=False)
802
    op.create_index(op.f('ix_move_lsn'), 'move', ['lsn'], unique=False)
803
    op.create_index(op.f('ix_move_partner_id'), 'move', ['partner_id'], unique=False)
804
    op.create_index(op.f('ix_move_product_id'), 'move', ['product_id'], unique=False)
805
    op.create_index(op.f('ix_move_quant_dest_id'), 'move', ['quant_dest_id'], unique=False)
806
    op.create_index(op.f('ix_move_quant_src_id'), 'move', ['quant_src_id'], unique=False)
807
    op.create_index(op.f('ix_move_store_id'), 'move', ['store_id'], unique=False)
808
    op.create_index(op.f('ix_move_uom_id'), 'move', ['uom_id'], unique=False)
809
    op.create_table('suggest',
810
                    sa.Column('move_id', sa.Uuid(), nullable=False),
811
                    sa.Column('priority', sa.Integer(), nullable=False),
812
                    sa.Column('type',
813
                              sa.Enum('IN_QUANTITY', 'IN_PRODUCT', 'IN_PACKAGE', 'IN_LOCATION',
814
                                      'IN_LOT', 'IN_RESOURCE', 'IN_VALID', 'NEW_PACKAGE', 'NEW_LOT',
815
                                      name='suggesttype'), nullable=False),
816
                    sa.Column('value', sa.String(), nullable=True),
817
                    sa.Column('result_value', sa.String(), nullable=True),
818
                    sa.Column('user_id', sa.Uuid(), nullable=True),
819
                    sa.Column('status', sa.Enum('WAITING', 'DONE', name='suggeststatus'),
820
                              nullable=False),
821
                    sa.Column('id', sa.Uuid(), nullable=False),
822
                    sa.Column('lsn', sa.BigInteger(), nullable=True),
823
                    sa.Column('company_id', sa.Uuid(), nullable=False),
824
                    sa.Column('created_at', sa.DateTime(),
825
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
826
                              nullable=False),
827
                    sa.Column('updated_at', sa.DateTime(),
828
                              server_default=sa.text("TIMEZONE('utc', CURRENT_TIMESTAMP)"),
829
                              nullable=True),
830
                    sa.Column('vars', sqlalchemy_utils.types.json.JSONType(), nullable=True),
831
                    sa.ForeignKeyConstraint(['company_id'], ['company.id'], ),
832
                    sa.ForeignKeyConstraint(['move_id'], ['move.id'], ondelete='CASCADE'),
833
                    sa.PrimaryKeyConstraint('id')
834
                    )
835
    op.create_index(op.f('ix_suggest_company_id'), 'suggest', ['company_id'], unique=False)
836
    op.create_index(op.f('ix_suggest_id'), 'suggest', ['id'], unique=False)
837
    op.create_index(op.f('ix_suggest_lsn'), 'suggest', ['lsn'], unique=False)
838
    op.create_index(op.f('ix_suggest_move_id'), 'suggest', ['move_id'], unique=False)
839
    op.create_index(op.f('ix_suggest_status'), 'suggest', ['status'], unique=False)
840
    op.create_index(op.f('ix_suggest_user_id'), 'suggest', ['user_id'], unique=False)
841
    # ### end Alembic commands ###
842
    op.execute("create sequence suggest_lsn_seq")
843
    op.execute("create sequence order_type_lsn_seq")
844
    op.execute("create sequence order_lsn_seq")
845
    op.execute("create sequence move_lsn_seq")
846
    op.execute("create sequence move_log_lsn_seq")
847
    op.execute("create sequence location_lsn_seq")
848
    op.execute("create sequence location_type_lsn_seq")
849
    op.execute("create sequence lot_lsn_seq")
850
    op.execute("create sequence product_storage_type_lsn_seq")
851
    op.execute("create sequence quant_lsn_seq")
852
    op.execute("create sequence channel_lsn_seq")
853
    op.execute("create sequence product_lsn_seq")
854
    op.execute("create sequence product_category_lsn_seq")
855
    op.execute("create sequence permission_lsn_seq")
856
    op.execute("create sequence role_lsn_seq")
857
    op.execute("create sequence partner_lsn_seq")
858
    op.execute("create sequence uom_lsn_seq")
859
    op.execute("create sequence uom_category_lsn_seq")
860
    op.execute("create sequence company_lsn_seq")
861
    op.execute("create sequence user_lsn_seq")
862
    op.execute("create sequence store_lsn_seq")
863
    op.execute("create sequence storage_type_lsn_seq")
864
    op.execute("create sequence bus_lsn_seq")
865

866

867
def downgrade():
868
    # ### commands auto generated by Alembic - please adjust! ###
869
    op.drop_index(op.f('ix_suggest_user_id'), table_name='suggest')
870
    op.drop_index(op.f('ix_suggest_status'), table_name='suggest')
871
    op.drop_index(op.f('ix_suggest_move_id'), table_name='suggest')
872
    op.drop_index(op.f('ix_suggest_lsn'), table_name='suggest')
873
    op.drop_index(op.f('ix_suggest_id'), table_name='suggest')
874
    op.drop_index(op.f('ix_suggest_company_id'), table_name='suggest')
875
    op.drop_table('suggest')
876
    op.drop_index(op.f('ix_move_uom_id'), table_name='move')
877
    op.drop_index(op.f('ix_move_store_id'), table_name='move')
878
    op.drop_index(op.f('ix_move_quant_src_id'), table_name='move')
879
    op.drop_index(op.f('ix_move_quant_dest_id'), table_name='move')
880
    op.drop_index(op.f('ix_move_product_id'), table_name='move')
881
    op.drop_index(op.f('ix_move_partner_id'), table_name='move')
882
    op.drop_index(op.f('ix_move_lsn'), table_name='move')
883
    op.drop_index(op.f('ix_move_id'), table_name='move')
884
    op.drop_index(op.f('ix_move_edited_by'), table_name='move')
885
    op.drop_index(op.f('ix_move_created_by'), table_name='move')
886
    op.drop_index(op.f('ix_move_company_id'), table_name='move')
887
    op.drop_table('move')
888
    op.drop_index(op.f('ix_quant_uom_id'), table_name='quant')
889
    op.drop_index(op.f('ix_quant_store_id'), table_name='quant')
890
    op.drop_index(op.f('ix_quant_product_id'), table_name='quant')
891
    op.drop_index(op.f('ix_quant_partner_id'), table_name='quant')
892
    op.drop_index(op.f('ix_quant_move_ids'), table_name='quant')
893
    op.drop_index(op.f('ix_quant_lsn'), table_name='quant')
894
    op.drop_index(op.f('ix_quant_lot_id'), table_name='quant')
895
    op.drop_index(op.f('ix_quant_location_type_id'), table_name='quant')
896
    op.drop_index(op.f('ix_quant_location_id'), table_name='quant')
897
    op.drop_index(op.f('ix_quant_location_class'), table_name='quant')
898
    op.drop_index(op.f('ix_quant_id'), table_name='quant')
899
    op.drop_index(op.f('ix_quant_company_id'), table_name='quant')
900
    op.drop_table('quant')
901
    op.drop_index(op.f('ix_move_log_store_id'), table_name='move_log')
902
    op.drop_index(op.f('ix_move_log_product_id'), table_name='move_log')
903
    op.drop_index(op.f('ix_move_log_partner_id'), table_name='move_log')
904
    op.drop_index(op.f('ix_move_log_lsn'), table_name='move_log')
905
    op.drop_index(op.f('ix_move_log_lot_id'), table_name='move_log')
906
    op.drop_index(op.f('ix_move_log_location_type_id'), table_name='move_log')
907
    op.drop_index(op.f('ix_move_log_location_id'), table_name='move_log')
908
    op.drop_index(op.f('ix_move_log_location_class'), table_name='move_log')
909
    op.drop_index(op.f('ix_move_log_id'), table_name='move_log')
910
    op.drop_index(op.f('ix_move_log_company_id'), table_name='move_log')
911
    op.drop_table('move_log')
912
    op.drop_index(op.f('ix_product_uom_id'), table_name='product')
913
    op.drop_index(op.f('ix_product_title'), table_name='product')
914
    op.drop_index(op.f('ix_product_product_category_id'), table_name='product')
915
    op.drop_index(op.f('ix_product_lsn'), table_name='product')
916
    op.drop_index(op.f('ix_product_id'), table_name='product')
917
    op.drop_index(op.f('ix_product_company_id'), table_name='product')
918
    op.drop_index(op.f('ix_product_barcode_list'), table_name='product')
919
    op.drop_table('product')
920
    op.drop_index(op.f('ix_partner_title'), table_name='partner')
921
    op.drop_index(op.f('ix_partner_partner_id'), table_name='partner')
922
    op.drop_index(op.f('ix_partner_lsn'), table_name='partner')
923
    op.drop_index(op.f('ix_partner_id'), table_name='partner')
924
    op.drop_index(op.f('ix_partner_created_by'), table_name='partner')
925
    op.drop_index(op.f('ix_partner_company_id'), table_name='partner')
926
    op.drop_table('partner')
927
    op.drop_index(op.f('ix_location_title'), table_name='location')
928
    op.drop_index(op.f('ix_location_store_id'), table_name='location')
929
    op.drop_index(op.f('ix_location_partner_id'), table_name='location')
930
    op.drop_index(op.f('ix_location_lsn'), table_name='location')
931
    op.drop_index(op.f('ix_location_lot_id'), table_name='location')
932
    op.drop_index(op.f('ix_location_location_type_id'), table_name='location')
933
    op.drop_index(op.f('ix_location_location_id'), table_name='location')
934
    op.drop_index(op.f('ix_location_location_class'), table_name='location')
935
    op.drop_index(op.f('ix_location_is_can_negative'), table_name='location')
936
    op.drop_index(op.f('ix_location_id'), table_name='location')
937
    op.drop_index(op.f('ix_location_exclude_package_ids'), table_name='location')
938
    op.drop_index(op.f('ix_location_company_id'), table_name='location')
939
    op.drop_index(op.f('ix_location_allowed_package_ids'), table_name='location')
940
    op.drop_table('location')
941
    op.drop_index(op.f('ix_user_store_id'), table_name='user')
942
    op.drop_index(op.f('ix_user_role_ids'), table_name='user')
943
    op.drop_index(op.f('ix_user_lsn'), table_name='user')
944
    op.drop_index(op.f('ix_user_id'), table_name='user')
945
    op.drop_index(op.f('ix_user_company_ids'), table_name='user')
946
    op.drop_index(op.f('ix_user_company_id'), table_name='user')
947
    op.drop_table('user')
948
    op.drop_index(op.f('ix_uom_type'), table_name='uom')
949
    op.drop_index(op.f('ix_uom_title'), table_name='uom')
950
    op.drop_index(op.f('ix_uom_lsn'), table_name='uom')
951
    op.drop_index(op.f('ix_uom_id'), table_name='uom')
952
    op.drop_index(op.f('ix_uom_company_id'), table_name='uom')
953
    op.drop_table('uom')
954
    op.drop_index(op.f('ix_order_user_ids'), table_name='order')
955
    op.drop_index(op.f('ix_order_store_id'), table_name='order')
956
    op.drop_index(op.f('ix_order_partner_id'), table_name='order')
957
    op.drop_index(op.f('ix_order_origin_type'), table_name='order')
958
    op.drop_index(op.f('ix_order_origin_number'), table_name='order')
959
    op.drop_index(op.f('ix_order_number'), table_name='order')
960
    op.drop_index(op.f('ix_order_lsn'), table_name='order')
961
    op.drop_index(op.f('ix_order_id'), table_name='order')
962
    op.drop_index(op.f('ix_order_edited_by'), table_name='order')
963
    op.drop_index(op.f('ix_order_created_by'), table_name='order')
964
    op.drop_index(op.f('ix_order_company_id'), table_name='order')
965
    op.drop_table('order')
966
    op.drop_index(op.f('ix_location_type_title'), table_name='location_type')
967
    op.drop_index(op.f('ix_location_type_store_id'), table_name='location_type')
968
    op.drop_index(op.f('ix_location_type_partner_id'), table_name='location_type')
969
    op.drop_index(op.f('ix_location_type_lsn'), table_name='location_type')
970
    op.drop_index(op.f('ix_location_type_lot_id'), table_name='location_type')
971
    op.drop_index(op.f('ix_location_type_location_class'), table_name='location_type')
972
    op.drop_index(op.f('ix_location_type_is_homogeneity'), table_name='location_type')
973
    op.drop_index(op.f('ix_location_type_is_can_negative'), table_name='location_type')
974
    op.drop_index(op.f('ix_location_type_id'), table_name='location_type')
975
    op.drop_index(op.f('ix_location_type_exclude_package_ids'), table_name='location_type')
976
    op.drop_index(op.f('ix_location_type_company_id'), table_name='location_type')
977
    op.drop_index(op.f('ix_location_type_allowed_package_ids'), table_name='location_type')
978
    op.drop_table('location_type')
979
    op.drop_index(op.f('ix_uom_category_title'), table_name='uom_category')
980
    op.drop_index(op.f('ix_uom_category_lsn'), table_name='uom_category')
981
    op.drop_index(op.f('ix_uom_category_id'), table_name='uom_category')
982
    op.drop_index(op.f('ix_uom_category_company_id'), table_name='uom_category')
983
    op.drop_table('uom_category')
984
    op.drop_index(op.f('ix_store_title'), table_name='store')
985
    op.drop_index(op.f('ix_store_lsn'), table_name='store')
986
    op.drop_index(op.f('ix_store_id'), table_name='store')
987
    op.drop_index(op.f('ix_store_company_id'), table_name='store')
988
    op.drop_table('store')
989
    op.drop_index(op.f('ix_storage_type_lsn'), table_name='storage_type')
990
    op.drop_index(op.f('ix_storage_type_id'), table_name='storage_type')
991
    op.drop_index(op.f('ix_storage_type_company_id'), table_name='storage_type')
992
    op.drop_table('storage_type')
993
    op.drop_index(op.f('ix_role_title'), table_name='role')
994
    op.drop_index(op.f('ix_role_role_ids'), table_name='role')
995
    op.drop_index(op.f('ix_role_permission_allow_list'), table_name='role')
996
    op.drop_index(op.f('ix_role_lsn'), table_name='role')
997
    op.drop_index(op.f('ix_role_id'), table_name='role')
998
    op.drop_index(op.f('ix_role_company_id'), table_name='role')
999
    op.drop_table('role')
1000
    op.drop_index(op.f('ix_product_storage_type_product_id'), table_name='product_storage_type')
1001
    op.drop_index(op.f('ix_product_storage_type_lsn'), table_name='product_storage_type')
1002
    op.drop_index(op.f('ix_product_storage_type_id'), table_name='product_storage_type')
1003
    op.drop_index(op.f('ix_product_storage_type_exclude_package_ids'),
1004
                  table_name='product_storage_type')
1005
    op.drop_index(op.f('ix_product_storage_type_company_id'), table_name='product_storage_type')
1006
    op.drop_index(op.f('ix_product_storage_type_allowed_package_ids'),
1007
                  table_name='product_storage_type')
1008
    op.drop_table('product_storage_type')
1009
    op.drop_index(op.f('ix_product_category_title'), table_name='product_category')
1010
    op.drop_index(op.f('ix_product_category_product_category_ids'), table_name='product_category')
1011
    op.drop_index(op.f('ix_product_category_lsn'), table_name='product_category')
1012
    op.drop_index(op.f('ix_product_category_id'), table_name='product_category')
1013
    op.drop_index(op.f('ix_product_category_company_id'), table_name='product_category')
1014
    op.drop_table('product_category')
1015
    op.drop_index(op.f('ix_order_type_title'), table_name='order_type')
1016
    op.drop_index(op.f('ix_order_type_store_id'), table_name='order_type')
1017
    op.drop_index(op.f('ix_order_type_prefix'), table_name='order_type')
1018
    op.drop_index(op.f('ix_order_type_partner_id'), table_name='order_type')
1019
    op.drop_index(op.f('ix_order_type_lsn'), table_name='order_type')
1020
    op.drop_index(op.f('ix_order_type_id'), table_name='order_type')
1021
    op.drop_index(op.f('ix_order_type_exclude_package_ids'), table_name='order_type')
1022
    op.drop_index(op.f('ix_order_type_exclude_location_type_src_ids'), table_name='order_type')
1023
    op.drop_index(op.f('ix_order_type_exclude_location_type_dest_ids'), table_name='order_type')
1024
    op.drop_index(op.f('ix_order_type_exclude_location_src_ids'), table_name='order_type')
1025
    op.drop_index(op.f('ix_order_type_exclude_location_dest_ids'), table_name='order_type')
1026
    op.drop_index(op.f('ix_order_type_exclude_location_class_src_ids'), table_name='order_type')
1027
    op.drop_index(op.f('ix_order_type_exclude_location_class_dest_ids'), table_name='order_type')
1028
    op.drop_index(op.f('ix_order_type_edited_by'), table_name='order_type')
1029
    op.drop_index(op.f('ix_order_type_created_by'), table_name='order_type')
1030
    op.drop_index(op.f('ix_order_type_company_id'), table_name='order_type')
1031
    op.drop_index(op.f('ix_order_type_allowed_package_ids'), table_name='order_type')
1032
    op.drop_index(op.f('ix_order_type_allowed_location_type_src_ids'), table_name='order_type')
1033
    op.drop_index(op.f('ix_order_type_allowed_location_type_dest_ids'), table_name='order_type')
1034
    op.drop_index(op.f('ix_order_type_allowed_location_src_ids'), table_name='order_type')
1035
    op.drop_index(op.f('ix_order_type_allowed_location_dest_ids'), table_name='order_type')
1036
    op.drop_index(op.f('ix_order_type_allowed_location_class_src_ids'), table_name='order_type')
1037
    op.drop_index(op.f('ix_order_type_allowed_location_class_dest_ids'), table_name='order_type')
1038
    op.drop_table('order_type')
1039
    op.drop_index(op.f('ix_lot_product_id'), table_name='lot')
1040
    op.drop_index(op.f('ix_lot_partner_id'), table_name='lot')
1041
    op.drop_index(op.f('ix_lot_lsn'), table_name='lot')
1042
    op.drop_index(op.f('ix_lot_id'), table_name='lot')
1043
    op.drop_index(op.f('ix_lot_company_id'), table_name='lot')
1044
    op.drop_table('lot')
1045
    op.drop_index(op.f('ix_bus_status'), table_name='bus')
1046
    op.drop_index(op.f('ix_bus_lsn'), table_name='bus')
1047
    op.drop_index(op.f('ix_bus_id'), table_name='bus')
1048
    op.drop_index(op.f('ix_bus_company_id'), table_name='bus')
1049
    op.drop_index(op.f('ix_bus_cache_tag'), table_name='bus')
1050
    op.drop_table('bus')
1051
    op.drop_index(op.f('ix_company_title'), table_name='company')
1052
    op.drop_index(op.f('ix_company_lsn'), table_name='company')
1053
    op.drop_index(op.f('ix_company_id'), table_name='company')
1054
    op.drop_table('company')
1055
    # ### end Alembic commands ###
1056
    op.execute("drop sequence suggest_lsn_seq")
1057
    op.execute("drop sequence order_type_lsn_seq")
1058
    op.execute("drop sequence order_lsn_seq")
1059
    op.execute("drop sequence move_lsn_seq")
1060
    op.execute("drop sequence move_log_lsn_seq")
1061
    op.execute("drop sequence location_lsn_seq")
1062
    op.execute("drop sequence location_type_lsn_seq")
1063
    op.execute("drop sequence lot_lsn_seq")
1064
    op.execute("drop sequence product_storage_type_lsn_seq")
1065
    op.execute("drop sequence quant_lsn_seq")
1066
    op.execute("drop sequence channel_lsn_seq")
1067
    op.execute("drop sequence product_lsn_seq")
1068
    op.execute("drop sequence product_category_lsn_seq")
1069
    op.execute("drop sequence permission_lsn_seq")
1070
    op.execute("drop sequence role_lsn_seq")
1071
    op.execute("drop sequence partner_lsn_seq")
1072
    op.execute("drop sequence uom_lsn_seq")
1073
    op.execute("drop sequence uom_category_lsn_seq")
1074
    op.execute("drop sequence company_lsn_seq")
1075
    op.execute("drop sequence user_lsn_seq")
1076
    op.execute("drop sequence contractor_lsn_seq")
1077
    op.execute("drop sequence store_lsn_seq")
1078
    op.execute("drop sequence storage_type_lsn_seq")
1079
    op.execute("drop sequence bus_lsn_seq")
1080

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.