Package com.dotmarketing.startup.runonce

Source Code of com.dotmarketing.startup.runonce.Task01015AddPublishExpireDateToIdentifier

package com.dotmarketing.startup.runonce;

import java.util.List;

import com.dotmarketing.common.db.DotConnect;
import com.dotmarketing.db.DbConnectionFactory;
import com.dotmarketing.startup.AbstractJDBCStartupTask;

public class Task01015AddPublishExpireDateToIdentifier extends AbstractJDBCStartupTask {
   
    @Override
    public boolean forceRun() {
        try {
            DotConnect dc=new DotConnect();
            dc.setSQL("select publish_date,expire_date from identifier where publish_date>"
                      +DbConnectionFactory.getDBDateTimeFunction());
            dc.loadResult();
        }
        catch(Exception ex) {
            return true;
        }
        return false;
    }
   
    @Override
    public String getPostgresScript() {       
        return "alter table identifier add syspublish_date timestamp;" +
            "alter table identifier add sysexpire_date timestamp;" +
                "create index idx_identifier_pub on identifier (syspublish_date);"+
                "create index idx_identifier_exp on identifier (sysexpire_date);";
    }
   
    @Override
    public String getMySQLScript() {
        return "alter table identifier add syspublish_date datetime;" +
                "alter table identifier add sysexpire_date datetime;"+
                "create index idx_identifier_pub on identifier (syspublish_date);"+
                "create index idx_identifier_exp on identifier (sysexpire_date);";
       
    }
   
    @Override
    public String getOracleScript() {
        return "alter table identifier add syspublish_date timestamp;" +
                "alter table identifier add sysexpire_date timestamp;"+
                "create index idx_identifier_pub on identifier (syspublish_date);"+
                "create index idx_identifier_exp on identifier (sysexpire_date);";
    }
   
    @Override
    public String getMSSQLScript() {
        return "alter table identifier add syspublish_date datetime;" +
                "alter table identifier add sysexpire_date datetime;"+
                "create index idx_identifier_pub on identifier (syspublish_date);"+
                "create index idx_identifier_exp on identifier (sysexpire_date);";
    }
   
    @Override
    protected List<String> getTablesToDropConstraints() {
        return null;
    }

    @Override
    public String getH2Script() {
        return null;
    }
   
}
TOP

Related Classes of com.dotmarketing.startup.runonce.Task01015AddPublishExpireDateToIdentifier

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.