Add Customer.number field to schema

for those who want a proper integer key on the customer table
This commit is contained in:
Lance Edgar 2017-05-11 13:51:57 -05:00
parent e1112f071e
commit f27cc37c4e
2 changed files with 44 additions and 1 deletions

View file

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
"""add customer number
Revision ID: 195ceb6abeb3
Revises: 6a1ec8b93637
Create Date: 2017-05-11 11:29:13.525277
"""
from __future__ import unicode_literals
# revision identifiers, used by Alembic.
revision = '195ceb6abeb3'
down_revision = u'6a1ec8b93637'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
import rattail.db.types
from sqlalchemy.dialects import postgresql
def upgrade():
# customer
op.add_column('customer', sa.Column('number', sa.Integer(), nullable=True))
def downgrade():
# customer
op.drop_column('customer', 'number')

View file

@ -47,7 +47,17 @@ class Customer(Base):
__versioned__ = {} __versioned__ = {}
uuid = uuid_column() uuid = uuid_column()
id = sa.Column(sa.String(length=20))
id = sa.Column(sa.String(length=20), nullable=True, doc="""
String ID for the customer, if known/relevant. This may or may not
correspond to the :attr:`number`, depending on your system.
""")
number = sa.Column(sa.Integer(), nullable=True, doc="""
Customer number, if known/relevant. This may or may not correspond to the
:attr:`id`, depending on your system.
""")
name = sa.Column(sa.String(length=255)) name = sa.Column(sa.String(length=255))
email_preference = sa.Column(sa.Integer()) email_preference = sa.Column(sa.Integer())