예제 #1
0
def add_effective_bdb():
    if not column_exists('storefront_deploy', 'effective_bdb'):
        print 'SCHEMA UPDATE: Adding missing column: storefront_deploy.effective_bdb'

        from django.db import connection, transaction
        cursor = connection.cursor()
        sql = 'ALTER TABLE `storefront_deploy` ADD COLUMN `effective_bdb` integer NOT NULL DEFAULT 0'
        cursor.execute(sql)

        transaction.commit_unless_managed()
예제 #2
0
def add_account_default_analyzer():
    if not column_exists('storefront_account', 'default_analyzer_id'):
        print 'SCHEMA UPDATE: Adding missing column: storefront_account.default_analyzer'
        
        from django.db import connection, transaction
        cursor = connection.cursor()
        sql = 'ALTER TABLE `storefront_account` ADD COLUMN `default_analyzer_id` integer NULL'
        cursor.execute(sql)

        sql = 'ALTER TABLE `storefront_account` ADD CONSTRAINT `default_analyzer_id_refs_id_44eb0c5b` FOREIGN KEY (`default_analyzer_id`) REFERENCES `storefront_analyzer` (`id`)'
        cursor.execute(sql)
        transaction.commit_unless_managed()
예제 #3
0
def add_change_password():
    if not column_exists('storefront_pfuser', 'change_password'):
        print 'SCHEMA UPDATE: Adding missing column: storefront_pfuser.change_password'
        
        from django.db import connection, transaction
        cursor = connection.cursor()
        sql = 'ALTER TABLE `storefront_pfuser` ADD COLUMN `change_password` tinyint NULL'
        cursor.execute(sql)

        print 'DATA UPDATE'
        sql = 'UPDATE storefront_pfuser set change_password=0'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_pfuser` MODIFY COLUMN `change_password` tinyint NOT NULL'
        cursor.execute(sql)
        transaction.commit_unless_managed()
예제 #4
0
def update_custom_subscription():
    if not column_exists('storefront_accountpayinginformation', 'monthly_amount'):
        print 'SCHEMA UPDATE: Upgrading table: storefront_accountpayinginformation'

        from django.db import connection, transaction
        cursor = connection.cursor()
        sql = 'ALTER TABLE `storefront_accountpayinginformation` MODIFY `first_name` varchar(50) NULL'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_accountpayinginformation` MODIFY `last_name` varchar(50) NULL'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_accountpayinginformation` MODIFY `contact_email` varchar(255) NULL'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_accountpayinginformation` MODIFY `credit_card_last_digits` varchar(3) NULL'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_accountpayinginformation` ADD COLUMN `subscription_status` varchar(30) NULL'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_accountpayinginformation` ADD COLUMN `subscription_type` varchar(30) NULL'
        cursor.execute(sql)
        sql = 'ALTER TABLE `storefront_accountpayinginformation` ADD COLUMN `monthly_amount` integer NULL'
        cursor.execute(sql)
 
        transaction.commit_unless_managed()