room/runtime/src/main/java/androidx/room/RoomDatabase.java
@NonNull
        public Builder<T> addMigrations(@NonNull  Migration... migrations) {
            if (mMigrationStartAndEndVersions == null) {
                mMigrationStartAndEndVersions = new HashSet<>();
            }
            for (Migration migration: migrations) {
                mMigrationStartAndEndVersions.add(migration.startVersion);
                mMigrationStartAndEndVersions.add(migration.endVersion);
            }

            mMigrationContainer.addMigrations(migrations);
            return this;
        }
/**
         * Adds a migration to the builder.
         * <p>
         * Each Migration has a start and end versions and Room runs these migrations to bring the
         * database to the latest version.
         * <p>
         * If a migration item is missing between current version and the latest version, Room
         * will clear the database and recreate so even if you have no changes between 2 versions,
         * you should still provide a Migration object to the builder.
         * <p>
         * A migration can handle more than 1 version (e.g. if you have a faster path to choose when
         * going version 3 to 5 without going to version 4). If Room opens a database at version
         * 3 and latest version is &gt;= 5, Room will use the migration object that can migrate from
         * 3 to 5 instead of 3 to 4 and 4 to 5.
         *
         * @param migrations The migration object that can modify the database and to the necessary
         *                   changes.
         * @return this
         */
Adds a migration to the builder.

Each Migration has a start and end versions and Room runs these migrations to bring the
database to the latest version.

If a migration item is missing between current version and the latest version, Room
will clear the database and recreate so even if you have no changes between 2 versions,
you should still provide a Migration object to the builder.

A migration can handle more than 1 version . If Room opens a database at version
3 and latest version is >= 5, Room will use the migration object that can migrate from
3 to 5 instead of 3 to 4 and 4 to 5.

@param migrations The migration object that can modify the database and to the necessary
changes.
@return this
Adds a migration to the builder . Each Migration has a start and end versions and Room runs these migrations to bring the database to the latest version . If a migration item is missing between current version and the latest version Room will clear the database and recreate so even if you have no changes between 2 versions you should still provide a Migration object to the builder . A migration can handle more than 1 version . If Room opens a database at version 3 and latest version is > = 5 Room will use the migration object that can migrate from 3 to 5 instead of 3 to 4 and 4 to 5 . @param migrations The migration object that can modify the database and to the necessary changes . @return this
@NonNull
        public Builder<T> addMigrations(@NonNull  Migration... migrations) {
            if (mMigrationStartAndEndVersions == null) {
                mMigrationStartAndEndVersions = new HashSet<>();
            }
            for (Migration migration: migrations) {
                mMigrationStartAndEndVersions.add(migration.startVersion);
                mMigrationStartAndEndVersions.add(migration.endVersion);
            }
            mMigrationContainer.addMigrations(migrations);
            return this;
        }
@ NonNull public Builder < T > addMigrations ( @ NonNull Migration ... migrations ) { if ( mMigrationStartAndEndVersions == null ) { mMigrationStartAndEndVersions = new HashSet < > ( ) ; } for ( Migration migration : migrations ) { mMigrationStartAndEndVersions . add ( migration . startVersion ) ; mMigrationStartAndEndVersions . add ( migration . endVersion ) ; } mMigrationContainer . addMigrations ( migrations ) ; return this ; }
Adds a migration to the builder.
Adds a migration to the builder .