Skip to content

Commit ed4df46

Browse files
authored
Merge pull request #217 from dotnetcore/master
检测表是否存在的时候忽略大小写
2 parents f7a3e9c + 20895eb commit ed4df46

29 files changed

+410
-306
lines changed

src/AgileConfig.Server.Apisite/AgileConfig.Server.Apisite.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
6-
<AssemblyVersion>1.9.12</AssemblyVersion>
7-
<Version>1.9.12</Version>
8-
<PackageVersion>1.9.12</PackageVersion>
6+
<AssemblyVersion>1.9.13</AssemblyVersion>
7+
<Version>1.9.13</Version>
8+
<PackageVersion>1.9.13</PackageVersion>
99
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
10-
<FileVersion>1.9.12</FileVersion>
10+
<FileVersion>1.9.13</FileVersion>
1111
<Authors>kklldog</Authors>
1212
<Company>kklldog</Company>
1313
</PropertyGroup>

src/AgileConfig.Server.Data.Freesql/EnsureTables.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@
22
using AgileConfig.Server.Data.Entity;
33
using Microsoft.Extensions.Logging;
44
using System;
5-
using System.Collections.Generic;
6-
using System.Text;
75

86
namespace AgileConfig.Server.Data.Freesql
97
{
108
public class EnsureTables
119
{
1210
private const string Sqlite_ExistTableSql =
13-
"SELECT count(1) FROM sqlite_master WHERE type='table' AND name = 'agc_app'";
11+
"SELECT count(1) FROM sqlite_master WHERE type='table' AND (name = 'agc_app' OR name = 'AGC_APP')";
1412

1513
private const string Mysql_ExistTableSql =
16-
" SELECT count(1) FROM information_schema.TABLES WHERE table_schema= @schema AND table_name ='agc_app'";
14+
" SELECT count(1) FROM information_schema.TABLES WHERE table_schema= @schema AND (table_name ='agc_app' OR table_name='AGC_APP')";
1715

1816
private const string SqlServer_ExistTableSql =
1917
"SELECT COUNT(1) FROM dbo.sysobjects WHERE ID = object_id(N'[dbo].[agc_app]') and OBJECTPROPERTY(id, N'IsUserTable') = 1";
2018

21-
private const string Oracle_ExistTableSql = "select count(1) from user_tables where table_name = 'agc_app'";
22-
private const string PostgreSql_ExistTableSql = "select count(1) from pg_class where relname = 'agc_app'";
19+
private const string Oracle_ExistTableSql = "select count(1) from user_tables where table_name = 'agc_app' or table_name = 'AGC_APP'";
20+
21+
private const string PostgreSql_ExistTableSql = "select count(1) from pg_class where relname = 'agc_app' or relname = 'AGC_APP'";
2322

2423
public static bool ExistTable(IFreeSql instance)
2524
{

src/AgileConfig.Server.Data.Repository.Freesql/AgileConfig.Server.Data.Repository.Freesql.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
6+
<Nullable>disable</Nullable>
77
</PropertyGroup>
88

99
<ItemGroup>

src/AgileConfig.Server.Data.Repository.Freesql/FreesqlRepositoryServiceRegister.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,26 @@ public void AddFixedRepositories(IServiceCollection sc)
2222

2323
public T GetServiceByEnv<T>(IServiceProvider sp, string env) where T : class
2424
{
25+
var factory = sp.GetService<IFreeSqlFactory>();
26+
2527
if (typeof(T) == typeof(IUow))
2628
{
27-
var factory = sp.GetService<IFreeSqlFactory>();
28-
var fsq = factory.Create(env);
29-
return (new FreeSqlUow(fsq)) as T;
29+
return (new FreeSqlUow(factory.Create(env))) as T;
3030
}
3131
if (typeof(T) == typeof(IConfigPublishedRepository))
3232
{
33-
var factory = sp.GetService<IFreeSqlFactory>();
3433
return new ConfigPublishedRepository(factory.Create(env)) as T;
3534
}
3635
if (typeof(T) == typeof(IConfigRepository))
3736
{
38-
var factory = sp.GetService<IFreeSqlFactory>();
3937
return new ConfigRepository(factory.Create(env)) as T;
4038
}
4139
if (typeof(T) == typeof(IPublishDetailRepository))
4240
{
43-
var factory = sp.GetService<IFreeSqlFactory>();
4441
return new PublishDetailRepository(factory.Create(env)) as T;
4542
}
4643
if (typeof(T) == typeof(IPublishTimelineRepository))
4744
{
48-
var factory = sp.GetService<IFreeSqlFactory>();
4945
return new PublishTimelineRepository(factory.Create(env)) as T;
5046
}
5147

@@ -56,7 +52,7 @@ public bool IsSuit4Provider(string provider)
5652
{
5753
var freesqlType = MyFreeSQL.ProviderToFreesqlDbType(provider);
5854

59-
return freesqlType.HasValue;
55+
return freesqlType.HasValue ;
6056
}
6157
}
6258
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using AgileConfig.Server.Common.EventBus;
2+
using AgileConfig.Server.Data.Entity;
3+
4+
namespace AgileConfig.Server.Event
5+
{
6+
public class AddAppSuccessful : IEvent
7+
{
8+
public AddAppSuccessful(App app, string userName)
9+
{
10+
App = app;
11+
UserName = userName;
12+
}
13+
14+
public App App { get; }
15+
public string UserName { get; }
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using AgileConfig.Server.Common.EventBus;
2+
using AgileConfig.Server.Data.Entity;
3+
4+
namespace AgileConfig.Server.Event
5+
{
6+
public class AddConfigSuccessful : IEvent
7+
{
8+
public AddConfigSuccessful(Config config, string userName)
9+
{
10+
Config = config;
11+
UserName = userName;
12+
}
13+
14+
public Config Config { get; }
15+
public string UserName { get; }
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using AgileConfig.Server.Common.EventBus;
2+
using AgileConfig.Server.Data.Entity;
3+
4+
namespace AgileConfig.Server.Event
5+
{
6+
public class AddNodeSuccessful : IEvent
7+
{
8+
public AddNodeSuccessful(ServerNode node, string userName)
9+
{
10+
Node = node;
11+
UserName = userName;
12+
}
13+
14+
public ServerNode Node { get; }
15+
public string UserName { get; }
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using AgileConfig.Server.Common.EventBus;
2+
using AgileConfig.Server.Data.Entity;
3+
4+
namespace AgileConfig.Server.Event
5+
{
6+
public class AddUserSuccessful : IEvent
7+
{
8+
public AddUserSuccessful(User user, string userName)
9+
{
10+
User = user;
11+
UserName = userName;
12+
}
13+
14+
public User User { get; }
15+
public string UserName { get; }
16+
}
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using AgileConfig.Server.Common.EventBus;
2+
using AgileConfig.Server.Data.Entity;
3+
4+
namespace AgileConfig.Server.Event
5+
{
6+
public class CancelEditConfigSomeSuccessful : IEvent
7+
{
8+
public CancelEditConfigSomeSuccessful(Config config, string userName)
9+
{
10+
Config = config;
11+
UserName = userName;
12+
}
13+
14+
public Config Config { get; }
15+
public string UserName { get; }
16+
17+
public string Env { get; set; }
18+
}
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using AgileConfig.Server.Common.EventBus;
2+
using AgileConfig.Server.Data.Entity;
3+
4+
namespace AgileConfig.Server.Event
5+
{
6+
public class CancelEditConfigSuccessful : IEvent
7+
{
8+
public CancelEditConfigSuccessful(Config config, string userName)
9+
{
10+
Config = config;
11+
UserName = userName;
12+
}
13+
14+
public Config Config { get; }
15+
public string UserName { get; }
16+
}
17+
}

0 commit comments

Comments
 (0)