package cc.smtweb.biz.mztb.web.patch;

import cc.smtweb.framework.core.annotation.SwPatch;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.patch.IPatch;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.EncodedResource;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;


/**
 *
 */
@SwPatch
public class Patch0_001 implements IPatch {
    @Override
    public double version() {
        return 0.001;
    }

    @Override
    public String versionDesc() {
        return "";
    }

    @Override
    public void upgradeDb() {

    }

    @Override
    public List<EncodedResource> scriptFiles() {
        List<EncodedResource> files = new ArrayList<>();
        String dbType = DbEngine.getInstance().getDbType();
        EncodedResource resource = new EncodedResource(new ClassPathResource("upgrade/mztb/"+dbType+"/patch_0.001.sql"), StandardCharsets.UTF_8);
        files.add(resource);
        return files;
    }

    @Override
    public void upgrade() {

    }
}