I have an application and it already has a Sqlite database with columns of type: text, integer and DATETIME. And I'm having some problems with room because I dont know what data type to use in Entity class for datetime field. When I try to do Migration I get :
Caused by: java.lang.IllegalStateException: Migration didn't properly handle CALL_INFO_TABLE(callcatcher.call.com.callcatcher.sqlite.CallData).
Expected:
TableInfo{name='CALL_INFO_TABLE', columns={date=Column{name='date', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}, path=Column{name='path', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}, createdDate=Column{name='createdDate', type='INTEGER', affinity='3', notNull=false, primaryKeyPosition=0}, group_name=Column{name='group_name', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}, hint=Column{name='hint', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}, name=Column{name='name', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}, phone_number=Column{name='phone_number', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}, id=Column{name='id', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1}, state=Column{name='state', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0}}, foreignKeys=[], indices=[]}
Found:
TableInfo{name='CALL_INFO_TABLE', columns={date=Column{name='date', type='text', affinity='2', notNull=false, primaryKeyPosition=0}, path=Column{name='path', type='text', affinity='2', notNull=false, primaryKeyPosition=0}, createdDate=Column{name='createdDate', type='datetime', affinity='1', notNull=false, primaryKeyPosition=0}, group_name=Column{name='group_name', type='text', affinity='2', notNull=false, primaryKeyPosition=0}, hint=Column{name='hint', type='text', affinity='2', notNull=false, primaryKeyPosition=0}, name=Column{name='name', type='text', affinity='2', notNull=false, primaryKeyPosition=0}, phone_number=Column{name='phone_number', type='text', affinity='2', notNull=false, primaryKeyPosition=0}, id=Column{name='id', type='integer', affinity='3', notNull=false, primaryKeyPosition=1}, state=Column{name='state', type='text', affinity='2', notNull=false, primaryKeyPosition=0}}, foreignKeys=[], indices=[]}
As you can see - there is a type mismatch in Column createdDate. I need to map Java class field to datetime column or some other work around.