@Override
    public String getCreateTableSql(Table table) {
        String tableName = table.getName();
        String schema = table.getSchema();
        List<Column> columns = table.getColumns();

        String columnDefinitions =
                columns.stream().map(this::getColumnDefinition).collect(Collectors.joining(",\n"));

        // comment table:COMMENT ON TABLE "schemaName"."tableName" IS 'comment';
        String comment =
                String.format("COMMENT ON TABLE \"%s\".\"%s\" IS '%s';\n", schema, tableName, table.getComment());

        // get primaryKeys
        List<String> columnKeys = table.getColumns().stream()
                .filter(Column::isKeyFlag)
                .map(Column::getName)
                .map(t -> String.format("\"%s\"", t))
                .collect(Collectors.toList());

        // add primaryKey
        String primaryKeyStr = columnKeys.isEmpty()
                ? ""
                : columnKeys.stream().collect(Collectors.joining(",", ", \n\tPRIMARY KEY (", ")\n"));

        // CREATE TABLE "schemaName"."tableName" ( columnDefinitions ); comment
        String ddl = String.format(
                "CREATE TABLE \"%s\".\"%s\" (\n%s%s);\n%s",
                schema, tableName, columnDefinitions, primaryKeyStr, comment);

        ddl += columns.stream()
                // COMMENT ON COLUMN "schemaName"."tableName"."columnName" IS 'comment'
                .map(c -> String.format(
                        "COMMENT ON COLUMN \"%s\".\"%s\".\"%s\" IS '%s';\n",
                        schema, tableName, c.getName(), c.getComment()))
                .collect(Collectors.joining());

        return ddl;
    }
@Test
    void getCreateTableSql() {

        PostgreSqlDriver postgreSqlDriver = new PostgreSqlDriver();
        String tableDDL = postgreSqlDriver.getCreateTableSql(table);
        String expect = "CREATE TABLE \"public\".\"user\" (\n"
                + "\t\"id\" BIGINT NOT NULL,\n"
                + "\t\"username\" VARCHAR(255) NOT NULL,\n"
                + "\t\"password\" VARCHAR(255) NOT NULL,\n"
                + "\t\"email\" VARCHAR(255) NOT NULL,\n"
                + "\t\"phone\" VARCHAR(20) NOT NULL,\n"
                + "\t\"age\" INT,\n"
                + "\t\"gender\" BOOLEAN,\n"
                + "\t\"height\" DECIMAL(5,2),\n"
                + "\t\"birthday\" DATE,\n"
                + "\t\"register_time\" TIMESTAMP NOT NULL, \n"
                + "\tPRIMARY KEY (\"id\")\n"
                + ");\n"
                + "COMMENT ON TABLE \"public\".\"user\" IS '用户表';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"id\" IS '用户id';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"username\" IS '用户名';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"password\" IS '密码';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"email\" IS '邮箱';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"phone\" IS '电话号码';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"age\" IS '年龄';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"gender\" IS '性别';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"height\" IS '身高';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"birthday\" IS '生日';\n"
                + "COMMENT ON COLUMN \"public\".\"user\".\"register_time\" IS '注册时间';\n";
        assertEquals(expect, tableDDL);
    }