Optimize the code

This commit is contained in:
sunkaixuan 2025-08-18 12:05:13 +08:00
parent ab8ec39f77
commit ba48aaf672
3 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,4 @@
using SqlSugar.Realization.PostgreSQL;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

View File

@ -509,7 +509,7 @@ WHERE tgrelid = '"+tableName+"'::regclass");
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower(isAutoToLowerCodeFirst)), dataType, dataSize, nullType, primaryKey, "");
if (item.IsIdentity)
{
if(identityStrategy == Realization.PostgreSQL.PostgresIdentityStrategy.Serial)
if(identityStrategy == PostgresIdentityStrategy.Serial)
{
if (dataType?.ToLower() == "int")
{
@ -523,7 +523,7 @@ WHERE tgrelid = '"+tableName+"'::regclass");
string identityDataType = "serial" + length;
addItem = addItem.Replace(dataType, identityDataType);
}
else if (identityStrategy == Realization.PostgreSQL.PostgresIdentityStrategy.Identity)
else if (identityStrategy == PostgresIdentityStrategy.Identity)
{
string length = dataType.Substring(dataType.Length - 1);
string identityDataType = "INT" + length + " GENERATED BY DEFAULT AS IDENTITY";

View File

@ -1,4 +1,4 @@
namespace SqlSugar.Realization.PostgreSQL
namespace SqlSugar
{
public enum PostgresIdentityStrategy
{