All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.migrations.DbDropAllCommand Maven / Gradle / Ivy

There is a newer version: 5.0.0-alpha.2
Show newest version
package io.dropwizard.migrations;

import io.dropwizard.Configuration;
import io.dropwizard.db.DatabaseConfiguration;
import liquibase.Liquibase;
import net.sourceforge.argparse4j.impl.Arguments;
import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser;

public class DbDropAllCommand extends AbstractLiquibaseCommand {
    public DbDropAllCommand(DatabaseConfiguration strategy, Class configurationClass, String migrationsFileName) {
        super("drop-all", "Delete all user-owned objects from the database.", strategy, configurationClass, migrationsFileName);
    }

    @Override
    public void configure(Subparser subparser) {
        super.configure(subparser);
        subparser.addArgument("--confirm-delete-everything")
                 .action(Arguments.storeTrue())
                 .required(true)
                 .help("indicate you understand this deletes everything in your database");
    }

    @Override
    public void run(Namespace namespace, Liquibase liquibase) throws Exception {
        liquibase.dropAll();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy