Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jonas-zebari opened this issue Apr 15, 2024 · 1 comment
Open

Comments

@jonas-zebari
Copy link

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)
`

@tungdevpro
Copy link

I think that you should try uninstalling the old app from your device and running it again. onCreate method in Sqflite will only execute the first time your app runs. Any code changes made after that will not create the database or modify the table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants