-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdesign.py
77 lines (58 loc) · 3.71 KB
/
design.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# coding: utf-8
from sqlalchemy import Column, Date, ForeignKey, Index, String, text
from sqlalchemy.dialects.mysql import INTEGER, SMALLINT
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
class DesignConfigGridFlat(Base):
__tablename__ = 'design_config_grid_flat'
__table_args__ = {'comment': 'design_config_grid_flat'}
entity_id = Column(INTEGER(10), primary_key=True, comment='Entity ID')
store_website_id = Column(INTEGER(11), index=True, comment='Store_website_id')
store_group_id = Column(INTEGER(11), index=True, comment='Store_group_id')
store_id = Column(INTEGER(11), index=True, comment='Store_id')
theme_theme_id = Column(String(255), index=True, comment='Theme_theme_id')
class StoreWebsite(Base):
__tablename__ = 'store_website'
__table_args__ = {'comment': 'Websites'}
website_id = Column(SMALLINT(5), primary_key=True, comment='Website ID')
code = Column(String(32), unique=True, comment='Code')
name = Column(String(64), comment='Website Name')
sort_order = Column(SMALLINT(5), nullable=False, index=True, server_default=text("0"), comment='Sort Order')
default_group_id = Column(SMALLINT(5), nullable=False, index=True, server_default=text("0"), comment='Default Group ID')
is_default = Column(SMALLINT(5), server_default=text("0"), comment='Defines Is Website Default')
class StoreGroup(Base):
__tablename__ = 'store_group'
__table_args__ = {'comment': 'Store Groups'}
group_id = Column(SMALLINT(5), primary_key=True, comment='Group ID')
website_id = Column(ForeignKey('store_website.website_id', ondelete='CASCADE'), nullable=False, index=True, server_default=text("0"), comment='Website ID')
name = Column(String(255), nullable=False, comment='Store Group Name')
root_category_id = Column(INTEGER(10), nullable=False, server_default=text("0"), comment='Root Category ID')
default_store_id = Column(SMALLINT(5), nullable=False, index=True, server_default=text("0"), comment='Default Store ID')
code = Column(String(32), unique=True, comment='Store group unique code')
website = relationship('StoreWebsite')
class Store(Base):
__tablename__ = 'store'
__table_args__ = (
Index('STORE_IS_ACTIVE_SORT_ORDER', 'is_active', 'sort_order'),
{'comment': 'Stores'}
)
store_id = Column(SMALLINT(5), primary_key=True, comment='Store ID')
code = Column(String(32), unique=True, comment='Code')
website_id = Column(ForeignKey('store_website.website_id', ondelete='CASCADE'), nullable=False, index=True, server_default=text("0"), comment='Website ID')
group_id = Column(ForeignKey('store_group.group_id', ondelete='CASCADE'), nullable=False, index=True, server_default=text("0"), comment='Group ID')
name = Column(String(255), nullable=False, comment='Store Name')
sort_order = Column(SMALLINT(5), nullable=False, server_default=text("0"), comment='Store Sort Order')
is_active = Column(SMALLINT(5), nullable=False, server_default=text("0"), comment='Store Activity')
group = relationship('StoreGroup')
website = relationship('StoreWebsite')
class DesignChange(Base):
__tablename__ = 'design_change'
__table_args__ = {'comment': 'Design Changes'}
design_change_id = Column(INTEGER(11), primary_key=True, comment='Design Change ID')
store_id = Column(ForeignKey('store.store_id', ondelete='CASCADE'), nullable=False, index=True, server_default=text("0"), comment='Store ID')
design = Column(String(255), comment='Design')
date_from = Column(Date, comment='First Date of Design Activity')
date_to = Column(Date, comment='Last Date of Design Activity')
store = relationship('Store')