I'm having an issue with one of my table mappings. FCModel expandQuery is exploding on line 956 query = [query stringByReplacingOccurrencesOfString:@"$PK" withString:g_primaryKeyFieldName[self]];
I can see that the primaryKeyFieldName dictionary is failing because it doesn't contain the PK for the table, but comparing a working file + creation script to the non-working one isn't helping.
Creation for the failing one is this:
"CREATE TABLE IF NOT EXISTS WordSprint (\n",
"wordSprintId INTEGER PRIMARY KEY NOT NULL,\n",
"projectId INTEGER NOT NULL DEFAULT 0,\n",
"sprintDate REAL NOT NULL,\n",
"durationInMinutes INTEGER NOT NULL DEFAULT 0,\n",
"wordsWritten INTEGER NOT NULL DEFAULT 0,\n",
"wordsPerMinute INTEGER NOT NULL DEFAULT 0\n",
");"
Class is this:
@objc(WordSprint)
class WordSprint : FCModel, IsDbMigratable {
var wordSprintId: Int = 0
var projectId: Int = 0
var sprintDate : NSDate = NSDate().dateAtStartOfDay()
var durationInMinutes : Int = 0
var wordsWritten : Int = 0
var wordsPerMinute : Int = 0
VS a working one:
"CREATE TABLE IF NOT EXISTS DayStats (\n",
"dayStatsId INTEGER PRIMARY KEY NOT NULL,\n",
"projectId INTEGER NOT NULL DEFAULT 0,\n",
"statsDate REAL NOT NULL,\n",
"wordsWrittenAtStart INTEGER NOT NULL DEFAULT 0,\n",
"wordsWrittenAtEnd INTEGER NOT NULL DEFAULT 0,\n",
"wordsDeleted INTEGER NOT NULL DEFAULT 0,\n",
"chaptersAdded INTEGER NOT NULL DEFAULT 0,\n",
"chaptersDeleted INTEGER NOT NULL DEFAULT 0,\n",
"scenesAdded INTEGER NOT NULL DEFAULT 0,\n",
"scenesRemoved INTEGER NOT NULL DEFAULT 0,\n",
"timeSpent REAL NOT NULL DEFAULT 0\n",
");"
@objc(DayStats)
class DayStats : FCModel, IsDbMigratable {
var dayStatsId : Int = 0
var projectId: Int = 0
var statsDate : NSDate = NSDate().dateAtStartOfDay()
var wordsWrittenAtStart : Int = 0
var wordsWrittenAtEnd : Int = 0
var wordsDeleted : Int = 0
var chaptersAdded : Int = 0
var chaptersDeleted : Int = 0
var scenesAdded : Int = 0
var scenesRemoved : Int = 0
var timeSpent : NSTimeInterval = 0
I don't really know where to look for this. It explodes in the same place using WordSprint.allInstances as well as a custom query like:
let sprints = WordSprint.instancesWhere("wordSprintId > ?", arguments:[0]) as! [WordSprint]
Sorry I can't give any more information, I think I'm still running an old version of FCModel, but I can't spot a version number in the Pod to identify it. FCModel.h has a creation date of 7/18/13.
Hey Marco,
I'm having an issue with one of my table mappings. FCModel expandQuery is exploding on line 956 query = [query stringByReplacingOccurrencesOfString:@"$PK" withString:g_primaryKeyFieldName[self]];
I can see that the primaryKeyFieldName dictionary is failing because it doesn't contain the PK for the table, but comparing a working file + creation script to the non-working one isn't helping.
Creation for the failing one is this: "CREATE TABLE IF NOT EXISTS WordSprint (\n", "wordSprintId INTEGER PRIMARY KEY NOT NULL,\n", "projectId INTEGER NOT NULL DEFAULT 0,\n", "sprintDate REAL NOT NULL,\n", "durationInMinutes INTEGER NOT NULL DEFAULT 0,\n", "wordsWritten INTEGER NOT NULL DEFAULT 0,\n", "wordsPerMinute INTEGER NOT NULL DEFAULT 0\n", ");"
Class is this: @objc(WordSprint) class WordSprint : FCModel, IsDbMigratable { var wordSprintId: Int = 0 var projectId: Int = 0 var sprintDate : NSDate = NSDate().dateAtStartOfDay() var durationInMinutes : Int = 0 var wordsWritten : Int = 0 var wordsPerMinute : Int = 0
VS a working one:
"CREATE TABLE IF NOT EXISTS DayStats (\n", "dayStatsId INTEGER PRIMARY KEY NOT NULL,\n", "projectId INTEGER NOT NULL DEFAULT 0,\n", "statsDate REAL NOT NULL,\n", "wordsWrittenAtStart INTEGER NOT NULL DEFAULT 0,\n", "wordsWrittenAtEnd INTEGER NOT NULL DEFAULT 0,\n", "wordsDeleted INTEGER NOT NULL DEFAULT 0,\n", "chaptersAdded INTEGER NOT NULL DEFAULT 0,\n", "chaptersDeleted INTEGER NOT NULL DEFAULT 0,\n", "scenesAdded INTEGER NOT NULL DEFAULT 0,\n", "scenesRemoved INTEGER NOT NULL DEFAULT 0,\n", "timeSpent REAL NOT NULL DEFAULT 0\n", ");"
@objc(DayStats) class DayStats : FCModel, IsDbMigratable { var dayStatsId : Int = 0 var projectId: Int = 0 var statsDate : NSDate = NSDate().dateAtStartOfDay() var wordsWrittenAtStart : Int = 0 var wordsWrittenAtEnd : Int = 0 var wordsDeleted : Int = 0 var chaptersAdded : Int = 0 var chaptersDeleted : Int = 0 var scenesAdded : Int = 0 var scenesRemoved : Int = 0 var timeSpent : NSTimeInterval = 0
I don't really know where to look for this. It explodes in the same place using WordSprint.allInstances as well as a custom query like: let sprints = WordSprint.instancesWhere("wordSprintId > ?", arguments:[0]) as! [WordSprint]
Sorry I can't give any more information, I think I'm still running an old version of FCModel, but I can't spot a version number in the Pod to identify it. FCModel.h has a creation date of 7/18/13.