# RoomDatabase.Callback

Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/RoomDatabase.+class:androidx.room3.RoomDatabase.Callback) Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  abstract class RoomDatabase.Callback
  ```

*** ** * ** ***

Callback for `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback#Callback()()` | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback#Callback()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback#Callback()()` | Cmn |

| ### Public functions |
|---|---|---|
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback#onCreate(androidx.sqlite.SQLiteConnection)(connection: https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection)` Called when the database is created for the first time. | Cmn android |
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback#onDestructiveMigration(androidx.sqlite.SQLiteConnection)(connection: https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection)` Called after the database was destructively migrated. | Cmn android |
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback#onOpen(androidx.sqlite.SQLiteConnection)(connection: https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection)` Called when the database has been opened. | Cmn android |

## Public constructors

### Callback

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
Callback()
```

### Callback

Cmn Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
Callback()
```

### Callback

Cmn Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
Callback()
```

## Public functions

### onCreate

Cmn android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
open suspend fun onCreate(connection: SQLiteConnection): Unit
```

Called when the database is created for the first time.

This function called after all the tables are created.

| Parameters |
|---|---|
| `connection: https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | The database connection. |

### onDestructiveMigration

Cmn android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
open suspend fun onDestructiveMigration(connection: SQLiteConnection): Unit
```

Called after the database was destructively migrated.

| Parameters |
|---|---|
| `connection: https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | The database connection. |

### onOpen

Cmn android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
open suspend fun onOpen(connection: SQLiteConnection): Unit
```

Called when the database has been opened.

| Parameters |
|---|---|
| `connection: https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` | The database connection. |