removed unneeded migrate scripts, intiial version of init migration and cleanup.sql

This commit is contained in:
Toastie 2025-01-29 23:02:21 +13:00
parent 5450d40bae
commit 5cb344455a
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
6 changed files with 4 additions and 58 deletions

View file

@ -1 +0,0 @@

View file

@ -330,4 +330,5 @@ ALTER TABLE permissions ADD CONSTRAINT fk_permissions_guildconfigs_guildconfigid
INSERT INTO "__EFMigrationsHistory" (migrationid, productversion)
VALUES ('20250126062816_cleanup', '8.0.8');
COMMIT;
COMMIT;

View file

@ -759,4 +759,5 @@ CREATE INDEX "IX_GuildConfigs_WarnExpireHours" ON "GuildConfigs" ("WarnExpireHou
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
VALUES ('20250126062816_cleanup', '8.0.8');
COMMIT;
COMMIT;

View file

@ -4,7 +4,6 @@ using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EllieBot.Common.ModuleBehaviors;
using EllieBot.Db.Models;
using EllieBot.Migrations;
using System.Threading.Channels;
namespace EllieBot.Modules.Administration.Services;

View file

@ -1,49 +0,0 @@
# WORK IN PROGRESS
# Define the folders to search for designer.cs files
$folders = @("Migrations/PostgreSql", "Migrations/Sqlite")
# Loop through each folder
foreach ($folder in $folders) {
# Get all designer.cs files in the folder and subfolders
$files = Get-ChildItem -Path $folder -Filter *.designer.cs -Recurse
$excludedPattern = "cleanup|mysql-init|squash|rero-cascade"
$filteredFiles = $files | Where-Object { $_.Name -notmatch $excludedPattern }
# Loop through each file
foreach ($file in ($files | Where-Object { $_.Name -notmatch $excludedPattern })) {
# Read the contents of the file
$content = Get-Content -Path $file.FullName | Select-Object -First 30
# Find the attribute lines
$attributes = $content | Where-Object { $_ -match '\[.*\]' } | ForEach-Object { ' ' + $_.Trim() }
# Find the namespace
$namespace = $content | Where-Object { $_ -match 'namespace' } | ForEach-Object { $_.Split(' ')[1] }
# Find the class name
$class_name = $content | Where-Object { $_ -match 'partial class' } | ForEach-Object { $_.Trim().Split(' ')[2] }
# Replace the contents with the new template
$new_content = @"
// <auto-generated />
using EllieBot.Db;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace $namespace
{
$($attributes -join "`n")
partial class $class_name
{
}
}
"@
# Write the new contents to the file
Set-Content -Path $file.FullName -Value $new_content
}
}

View file

@ -1,5 +0,0 @@
# get the last file in the migrations folder ending with .sql and remove it
# order files by name
Get-ChildItem -Path "Migrations/Sqlite" -Filter *.sql -Recurse | Sort-Object Name | Select-Object -Last 1 | Remove-Item
Get-ChildItem -Path "Migrations/PostgreSql" -Filter *.sql -Recurse | Sort-Object Name | Select-Object -Last 1 | Remove-Item