RoomDatabase.Callback


public abstract class RoomDatabase.Callback


Callback for RoomDatabase

Summary

Public constructors

Public methods

void

Called when the database is created for the first time.

void

Called when the database is created for the first time.

void

Called after the database was destructively migrated.

void

Called after the database was destructively migrated

void

Called when the database has been opened.

void

Called when the database has been opened.

Public constructors

Callback

Added in 2.0.0
public Callback()

Callback

Added in 2.0.0
public Callback()

Public methods

onCreate

Added in 2.7.0-alpha03
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

Added in 2.0.0
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.

Parameters
@NonNull SupportSQLiteDatabase db

The database.

onDestructiveMigration

Added in 2.7.0-alpha03
public void onDestructiveMigration(@NonNull SQLiteConnection connection)

Called after the database was destructively migrated.

Parameters
@NonNull SQLiteConnection connection

The database connection.

onDestructiveMigration

Added in 2.2.0
public void onDestructiveMigration(@NonNull SupportSQLiteDatabase db)

Called after the database was destructively migrated

Parameters
@NonNull SupportSQLiteDatabase db

The database.

onOpen

Added in 2.7.0-alpha03
public void onOpen(@NonNull SQLiteConnection connection)

Called when the database has been opened.

Parameters
@NonNull SQLiteConnection connection

The database connection.

onOpen

Added in 2.0.0
public void onOpen(@NonNull SupportSQLiteDatabase db)

Called when the database has been opened.

Parameters
@NonNull SupportSQLiteDatabase db

The database.