Я пытаюсь мигрировать в комнату 2.2.3, но у меня возникла проблема:
Process: , PID: 6854
java.lang.IllegalStateException: Pre-packaged database has an invalid schema: questionPart2Category(.models.db.entity.QuestionPart2Category).
Expected:
TableInfo{name='questionPart2Category', columns={questionPart2CategoryId=Column{name='questionPart2CategoryId', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'}, categoryId=Column{name='categoryId', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='null'}, questionPartId=Column{name='questionPartId', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='null'}}, foreignKeys=[ForeignKey{referenceTable='category', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[categoryId], referenceColumnNames=[categoryId]}, ForeignKey{referenceTable='questionPart', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[questionPartId], referenceColumnNames=[questionPartId]}], indices=[Index{name='index_questionPart2Category_questionPartId', unique=false, columns=[questionPartId]}, Index{name='index_questionPart2Category_categoryId', unique=false, columns=[categoryId]}]}
Found:
TableInfo{name='questionPart2Category', columns={questionPart2categoryId=Column{name='questionPart2categoryId', type='Integer', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'}, questionPartId=Column{name='questionPartId', type='Integer', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='null'}, categoryId=Column{name='categoryId', type='Text', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='null'}}, foreignKeys=[ForeignKey{referenceTable='category', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[categoryId], referenceColumnNames=[categoryId]}, ForeignKey{referenceTable='questionPart', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[questionPartId], referenceColumnNames=[questionPartId]}], indices=[Index{name='index_questionPart2Category_questionPartId', unique=false, columns=[questionPartId]}, Index{name='index_questionPart2Category_categoryId', unique=false, columns=[categoryId]}]}
Я пытался сравнивать каждое поле / ключ / индекс построчно, но я не увидел никакой разницы. Ребята, вы знаете, что происходит?
Строка за строкой (ожидается и найдено)
questionPart2categoryId=Column{name='questionPart2categoryId', type='Integer', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'},
questionPart2CategoryId=Column{name='questionPart2CategoryId', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=1, defaultValue='null'},
questionPartId=Column{name='questionPartId', type='Integer', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='null'},
questionPartId=Column{name='questionPartId', type='INTEGER', affinity='3', notNull=true, primaryKeyPosition=0, defaultValue='null'}
categoryId=Column{name='categoryId', type='Text', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='null'}
categoryId=Column{name='categoryId', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='null'},
}, foreignKeys=[ForeignKey{referenceTable='category', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[categoryId], referenceColumnNames=[categoryId]},
}, foreignKeys=[ForeignKey{referenceTable='category', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[categoryId], referenceColumnNames=[categoryId]},
ForeignKey{referenceTable='questionPart', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[questionPartId], referenceColumnNames=[questionPartId]}],
ForeignKey{referenceTable='questionPart', onDelete='NO ACTION', onUpdate='NO ACTION', columnNames=[questionPartId], referenceColumnNames=[questionPartId]}],
indices=[Index{name='index_questionPart2Category_questionPartId', unique=false, columns=[questionPartId]}, Index{name='index_questionPart2Category_categoryId', unique=false, columns=[categoryId]}]}
indices=[Index{name='index_questionPart2Category_questionPartId', unique=false, columns=[questionPartId]}, Index{name='index_questionPart2Category_categoryId', unique=false, columns=[categoryId]}]}
Я заметил только разницу с порядком столбцов в найденных и ожидаемых, но в Sqlite есть нет способа определить порядок столбцов.