package com.atlassian.bitbucket.internal.scm.git.lfs.dao;

import net.java.ao.DBParam;
import net.java.ao.EntityManager;
import net.java.ao.test.jdbc.DatabaseUpdater;

public class RepositoryConfigDatabaseUpdater implements DatabaseUpdater {

    @Override
    public void update(EntityManager entityManager) throws Exception {
        //noinspection unchecked
        entityManager.migrate(AoGitLfsRepositoryConfig.class);

        entityManager.create(AoGitLfsRepositoryConfig.class,
                new DBParam(AoGitLfsRepositoryConfig.ENABLED_COLUMN, true),
                new DBParam(AoGitLfsRepositoryConfig.REPOSITORY_ID_COLUMN, 1)
        );

        entityManager.create(AoGitLfsRepositoryConfig.class,
                new DBParam(AoGitLfsRepositoryConfig.ENABLED_COLUMN, false),
                new DBParam(AoGitLfsRepositoryConfig.REPOSITORY_ID_COLUMN, 2)
        );
    }
}
