package uk.gov.register.resources;

import org.flywaydb.core.Flyway;

import javax.annotation.security.PermitAll;
import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

@Path("/")
public class DeleteRegisterDataResource {
    private Flyway flyway;

    @Inject
    public DeleteRegisterDataResource(Flyway flyway) {
        this.flyway = flyway;
    }

    @DELETE
    @PermitAll
    @Path("/delete-register-data")
    @DataDeleteNotAllowed
    public Response deleteRegisterData() {
        flyway.clean();
        flyway.setBaselineVersionAsString("0");
        flyway.migrate();
        return Response.status(200).entity("Data has been deleted").build();
    }
}

package uk.gov.register.resources;

import org.flywaydb.core.Flyway;

import javax.annotation.security.PermitAll;
import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

@Path("/")
public class DeleteRegisterDataResource {
    private Flyway flyway;

    @Inject
    public DeleteRegisterDataResource(Flyway flyway) {
        this.flyway = flyway;
    }

    @DELETE
    @PermitAll
    @Path("/delete-register-data")
    @DataDeleteNotAllowed
    public Response deleteRegisterData() {
        flyway.clean();
        flyway.migrate();
        return Response.status(200).entity("Data has been deleted").build();
    }
}

Remove another instance of flyway baseline
Remove another instance of flyway baseline

For consistency with 681d234e1b7bddd03f356ddab80b367de3626702 - we
should configure flyway the same way everywhere.
