/** Test to see if particular column exists for particular table in database
@param columnName The name of the column.
@param tableName The name of the table.
@return `YES` if column exists in table in question; `NO` otherwise.
*/
- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName;
// 在 testTable 中,添加 name 字段
[_dbQueue inDatabase:^(FMDatabase *db) {
NSString *createTable = [NSString stringWithFormat:@"create table if not exists testTable (sessionId text primary key not null, wds text);"];
BOOL rezult = [db executeUpdate:createTable];
if (![db columnExists:@"name" inTableWithName:@"testTable"]){
NSString * Show_Notice = [NSString stringWithFormat:@"ALTER TABLE testTable ADD COLUMN name text;"];
[db executeUpdate:Show_Notice];
}
}];