From 7a2ebcd66374c37aec6b4911ec0fff067eaf33bf Mon Sep 17 00:00:00 2001 From: vran Date: Sat, 12 Mar 2022 08:49:54 +0800 Subject: [PATCH] feat:add url_pattern to database type --- .../databasir/dao/tables/DatabaseType.java | 13 ++- .../dao/tables/pojos/DatabaseTypePojo.java | 19 ++++ .../tables/records/DatabaseTypeRecord.java | 106 ++++++++++++------ .../db/migration/V1.1__database_type.sql | 7 +- 4 files changed, 104 insertions(+), 41 deletions(-) diff --git a/dao/generated-src/jooq/main/java/com/databasir/dao/tables/DatabaseType.java b/dao/generated-src/jooq/main/java/com/databasir/dao/tables/DatabaseType.java index 514a05e..76f14df 100644 --- a/dao/generated-src/jooq/main/java/com/databasir/dao/tables/DatabaseType.java +++ b/dao/generated-src/jooq/main/java/com/databasir/dao/tables/DatabaseType.java @@ -17,7 +17,7 @@ import org.jooq.ForeignKey; import org.jooq.Identity; import org.jooq.Name; import org.jooq.Record; -import org.jooq.Row11; +import org.jooq.Row12; import org.jooq.Schema; import org.jooq.Table; import org.jooq.TableField; @@ -85,6 +85,11 @@ public class DatabaseType extends TableImpl { */ public final TableField JDBC_PROTOCOL = createField(DSL.name("jdbc_protocol"), SQLDataType.VARCHAR(128).nullable(false), this, ""); + /** + * The column databasir.database_type.url_pattern. + */ + public final TableField URL_PATTERN = createField(DSL.name("url_pattern"), SQLDataType.VARCHAR(255).nullable(false), this, ""); + /** * The column databasir.database_type.deleted. */ @@ -185,11 +190,11 @@ public class DatabaseType extends TableImpl { } // ------------------------------------------------------------------------- - // Row11 type methods + // Row12 type methods // ------------------------------------------------------------------------- @Override - public Row11 fieldsRow() { - return (Row11) super.fieldsRow(); + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); } } diff --git a/dao/generated-src/jooq/main/java/com/databasir/dao/tables/pojos/DatabaseTypePojo.java b/dao/generated-src/jooq/main/java/com/databasir/dao/tables/pojos/DatabaseTypePojo.java index 9797d78..129bcf4 100644 --- a/dao/generated-src/jooq/main/java/com/databasir/dao/tables/pojos/DatabaseTypePojo.java +++ b/dao/generated-src/jooq/main/java/com/databasir/dao/tables/pojos/DatabaseTypePojo.java @@ -23,6 +23,7 @@ public class DatabaseTypePojo implements Serializable { private String jdbcDriverFileUrl; private String jdbcDriverClassName; private String jdbcProtocol; + private String urlPattern; private Boolean deleted; private Integer deletedToken; private LocalDateTime updateAt; @@ -38,6 +39,7 @@ public class DatabaseTypePojo implements Serializable { this.jdbcDriverFileUrl = value.jdbcDriverFileUrl; this.jdbcDriverClassName = value.jdbcDriverClassName; this.jdbcProtocol = value.jdbcProtocol; + this.urlPattern = value.urlPattern; this.deleted = value.deleted; this.deletedToken = value.deletedToken; this.updateAt = value.updateAt; @@ -52,6 +54,7 @@ public class DatabaseTypePojo implements Serializable { String jdbcDriverFileUrl, String jdbcDriverClassName, String jdbcProtocol, + String urlPattern, Boolean deleted, Integer deletedToken, LocalDateTime updateAt, @@ -64,6 +67,7 @@ public class DatabaseTypePojo implements Serializable { this.jdbcDriverFileUrl = jdbcDriverFileUrl; this.jdbcDriverClassName = jdbcDriverClassName; this.jdbcProtocol = jdbcProtocol; + this.urlPattern = urlPattern; this.deleted = deleted; this.deletedToken = deletedToken; this.updateAt = updateAt; @@ -170,6 +174,20 @@ public class DatabaseTypePojo implements Serializable { this.jdbcProtocol = jdbcProtocol; } + /** + * Getter for databasir.database_type.url_pattern. + */ + public String getUrlPattern() { + return this.urlPattern; + } + + /** + * Setter for databasir.database_type.url_pattern. + */ + public void setUrlPattern(String urlPattern) { + this.urlPattern = urlPattern; + } + /** * Getter for databasir.database_type.deleted. */ @@ -237,6 +255,7 @@ public class DatabaseTypePojo implements Serializable { sb.append(", ").append(jdbcDriverFileUrl); sb.append(", ").append(jdbcDriverClassName); sb.append(", ").append(jdbcProtocol); + sb.append(", ").append(urlPattern); sb.append(", ").append(deleted); sb.append(", ").append(deletedToken); sb.append(", ").append(updateAt); diff --git a/dao/generated-src/jooq/main/java/com/databasir/dao/tables/records/DatabaseTypeRecord.java b/dao/generated-src/jooq/main/java/com/databasir/dao/tables/records/DatabaseTypeRecord.java index 7728124..1326573 100644 --- a/dao/generated-src/jooq/main/java/com/databasir/dao/tables/records/DatabaseTypeRecord.java +++ b/dao/generated-src/jooq/main/java/com/databasir/dao/tables/records/DatabaseTypeRecord.java @@ -11,8 +11,8 @@ import java.time.LocalDateTime; import org.jooq.Field; import org.jooq.Record1; -import org.jooq.Record11; -import org.jooq.Row11; +import org.jooq.Record12; +import org.jooq.Row12; import org.jooq.impl.UpdatableRecordImpl; @@ -20,7 +20,7 @@ import org.jooq.impl.UpdatableRecordImpl; * customer database types */ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class DatabaseTypeRecord extends UpdatableRecordImpl implements Record11 { +public class DatabaseTypeRecord extends UpdatableRecordImpl implements Record12 { private static final long serialVersionUID = 1L; @@ -124,60 +124,74 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl return (String) get(6); } + /** + * Setter for databasir.database_type.url_pattern. + */ + public void setUrlPattern(String value) { + set(7, value); + } + + /** + * Getter for databasir.database_type.url_pattern. + */ + public String getUrlPattern() { + return (String) get(7); + } + /** * Setter for databasir.database_type.deleted. */ public void setDeleted(Boolean value) { - set(7, value); + set(8, value); } /** * Getter for databasir.database_type.deleted. */ public Boolean getDeleted() { - return (Boolean) get(7); + return (Boolean) get(8); } /** * Setter for databasir.database_type.deleted_token. */ public void setDeletedToken(Integer value) { - set(8, value); + set(9, value); } /** * Getter for databasir.database_type.deleted_token. */ public Integer getDeletedToken() { - return (Integer) get(8); + return (Integer) get(9); } /** * Setter for databasir.database_type.update_at. */ public void setUpdateAt(LocalDateTime value) { - set(9, value); + set(10, value); } /** * Getter for databasir.database_type.update_at. */ public LocalDateTime getUpdateAt() { - return (LocalDateTime) get(9); + return (LocalDateTime) get(10); } /** * Setter for databasir.database_type.create_at. */ public void setCreateAt(LocalDateTime value) { - set(10, value); + set(11, value); } /** * Getter for databasir.database_type.create_at. */ public LocalDateTime getCreateAt() { - return (LocalDateTime) get(10); + return (LocalDateTime) get(11); } // ------------------------------------------------------------------------- @@ -190,17 +204,17 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl } // ------------------------------------------------------------------------- - // Record11 type implementation + // Record12 type implementation // ------------------------------------------------------------------------- @Override - public Row11 fieldsRow() { - return (Row11) super.fieldsRow(); + public Row12 fieldsRow() { + return (Row12) super.fieldsRow(); } @Override - public Row11 valuesRow() { - return (Row11) super.valuesRow(); + public Row12 valuesRow() { + return (Row12) super.valuesRow(); } @Override @@ -239,22 +253,27 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl } @Override - public Field field8() { + public Field field8() { + return DatabaseType.DATABASE_TYPE.URL_PATTERN; + } + + @Override + public Field field9() { return DatabaseType.DATABASE_TYPE.DELETED; } @Override - public Field field9() { + public Field field10() { return DatabaseType.DATABASE_TYPE.DELETED_TOKEN; } @Override - public Field field10() { + public Field field11() { return DatabaseType.DATABASE_TYPE.UPDATE_AT; } @Override - public Field field11() { + public Field field12() { return DatabaseType.DATABASE_TYPE.CREATE_AT; } @@ -294,22 +313,27 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl } @Override - public Boolean component8() { + public String component8() { + return getUrlPattern(); + } + + @Override + public Boolean component9() { return getDeleted(); } @Override - public Integer component9() { + public Integer component10() { return getDeletedToken(); } @Override - public LocalDateTime component10() { + public LocalDateTime component11() { return getUpdateAt(); } @Override - public LocalDateTime component11() { + public LocalDateTime component12() { return getCreateAt(); } @@ -349,22 +373,27 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl } @Override - public Boolean value8() { + public String value8() { + return getUrlPattern(); + } + + @Override + public Boolean value9() { return getDeleted(); } @Override - public Integer value9() { + public Integer value10() { return getDeletedToken(); } @Override - public LocalDateTime value10() { + public LocalDateTime value11() { return getUpdateAt(); } @Override - public LocalDateTime value11() { + public LocalDateTime value12() { return getCreateAt(); } @@ -411,31 +440,37 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl } @Override - public DatabaseTypeRecord value8(Boolean value) { + public DatabaseTypeRecord value8(String value) { + setUrlPattern(value); + return this; + } + + @Override + public DatabaseTypeRecord value9(Boolean value) { setDeleted(value); return this; } @Override - public DatabaseTypeRecord value9(Integer value) { + public DatabaseTypeRecord value10(Integer value) { setDeletedToken(value); return this; } @Override - public DatabaseTypeRecord value10(LocalDateTime value) { + public DatabaseTypeRecord value11(LocalDateTime value) { setUpdateAt(value); return this; } @Override - public DatabaseTypeRecord value11(LocalDateTime value) { + public DatabaseTypeRecord value12(LocalDateTime value) { setCreateAt(value); return this; } @Override - public DatabaseTypeRecord values(Integer value1, String value2, String value3, String value4, String value5, String value6, String value7, Boolean value8, Integer value9, LocalDateTime value10, LocalDateTime value11) { + public DatabaseTypeRecord values(Integer value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, Boolean value9, Integer value10, LocalDateTime value11, LocalDateTime value12) { value1(value1); value2(value2); value3(value3); @@ -447,6 +482,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl value9(value9); value10(value10); value11(value11); + value12(value12); return this; } @@ -464,7 +500,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl /** * Create a detached, initialised DatabaseTypeRecord */ - public DatabaseTypeRecord(Integer id, String databaseType, String icon, String description, String jdbcDriverFileUrl, String jdbcDriverClassName, String jdbcProtocol, Boolean deleted, Integer deletedToken, LocalDateTime updateAt, LocalDateTime createAt) { + public DatabaseTypeRecord(Integer id, String databaseType, String icon, String description, String jdbcDriverFileUrl, String jdbcDriverClassName, String jdbcProtocol, String urlPattern, Boolean deleted, Integer deletedToken, LocalDateTime updateAt, LocalDateTime createAt) { super(DatabaseType.DATABASE_TYPE); setId(id); @@ -474,6 +510,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl setJdbcDriverFileUrl(jdbcDriverFileUrl); setJdbcDriverClassName(jdbcDriverClassName); setJdbcProtocol(jdbcProtocol); + setUrlPattern(urlPattern); setDeleted(deleted); setDeletedToken(deletedToken); setUpdateAt(updateAt); @@ -494,6 +531,7 @@ public class DatabaseTypeRecord extends UpdatableRecordImpl setJdbcDriverFileUrl(value.getJdbcDriverFileUrl()); setJdbcDriverClassName(value.getJdbcDriverClassName()); setJdbcProtocol(value.getJdbcProtocol()); + setUrlPattern(value.getUrlPattern()); setDeleted(value.getDeleted()); setDeletedToken(value.getDeletedToken()); setUpdateAt(value.getUpdateAt()); diff --git a/dao/src/main/resources/db/migration/V1.1__database_type.sql b/dao/src/main/resources/db/migration/V1.1__database_type.sql index 7332831..a5616b1 100644 --- a/dao/src/main/resources/db/migration/V1.1__database_type.sql +++ b/dao/src/main/resources/db/migration/V1.1__database_type.sql @@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS database_type jdbc_driver_file_url VARCHAR(1024) NOT NULL, jdbc_driver_class_name VARCHAR(255) NOT NULL, jdbc_protocol VARCHAR(128) NOT NULL, + url_pattern VARCHAR(255) NOT NULL, deleted BOOLEAN NOT NULL DEFAULT FALSE, deleted_token INT NOT NULL DEFAULT 0, update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -17,6 +18,6 @@ CREATE TABLE IF NOT EXISTS database_type REPLACE INTO databasir.database_type (id, database_type, icon, DESCRIPTION, jdbc_driver_file_url, jdbc_driver_class_name, - jdbc_protocol) -VALUES (1, 'mysql', '', 'system default mysql', 'N/A', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql'), - (2, 'postgresql', '', 'system default postgresql', 'N/A', 'org.postgresql.Driver', 'jdbc:postgresql'); + jdbc_protocol, url_pattern) +VALUES (1, 'mysql', '', 'system default mysql', 'N/A', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql', '{{jdbc.protocol}}://{{db.url}}/{{db.name}}'), + (2, 'postgresql', '', 'system default postgresql', 'N/A', 'org.postgresql.Driver', 'jdbc:postgresql', '{{jdbc.protocol}}://{{db.url}}/{{db.name}}');