pinchbv / floor

The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications
https://pinchbv.github.io/floor/
Apache License 2.0
947 stars 190 forks source link

onCreate callback is not being called, "tbl not found" exception #823

Open jonas-zebari opened 4 months ago

jonas-zebari commented 4 months ago

For whatever reason I cannot get the onCreate callback to run when opening the app, which is leading to the tables not existing when the first operation is attempted. I've tried clearing the cache, uninstalling and reinstalling, but nothing seems to work. The device is just stuck. I'm using a Pixel 4 XL running Android 13.

I'm calling await $FloorAppDatabase.databaseBuilder('app_database.db').build() in main(), but the full error is:

`no such table: tbl_tablename (code 1 SQLITE_ERROR): , while compiling: INSERT OR ABORT INTO tbl_tablename (...) VALUES (...)

0 wrapDatabaseException (package:sqflite/src/exception_impl.dart:11:7)

#1 SqfliteDatabaseMixin.txnRawInsert. (package:sqflite_common/src/database_mixin.dart:576:14) #2 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16) #3 SqfliteDatabaseMixin.txnSynchronized (package:sqflite_common/src/database_mixin.dart:517:14) #4 InsertionAdapter._insert (package:floor/src/adapter/insertion_adapter.dart:77:20) #5 InsertionAdapter.insert (package:floor/src/adapter/insertion_adapter.dart:28:5) #6 _$InternalDao.insertData (package:...) #7 InternalRepo._callback (package:...) #8 InternalBloc._handler (package:...) #9 Bloc.on..handleEvent (package:bloc/src/bloc.dart:229:13) `