Subversion Repositories SmartDukaan

Rev

Rev 14826 | Rev 14918 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14826 Rev 14859
Line 1... Line 1...
1
from elixir import metadata, setup_all
1
from elixir import metadata, setup_all
2
from elixir.entity import Entity
2
from elixir.entity import Entity
3
from elixir.fields import Field
3
from elixir.fields import Field
4
from elixir.options import using_options, using_table_options
4
from elixir.options import using_options, using_table_options
5
from sqlalchemy import create_engine
5
from sqlalchemy import create_engine
6
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum
6
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, Text
7
 
7
 
8
 
8
 
9
class Users(Entity):
9
class Users(Entity):
10
    id = Field(Integer(unsigned=True), primary_key=True)
10
    id = Field(Integer(unsigned=True), primary_key=True)
11
    username = Field(String(128))
11
    username = Field(String(128))
Line 60... Line 60...
60
    id = Field(Integer(unsigned=True), primary_key=True)
60
    id = Field(Integer(unsigned=True), primary_key=True)
61
    name = Field(String(128))
61
    name = Field(String(128))
62
    category_id = Field(Integer)
62
    category_id = Field(Integer)
63
    using_options(shortnames=True)
63
    using_options(shortnames=True)
64
    using_table_options(mysql_engine="InnoDB")
64
    using_table_options(mysql_engine="InnoDB")
65
 
65
    
-
 
66
class Feedbacks(Entity):
-
 
67
    id = Field(Integer(unsigned=True), primary_key=True)
-
 
68
    user_id = Field(Integer(unsigned=True))
-
 
69
    email = Field(String(128))
-
 
70
    subject = Field(String(256))
-
 
71
    message = Field(Text)
-
 
72
    created = Field(DateTime)
-
 
73
    isTicketCreated = Field(Boolean, default=False, server_default='0')
66
 
74
 
67
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
75
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
68
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
76
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
69
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
77
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
70
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
78
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)