floor icon indicating copy to clipboard operation
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, ?, ?, ?, ? , ?,)'

Open yixiu30 opened this issue 3 years ago • 2 comments

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; }

yixiu30 avatar Jul 13 '21 02:07 yixiu30

I have the same problem now.

Migrations do not seem to be applied.

Sanshain avatar Aug 01 '21 16:08 Sanshain

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

alexmro avatar Aug 23 '21 07:08 alexmro

Assuming due to inactivity that this is no longer an issue.

SEGVeenstra avatar Jul 04 '23 15:07 SEGVeenstra