Make card_number more central for CORE API -> Rattail importers
				
					
				
			let's track that as (effectively) `Customer.corepos_card_number` and use that when possible for importer key
This commit is contained in:
		
							parent
							
								
									c1276c998a
								
							
						
					
					
						commit
						bfc52a6fb3
					
				
					 6 changed files with 179 additions and 65 deletions
				
			
		|  | @ -0,0 +1,39 @@ | |||
| # -*- coding: utf-8; -*- | ||||
| """add customer.card_number | ||||
| 
 | ||||
| Revision ID: ae74c537ea51 | ||||
| Revises: d6a0f21a6a94 | ||||
| Create Date: 2023-06-05 19:04:25.574077 | ||||
| 
 | ||||
| """ | ||||
| 
 | ||||
| # revision identifiers, used by Alembic. | ||||
| revision = 'ae74c537ea51' | ||||
| down_revision = 'd6a0f21a6a94' | ||||
| branch_labels = None | ||||
| depends_on = None | ||||
| 
 | ||||
| from alembic import op | ||||
| import sqlalchemy as sa | ||||
| import rattail.db.types | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| def upgrade(): | ||||
| 
 | ||||
|     # corepos_customer | ||||
|     op.alter_column('corepos_customer', 'corepos_account_id', | ||||
|                existing_type=sa.INTEGER(), | ||||
|                nullable=True) | ||||
|     op.add_column('corepos_customer', sa.Column('corepos_card_number', sa.Integer(), nullable=True)) | ||||
|     op.add_column('corepos_customer_version', sa.Column('corepos_card_number', sa.Integer(), autoincrement=False, nullable=True)) | ||||
| 
 | ||||
| 
 | ||||
| def downgrade(): | ||||
| 
 | ||||
|     # corepos_customer | ||||
|     op.drop_column('corepos_customer_version', 'corepos_card_number') | ||||
|     op.drop_column('corepos_customer', 'corepos_card_number') | ||||
|     op.alter_column('corepos_customer', 'corepos_account_id', | ||||
|                existing_type=sa.INTEGER(), | ||||
|                nullable=False) | ||||
|  | @ -2,7 +2,7 @@ | |||
| ################################################################################ | ||||
| # | ||||
| #  Rattail -- Retail Software Framework | ||||
| #  Copyright © 2010-2020 Lance Edgar | ||||
| #  Copyright © 2010-2023 Lance Edgar | ||||
| # | ||||
| #  This file is part of Rattail. | ||||
| # | ||||
|  | @ -90,14 +90,19 @@ class CoreCustomer(model.Base): | |||
|             Reference to the CORE-POS extension record for this customer. | ||||
|             """)) | ||||
| 
 | ||||
|     corepos_account_id = sa.Column(sa.Integer(), nullable=False, doc=""" | ||||
|     corepos_account_id = sa.Column(sa.Integer(), nullable=True, doc=""" | ||||
|     ``Customers.customerAccountID`` value for this customer, within CORE-POS. | ||||
|     """) | ||||
| 
 | ||||
|     corepos_card_number = sa.Column(sa.Integer(), nullable=True, doc=""" | ||||
|     ``custdata.CardNo`` value for this customer, within CORE-POS. | ||||
|     """) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return str(self.customer) | ||||
| 
 | ||||
| CoreCustomer.make_proxy(model.Customer, '_corepos', 'corepos_account_id') | ||||
| CoreCustomer.make_proxy(model.Customer, '_corepos', 'corepos_card_number') | ||||
| 
 | ||||
| 
 | ||||
| class CoreMember(model.Base): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar