Poprawki do poprawek w sponsors :-)
[wolnelektury.git] / apps / south / db / sql_server / pyodbc.py
1 from django.db import connection
2 from django.db.models.fields import *
3 from south.db import generic
4
5 class DatabaseOperations(generic.DatabaseOperations):
6     """
7     django-pyodbc (sql_server.pyodbc) implementation of database operations.
8     """
9     
10     add_column_string = 'ALTER TABLE %s ADD %s;'
11     alter_string_set_type = 'ALTER COLUMN %(column)s %(type)s'
12     allows_combined_alters = False
13     delete_column_string = 'ALTER TABLE %s DROP COLUMN %s;'
14
15     def create_table(self, table_name, fields):
16         # Tweak stuff as needed
17         for name,f in fields:
18             if isinstance(f, BooleanField):
19                 if f.default == True:
20                     f.default = 1
21                 if f.default == False:
22                     f.default = 0
23
24         # Run
25         generic.DatabaseOperations.create_table(self, table_name, fields)