From f5292a63a71f365e5863e3ed977b955736daabea Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 19 Jun 2011 13:38:43 +0000 Subject: With the exception of CSV tables, make the initial ID column the primary key as well as auto increment. Implementes issue #297. --- Source/SPTablesList.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/SPTablesList.m') diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index fe43c845..be9e54d7 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -2196,7 +2196,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; engineStatement = [NSString stringWithFormat:@"%@ = %@", [[tableDocumentInstance serverSupport] engineTypeQueryName], [tableType backtickQuotedString]]; } - NSString *createStatement = [NSString stringWithFormat:@"CREATE TABLE %@ (%@) %@ %@", [tableName backtickQuotedString], ([tableType isEqualToString:@"CSV"]) ? @"id INT NOT NULL" : @"id INT", charSetStatement, engineStatement]; + NSString *createStatement = [NSString stringWithFormat:@"CREATE TABLE %@ (id INT(11) UNSIGNED NOT NULL%@) %@ %@", [tableName backtickQuotedString], [tableType isEqualToString:@"CSV"] ? @"" : @" PRIMARY KEY AUTO_INCREMENT", charSetStatement, engineStatement]; // Create the table [mySQLConnection queryString:createStatement]; -- cgit v1.2.3