From a8b59aac753f55b219492813f4dcbc032d6f7576 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 8 Jun 2023 17:03:02 +0800 Subject: [PATCH] Synchronization code --- .../DbMaintenance/PostgreSQLDbMaintenance.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs index d4aa6f0d6..926b4efa4 100644 --- a/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; namespace SqlSugar { @@ -261,7 +262,15 @@ namespace SqlSugar } public override bool AddDefaultValue(string tableName, string columnName, string defaultValue) { - return base.AddDefaultValue(this.SqlBuilder.GetTranslationTableName(tableName), this.SqlBuilder.GetTranslationTableName(columnName), defaultValue); + if (defaultValue?.StartsWith("'")==true&& defaultValue?.EndsWith("'") == true&& defaultValue?.Contains("(") == false) + { + string sql = string.Format(AddDefaultValueSql, tableName, columnName, defaultValue); + return this.Context.Ado.ExecuteCommand(sql) > 0; + } + else + { + return base.AddDefaultValue(this.SqlBuilder.GetTranslationTableName(tableName), this.SqlBuilder.GetTranslationTableName(columnName), defaultValue); + } } public override bool AddColumnRemark(string columnName, string tableName, string description) {