Add model for datasync changes queue table
just in case it's there, for use w/ datasync watcher
This commit is contained in:
		
							parent
							
								
									2d61903cf7
								
							
						
					
					
						commit
						a0efa1a967
					
				
					 1 changed files with 18 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -21,12 +21,9 @@
 | 
			
		|||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE POS Data Model
 | 
			
		||||
Data model for CORE POS "office_op" DB
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from __future__ import unicode_literals, absolute_import
 | 
			
		||||
 | 
			
		||||
import six
 | 
			
		||||
import sqlalchemy as sa
 | 
			
		||||
from sqlalchemy import orm
 | 
			
		||||
from sqlalchemy.ext.declarative import declarative_base
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +33,23 @@ from sqlalchemy.ext.associationproxy import association_proxy
 | 
			
		|||
Base = declarative_base()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Change(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a changed (or deleted) record, which is pending synchronization
 | 
			
		||||
    to another system(s).
 | 
			
		||||
 | 
			
		||||
    .. note::
 | 
			
		||||
       This table may or may not be installed to a given CORE Office Op DB.  Its
 | 
			
		||||
       presence is required if Rattail datasync needs to "watch" the DB.
 | 
			
		||||
    """
 | 
			
		||||
    __tablename__ = 'datasync_changes'
 | 
			
		||||
 | 
			
		||||
    id = sa.Column(sa.Integer(), nullable=False, primary_key=True)
 | 
			
		||||
    object_type = sa.Column(sa.String(length=255), nullable=False)
 | 
			
		||||
    object_key = sa.Column(sa.String(length=255), nullable=False)
 | 
			
		||||
    deleted = sa.Column(sa.Boolean(), nullable=False, default=False)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Parameter(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a "parameter" value.
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +70,6 @@ class Parameter(Base):
 | 
			
		|||
        return "{}-{} {}".format(self.store_id, self.lane_id, self.param_key)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Department(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a department within the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +107,6 @@ class Department(Base):
 | 
			
		|||
        return self.name or ''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Subdepartment(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a subdepartment within the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +131,6 @@ class Subdepartment(Base):
 | 
			
		|||
        return self.name or ''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Vendor(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a vendor from which product may be purchased.
 | 
			
		||||
| 
						 | 
				
			
			@ -184,7 +194,6 @@ class VendorContact(Base):
 | 
			
		|||
    notes = sa.Column(sa.Text(), nullable=True)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Product(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a product, purchased and/or sold by the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -303,7 +312,6 @@ class Product(Base):
 | 
			
		|||
        return self.description or ''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class ProductFlag(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a product flag attribute.
 | 
			
		||||
| 
						 | 
				
			
			@ -320,7 +328,6 @@ class ProductFlag(Base):
 | 
			
		|||
        return self.description or ''
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Employee(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents an employee within the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -351,7 +358,6 @@ class Employee(Base):
 | 
			
		|||
        return ' '.join([self.first_name or '', self.last_name or '']).strip()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class MemberType(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a type of membership within the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -378,7 +384,6 @@ class MemberType(Base):
 | 
			
		|||
        return self.description or ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class Customer(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a customer of the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -452,7 +457,6 @@ class Customer(Base):
 | 
			
		|||
        return "{} {}".format(self.first_name or '', self.last_name or '').strip()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class MemberInfo(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Contact info regarding a member of the organization.
 | 
			
		||||
| 
						 | 
				
			
			@ -517,7 +521,6 @@ class MemberInfo(Base):
 | 
			
		|||
        return self.full_name
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class MemberDate(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Join/exit dates for members
 | 
			
		||||
| 
						 | 
				
			
			@ -536,7 +539,6 @@ class MemberDate(Base):
 | 
			
		|||
            self.end_date.date() if self.end_date else "??")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class MemberContact(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Contact preferences for members
 | 
			
		||||
| 
						 | 
				
			
			@ -566,7 +568,6 @@ class MemberContact(Base):
 | 
			
		|||
        return str(self.preference)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@six.python_2_unicode_compatible
 | 
			
		||||
class HouseCoupon(Base):
 | 
			
		||||
    """
 | 
			
		||||
    Represents a "house" (store) coupon.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue