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/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 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 ../