work/workmanager/src/main/java/androidx/work/impl/WorkDatabase.java
public static WorkDatabase create(Context context, boolean useTestDatabase) {
        RoomDatabase.Builder<WorkDatabase> builder;
        if (useTestDatabase) {
            builder = Room.inMemoryDatabaseBuilder(context, WorkDatabase.class)
                    .allowMainThreadQueries();
        } else {
            builder = Room.databaseBuilder(context, WorkDatabase.class, DB_NAME);
        }

        return builder.addCallback(generateCleanupCallback())
                .addMigrations(WorkDatabaseMigrations.MIGRATION_1_2)
                .addMigrations(
                        new WorkDatabaseMigrations.WorkMigration(context, VERSION_2, VERSION_3))
                .addMigrations(MIGRATION_3_4)
                .fallbackToDestructiveMigration()
                .build();
    }
/**
     * Creates an instance of the WorkDatabase.
     *
     * @param context         A context (this method will use the application context from it)
     * @param useTestDatabase {@code true} to generate an in-memory database that allows main thread
     *                        access
     * @return The created WorkDatabase
     */
Creates an instance of the WorkDatabase.
@param context         A context (this method will use the application context from it)
@param useTestDatabase  true to generate an in-memory database that allows main thread
access
@return The created WorkDatabase
Creates an instance of the WorkDatabase . @param context A context ( this method will use the application context from it ) @param useTestDatabase true to generate an in - memory database that allows main thread access @return The created WorkDatabase
public static WorkDatabase create(Context context, boolean useTestDatabase) {
        RoomDatabase.Builder<WorkDatabase> builder;
        if (useTestDatabase) {
            builder = Room.inMemoryDatabaseBuilder(context, WorkDatabase.class)
                    .allowMainThreadQueries();
        } else {
            builder = Room.databaseBuilder(context, WorkDatabase.class, DB_NAME);
        }
        return builder.addCallback(generateCleanupCallback())
                .addMigrations(WorkDatabaseMigrations.MIGRATION_1_2)
                .addMigrations(
                        new WorkDatabaseMigrations.WorkMigration(context, VERSION_2, VERSION_3))
                .addMigrations(MIGRATION_3_4)
                .fallbackToDestructiveMigration()
                .build();
    }
public static WorkDatabase create ( Context context , boolean useTestDatabase ) { RoomDatabase . Builder < WorkDatabase > builder ; if ( useTestDatabase ) { builder = Room . inMemoryDatabaseBuilder ( context , WorkDatabase . class ) . allowMainThreadQueries ( ) ; } else { builder = Room . databaseBuilder ( context , WorkDatabase . class , DB_NAME ) ; } return builder . addCallback ( generateCleanupCallback ( ) ) . addMigrations ( WorkDatabaseMigrations . MIGRATION_1_2 ) . addMigrations ( new WorkDatabaseMigrations . WorkMigration ( context , VERSION_2 , VERSION_3 ) ) . addMigrations ( MIGRATION_3_4 ) . fallbackToDestructiveMigration ( ) . build ( ) ; }
Creates an instance of the WorkDatabase.
Creates an instance of the WorkDatabase .