From 1ce06635178e3d85955db7117e36d86bbbee94a5 Mon Sep 17 00:00:00 2001 From: Geronimo Romney Date: Wed, 20 Oct 2021 01:01:25 +0800 Subject: [PATCH 1/2] Update to .NET 5 resolves #233 --- AppServices/AppServices.csproj | 5 ++--- Domain/Domain.csproj | 2 +- Migrations/Migrations.csproj | 6 +++--- Migrations/Scripts/up.sh | 2 +- Web/Web.csproj | 20 +++++++++++--------- init.bat | 4 ++-- init.sh | 4 ++-- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/AppServices/AppServices.csproj b/AppServices/AppServices.csproj index 6d831f8..6bf6dc1 100644 --- a/AppServices/AppServices.csproj +++ b/AppServices/AppServices.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 @@ -18,7 +18,6 @@ - - + diff --git a/Domain/Domain.csproj b/Domain/Domain.csproj index b71c5c5..d803f83 100644 --- a/Domain/Domain.csproj +++ b/Domain/Domain.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + net5.0 diff --git a/Migrations/Migrations.csproj b/Migrations/Migrations.csproj index 41369d5..322d049 100644 --- a/Migrations/Migrations.csproj +++ b/Migrations/Migrations.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + net5.0 @@ -9,8 +9,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Migrations/Scripts/up.sh b/Migrations/Scripts/up.sh index a060833..67ad26a 100644 --- a/Migrations/Scripts/up.sh +++ b/Migrations/Scripts/up.sh @@ -1,3 +1,3 @@ dotnet restore ../Migrations.csproj dotnet build ../Migrations.csproj -dotnet fm migrate -p sqlite -c "Data Source=../../mydb.db" -a "../bin/Debug/netcoreapp3.1/Migrations.dll" \ No newline at end of file +dotnet fm migrate -p sqlite -c "Data Source=../../mydb.db" -a "../bin/Debug/net5.0/Migrations.dll" \ No newline at end of file diff --git a/Web/Web.csproj b/Web/Web.csproj index b4473d2..75db83c 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -1,15 +1,15 @@ - - netcoreapp3.1 + net5.0 - - + + - + + @@ -17,7 +17,6 @@ - @@ -26,10 +25,13 @@ - - + + + all + + @@ -70,4 +72,4 @@ - + \ No newline at end of file diff --git a/init.bat b/init.bat index bae579b..370cac7 100644 --- a/init.bat +++ b/init.bat @@ -1,6 +1,6 @@ ::# Getting Fluent Migrator CLI to Run Migrations -dotnet tool install -g FluentMigrator.DotNet.Cli --version 3.2.1 +dotnet tool install -g FluentMigrator.DotNet.Cli --version 3.3.1 ::# Update Fluent Migrator CLI dotnet tool upgrade -g FluentMigrator.DotNet.Cli @@ -19,6 +19,6 @@ libman restore cd ../Migrations dotnet restore Migrations.csproj dotnet build Migrations.csproj -dotnet fm migrate -p sqlite -c "Data Source=../mydb.db" -a "bin/Debug/netcoreapp2.2/Migrations.dll" +dotnet fm migrate -p sqlite -c "Data Source=../mydb.db" -a "bin/Debug/net5.0/Migrations.dll" cd ../ \ No newline at end of file diff --git a/init.sh b/init.sh index ea2f224..9adfb3a 100644 --- a/init.sh +++ b/init.sh @@ -1,6 +1,6 @@ # Getting Fluent Migrator CLI to Run Migrations -dotnet tool install -g FluentMigrator.DotNet.Cli --version 3.2.7 +dotnet tool install -g FluentMigrator.DotNet.Cli --version 3.3.1 #Getting libman CLI for js package management dotnet tool install -g Microsoft.Web.LibraryManager.Cli @@ -16,6 +16,6 @@ libman restore cd ../Migrations dotnet restore Migrations.csproj dotnet build Migrations.csproj -dotnet fm migrate -p sqlite -c "Data Source=../mydb.db" -a "bin/Debug/netcoreapp2.2/Migrations.dll" +dotnet fm migrate -p sqlite -c "Data Source=../mydb.db" -a "bin/Debug/net5.0/Migrations.dll" cd ../ From 46cc899d9ebe4114f5940f41566108de9e770edc Mon Sep 17 00:00:00 2001 From: Geronimo Romney Date: Tue, 19 Oct 2021 16:53:43 -0400 Subject: [PATCH 2/2] migration that makes Url COLUMN null. fixes #232 --- ...1404_modifying_company_tbl_nullable_url.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Migrations/202110191404_modifying_company_tbl_nullable_url.cs diff --git a/Migrations/202110191404_modifying_company_tbl_nullable_url.cs b/Migrations/202110191404_modifying_company_tbl_nullable_url.cs new file mode 100644 index 0000000..6888cdb --- /dev/null +++ b/Migrations/202110191404_modifying_company_tbl_nullable_url.cs @@ -0,0 +1,50 @@ +using System; +using Domain.Framework.Constants; +using FluentMigrator; +using FluentMigrator.SqlServer; +using Migrations.Framework; + +[Migration(202110191404)] +public class _202110191404_modifying_company_tbl_nullable_url : Migration +{ + public override void Down() + { + Alter.Column("Url").OnTable(TableConstants.Companies) + .AsString() + .NotNullable(); + } + + public override void Up() + { + +#if DEBUG + // There's no ALTER COLUMN in sqlite + //TODO: remove dummy data from migration + Delete.Table(TableConstants.Companies); + Create.Table(TableConstants.Companies) + .WithCommonColumns() + .WithColumn("Name").AsString().NotNullable() + .WithColumn("Url").AsString().Nullable() + .WithColumn("Email").AsString().NotNullable() + .WithColumn("LogoUrl").AsString().NotNullable() + .WithColumn("UserId").AsInt32().Nullable(); + + Insert.IntoTable(TableConstants.Companies) + .WithIdentityInsert() + .Row(new + { + Id = -1, + Name = "Megsoft", + CreatedAt = DateTime.UtcNow, + Email = "claudio@megsoftconsulting.com", + Url = "https://megsoftconsulting.com", + LogoUrl = "https://megsoftconsulting.com/wp-content/uploads/2018/08/my_business.png", + UserId = -1 + }); +#else + Alter.Column("Url").OnTable(TableConstants.Companies) + .AsString() + .Nullable(); +#endif + } +} \ No newline at end of file