In short with that framework you can create several migrations that each look as follows:
@interface CreateStudents : FmdbMigration
{
}
@end
@implementation CreateStudents
- (void)up {
[self createTable:@"students" withColumns:[NSArray arrayWithObjects:
[FmdbMigrationColumn columnWithColumnName:@"first_name" columnType:@"string"],
[FmdbMigrationColumn columnWithColumnName:@"age" columnType:@"integer" defaultValue:21],
nil];
}
- (void)down {
[self dropTable:@"students"];
}
@end
That way the next time the application is updated the migration required to bring your application uptodate will be run. Cool. Note only can you add and remove columns but you can also run Objective-C code that will adapt the existing data to the required format for the new version.
Now I've gotta play with that framework.
Thanks guys for sharing this!
0 comments :: Rails influences iPhone Development - FMDB Migration Manager
Post a Comment