RoomDatabase.Callback
public abstract class RoomDatabase.Callback
Callback for RoomDatabase
Summary
Public methods |
|
|---|---|
void |
onCreate(@NonNull SQLiteConnection connection)Called when the database is created for the first time. |
void |
Called when the database is created for the first time. |
void |
onDestructiveMigration(@NonNull SQLiteConnection connection)Called after the database was destructively migrated. |
void |
Called after the database was destructively migrated |
void |
onOpen(@NonNull SQLiteConnection connection)Called when the database has been opened. |
void |
Called when the database has been opened. |
Public constructors
Public methods
onCreate
public void onCreate(@NonNull SQLiteConnection connection)
Called when the database is created for the first time.
This function called after all the tables are created.
| Parameters | |
|---|---|
@NonNull SQLiteConnection connection |
The database connection. |
onCreate
public void onCreate(@NonNull SupportSQLiteDatabase db)
Called when the database is created for the first time. This is called after all the tables are created.
This function is only called when Room is configured without a driver. If a driver is set using Builder.setDriver, then only the version that receives a SQLiteConnection is called.
| Parameters | |
|---|---|
@NonNull SupportSQLiteDatabase db |
The database. |
onDestructiveMigration
public void onDestructiveMigration(@NonNull SQLiteConnection connection)
Called after the database was destructively migrated.
| Parameters | |
|---|---|
@NonNull SQLiteConnection connection |
The database connection. |
onDestructiveMigration
public void onDestructiveMigration(@NonNull SupportSQLiteDatabase db)
Called after the database was destructively migrated
This function is only called when Room is configured without a driver. If a driver is set using Builder.setDriver, then only the version that receives a SQLiteConnection is called.
| Parameters | |
|---|---|
@NonNull SupportSQLiteDatabase db |
The database. |
onOpen
public void onOpen(@NonNull SQLiteConnection connection)
Called when the database has been opened.
| Parameters | |
|---|---|
@NonNull SQLiteConnection connection |
The database connection. |
onOpen
public void onOpen(@NonNull SupportSQLiteDatabase db)
Called when the database has been opened.
This function is only called when Room is configured without a driver. If a driver is set using Builder.setDriver, then only the version that receives a SQLiteConnection is called.
| Parameters | |
|---|---|
@NonNull SupportSQLiteDatabase db |
The database. |