Compare commits
@@ -105,7 +105,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
docker.io/${{ vars.DOCKERHUB_IMAGE }}
|
docker.io/${{ vars.DOCKERHUB_IMAGE }}
|
||||||
git.biss.click/biss/exam-information-system
|
git.biss.click/biss/eis-dotnet
|
||||||
flavor: latest=auto
|
flavor: latest=auto
|
||||||
tags: |
|
tags: |
|
||||||
type=sha,format=short,prefix=sha-
|
type=sha,format=short,prefix=sha-
|
||||||
@@ -158,5 +158,5 @@ jobs:
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
docker pull docker.io/${{ vars.DOCKERHUB_IMAGE }}:${{ steps.metadata.outputs.version }}
|
docker pull docker.io/${{ vars.DOCKERHUB_IMAGE }}:${{ steps.metadata.outputs.version }}
|
||||||
docker pull git.biss.click/biss/exam-information-system:${{ steps.metadata.outputs.version }}
|
docker pull git.biss.click/biss/eis-dotnet:${{ steps.metadata.outputs.version }}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ internal sealed class AuthenticationRepository(IRelationalConnectionFactory conn
|
|||||||
}
|
}
|
||||||
|
|
||||||
const string ruleSql = """
|
const string ruleSql = """
|
||||||
SELECT id, separator FROM number_rules
|
SELECT id, `separator` FROM number_rules
|
||||||
WHERE active = 1 ORDER BY updated_at DESC, id LIMIT 1
|
WHERE active = 1 ORDER BY updated_at DESC, id LIMIT 1
|
||||||
""";
|
""";
|
||||||
string? ruleId = null;
|
string? ruleId = null;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ internal sealed class DatabaseInitializer(
|
|||||||
if (await ScalarLongAsync(connection, "SELECT COUNT(*) FROM number_rules", transaction, cancellationToken) > 0) return;
|
if (await ScalarLongAsync(connection, "SELECT COUNT(*) FROM number_rules", transaction, cancellationToken) > 0) return;
|
||||||
await ExecuteAsync(connection,
|
await ExecuteAsync(connection,
|
||||||
"""
|
"""
|
||||||
INSERT INTO number_rules (id, name, separator, active, created_by, updated_at)
|
INSERT INTO number_rules (id, name, `separator`, active, created_by, updated_at)
|
||||||
VALUES ('rule_default', @name, '-', 1, 'usr_admin', @updatedAt)
|
VALUES ('rule_default', @name, '-', 1, 'usr_admin', @updatedAt)
|
||||||
""",
|
""",
|
||||||
[("@name", "年度学校性别流水号"), ("@updatedAt", now)], transaction, cancellationToken);
|
[("@name", "年度学校性别流水号"), ("@updatedAt", now)], transaction, cancellationToken);
|
||||||
@@ -158,7 +158,7 @@ internal sealed class DatabaseInitializer(
|
|||||||
await ExecuteAsync(connection,
|
await ExecuteAsync(connection,
|
||||||
"""
|
"""
|
||||||
INSERT INTO admission_number_rules (
|
INSERT INTO admission_number_rules (
|
||||||
id, code, name, description, separator, segments_json, example, active, created_at
|
id, code, name, description, `separator`, segments_json, example, active, created_at
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@id, @code, @name, @description, '', @segments, @example, 1, @createdAt
|
@id, @code, @name, @description, '', @segments, @example, 1, @createdAt
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ public sealed class DatabaseInitializerTests
|
|||||||
"SELECT schema_version FROM schema_metadata WHERE id = 1"));
|
"SELECT schema_version FROM schema_metadata WHERE id = 1"));
|
||||||
Assert.Equal(1, await ScalarAsync(connection,
|
Assert.Equal(1, await ScalarAsync(connection,
|
||||||
"SELECT COUNT(*) FROM users WHERE id = 'usr_admin' AND role = 'admin' AND admin_level = 'super'"));
|
"SELECT COUNT(*) FROM users WHERE id = 'usr_admin' AND role = 'admin' AND admin_level = 'super'"));
|
||||||
|
Assert.Equal("-", await ScalarTextAsync(connection,
|
||||||
|
"SELECT `separator` FROM number_rules WHERE id = 'rule_default'"));
|
||||||
Assert.Equal(5, await ScalarAsync(connection,
|
Assert.Equal(5, await ScalarAsync(connection,
|
||||||
"SELECT COUNT(*) FROM workflow_definitions WHERE active = 1"));
|
"SELECT COUNT(*) FROM workflow_definitions WHERE active = 1"));
|
||||||
Assert.Equal(4, await ScalarAsync(connection,
|
Assert.Equal(4, await ScalarAsync(connection,
|
||||||
@@ -73,6 +75,13 @@ public sealed class DatabaseInitializerTests
|
|||||||
return Convert.ToInt64(await command.ExecuteScalarAsync());
|
return Convert.ToInt64(await command.ExecuteScalarAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async Task<string> ScalarTextAsync(SqliteConnection connection, string sql)
|
||||||
|
{
|
||||||
|
await using var command = connection.CreateCommand();
|
||||||
|
command.CommandText = sql;
|
||||||
|
return Convert.ToString(await command.ExecuteScalarAsync()) ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<string> ReadResourceAsync(System.Reflection.Assembly assembly, string name)
|
private static async Task<string> ReadResourceAsync(System.Reflection.Assembly assembly, string name)
|
||||||
{
|
{
|
||||||
await using var stream = assembly.GetManifestResourceStream(name)
|
await using var stream = assembly.GetManifestResourceStream(name)
|
||||||
|
|||||||
Reference in New Issue
Block a user