removed unneeded migrate scripts, intiial version of init migration and cleanup.sql
This commit is contained in:
parent
5450d40bae
commit
5cb344455a
6 changed files with 4 additions and 58 deletions
src/EllieBot
|
@ -1 +0,0 @@
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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
|
Loading…
Add table
Reference in a new issue