| 12345678910111213141516171819202122232425262728 |
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.Statement;
- public class CreateToolConfigTable {
- public static void main(String[] args) throws Exception {
- String db = args.length > 0 ? args[0] : "fs_tenant_cs1";
- String url = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/" + db
- + "?useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true";
- String sql = "CREATE TABLE IF NOT EXISTS lobster_tool_config ("
- + "id BIGINT AUTO_INCREMENT PRIMARY KEY,"
- + "company_id BIGINT NOT NULL DEFAULT 0,"
- + "tool_name VARCHAR(128) NOT NULL,"
- + "tool_type VARCHAR(64) DEFAULT NULL,"
- + "description VARCHAR(500) DEFAULT NULL,"
- + "config_json TEXT,"
- + "enabled TINYINT NOT NULL DEFAULT 1,"
- + "deleted TINYINT NOT NULL DEFAULT 0,"
- + "create_time DATETIME DEFAULT CURRENT_TIMESTAMP,"
- + "UNIQUE KEY uk_company_tool (company_id, tool_name)"
- + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
- try (Connection c = DriverManager.getConnection(url, "root", "Ylrz_1q2w3e4r5t6y");
- Statement s = c.createStatement()) {
- s.execute(sql);
- System.out.println(db + " lobster_tool_config OK");
- }
- }
- }
|