mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-20 00:44:19 +08:00
Optimize the code
This commit is contained in:
parent
ab8ec39f77
commit
ba48aaf672
@ -1,5 +1,4 @@
|
||||
using SqlSugar.Realization.PostgreSQL;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -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";
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace SqlSugar.Realization.PostgreSQL
|
||||
namespace SqlSugar
|
||||
{
|
||||
public enum PostgresIdentityStrategy
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user