floor
floor copied to clipboard
(1) table ChatRecord has no column named audioOpenEd E/flutter (25765): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: DatabaseException(table ChatRecord has no column named audioOpenEd (Sqlite code 1 SQLITE_ERROR): , while compiling: INSERT OR ABORT INTO ChatRecord (chatListId, head_url, name, content, audioOpenEd, audioRecord) VALUES (NULL, ?, ?, ?, ?, ?), (OS error - 2:No such file or directory)) sql 'INSERT OR ABORT INTO ChatRecord (chatListId, head_url, name, content, audioOpenEd, audioRecord) VALUES (NULL, ?, ?, ?, ? , ?,)'
I use Migrations but it has this problem,example is that final migration1to2 = Migration(3, 4, (database) async { await database.execute('ALTER TABLE ChatRecord ADD COLUMN [audioOpenEd INTEGER NOT NULL audioRecord TEXT]'); });
final database = await $FloorAppDatabase
.databaseBuilder("chatRecord.db")
.addMigrations([migration1to2])
.build();
the entity is that: @entity class ChatRecord{ @PrimaryKey(autoGenerate: true) int? chatListId; String head_url; String name; String content; bool audioOpenEd; String audioRecord;
ChatRecord(this.chatListId, this.head_url, this.name, this.content,this.audioRecord, this.audioOpenEd); } @Database(version: 4, entities: [ChatList,ChatRecord]) abstract class AppDatabase extends FloorDatabase { ChatListDao get chatListDao; ChatRecordDao get chatRecordDao; }
I have the same problem now.
Migrations do not seem to be applied.
Make sure your run flutter packages pub run build_runner build
after adding the migrations so that the code is refreshed with the new version
Assuming due to inactivity that this is no longer an issue.