Initial v6 version #32

Manually merged
toastie_t0ast merged 54 commits from v6-dev into v6 2025-02-28 23:18:39 +00:00
2 changed files with 13 additions and 37 deletions
Showing only changes of commit e97fbe64c5 - Show all commits

View file

@ -27,20 +27,15 @@ public sealed class EllieDbService : DbService
public override async Task SetupAsync()
{
var dbType = DbType;
var connString = ConnString;
await using var context = CreateRawDbContext(dbType, connString);
await RunMigration(context);
await using var context = CreateRawDbContext(DbType, ConnString);
// make sure sqlite db is in wal journal mode
if (context is SqliteContext)
{
await context.Database.ExecuteSqlRawAsync("PRAGMA journal_mode=WAL");
}
// await context.Database.MigrateAsync();
await RunMigration(context);
}
public override EllieContext CreateRawDbContext(string dbType, string connString)
@ -79,6 +74,7 @@ public sealed class EllieDbService : DbService
public override EllieContext GetDbContext()
=> GetDbContextInternal();
private static async Task RunMigration(DbContext ctx)
{
// if database doesn't exist, run the baseline migration
@ -101,7 +97,7 @@ public sealed class EllieDbService : DbService
var lastApplied = applied.Last();
Log.Information("Last applied migration: {LastApplied}", lastApplied);
// apply all mirations with names greater than the last applied
// apply all migrations with names greater than the last applied
foreach (var runnable in available)
{
if (string.Compare(lastApplied, runnable, StringComparison.Ordinal) < 0)

View file

@ -43,35 +43,15 @@ fi
echo "Cleaning up all migration files..."
# Step 3: Clean up migration files by removing everything except
for file in "Migrations/Sqlite"/*; do
# Skip directories
if [[ ! -f "$file" ]]; then
continue
fi
case "$file" in
*.cs)
echo "Deleting: $(basename "$file")"
rm -- "$file"
;;
esac
# Step 3: Clean up migration files by removing everything
for file in "Migrations/Sqlite/"*.cs; do
echo "Deleting: $(basename "$file")"
rm -- "$file"
done
for file in "Migrations/Postgresql"/*; do
# Skip directories
if [[ ! -f "$file" ]]; then
continue
fi
case "$file" in
*.cs)
echo "Deleting: $(basename "$file")"
rm -- "$file"
;;
esac
for file in "Migrations/Postgresql/"*.cs; do
echo "Deleting: $(basename "$file")"
rm -- "$file"
done
# Step 4: Adding new initial migration