I need help with SQL migration in Room
# compose
j
I need help with SQL migration in Room
message has been deleted
Copy code
package dev.bellu.flight_search.data.database

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import dev.bellu.flight_search.data.contracts.FlightDao
import dev.bellu.flight_search.data.entity.AirportEntity
import dev.bellu.flight_search.data.entity.FavoriteEntity
import java.io.*

@Database(entities = [AirportEntity::class, FavoriteEntity::class], version = 1, exportSchema = true)
abstract class FlightDatabase : RoomDatabase() {
    abstract fun FlightDao(): FlightDao

    companion object {
        private const val DATABASE_NAME = "new_flight_search.db"
        fun getDatabase(context: Context): FlightDatabase {
            return Room.databaseBuilder(
                name = DATABASE_NAME,
                klass = FlightDatabase::class.java,
                context = context
            )
                .createFromFile(databaseFile = File("flight_search.db"))
                .build()
        }
    }
}
I'm trying to migrate an existing database with Jetpack Compose Room, but I have this problem
image.png
z
I’m not sure I see what this has to do with compose
j
It is made in Jetpack Compose
z
I don’t see any compose code in your snippet. Compose doesn’t do anything with databases. I think there’s maybe a room extension to observe data as compose state, but that’s just a convenience thing, it shouldn’t affect database schema or migrations
j
Do you think it could be something from Android?
z
I don’t even know what the issue is you’re having - is there an error message?