def enlarge_username(): username_type = get_column_type('auth_user', 'username') if username_type != 'varchar(100)': print 'SCHEMA UPDATE: Enlarging auth_user.username column length to varchar(100)' from django.db import connection, transaction cursor = connection.cursor() sql = 'ALTER TABLE `auth_user` MODIFY COLUMN `username` varchar(100) NOT NULL' cursor.execute(sql) transaction.commit_unless_managed()
def enlarge_ccdigits(): username_type = get_column_type('storefront_accountpayinginformation', 'credit_card_last_digits') if username_type != 'varchar(4)': print 'SCHEMA UPDATE: Enlarging auth_user.username column length to varchar(100)' from django.db import connection, transaction cursor = connection.cursor() sql = 'ALTER TABLE `storefront_accountpayinginformation` MODIFY COLUMN `credit_card_last_digits` varchar(4)' cursor.execute(sql) transaction.commit_unless_managed()
def enlarge_function_storage(): func_def_type = get_column_type('storefront_scorefunction', 'definition') if func_def_type != 'varchar(4096)': print 'SCHEMA UPDATE: Enlarging storefront_scorefunction.definition column length to varchar(4096)' from django.db import connection, transaction cursor = connection.cursor() sql = 'ALTER TABLE `storefront_scorefunction` MODIFY COLUMN `definition` varchar(4096) DEFAULT NULL;' cursor.execute(sql) transaction.commit_unless_managed()