$ cd src/WebApp && dotnet run
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE TYPE audit.history_activity_type AS ENUM ('CREATE', 'UPDATE_BEFORE', 'UPDATE_AFTER', 'DELETE');
CREATE TYPE post_type AS ENUM ('question', 'answer', 'blog');
CREATE EXTENSION IF NOT EXISTS adminpack;
fail: Codidact.Core.WebApp.Startup[0]
Unable to apply database migrations. Check the connection string in your appsettings file.
crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
Application startup exception
Npgsql.PostgresException (0x80004005): 42501: permission denied to create extension "adminpack"
at Codidact.Core.WebApp.Startup.ApplyDatabaseMigrations(IApplicationBuilder app, ILogger logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 163
at Codidact.Core.WebApp.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger`1 logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 140
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Exception data:
Severity: ERROR
SqlState: 42501
MessageText: permission denied to create extension "adminpack"
Hint: Must be superuser to create this extension.
File: extension.c
Line: 806
Routine: execute_extension_script
Unhandled exception. Npgsql.PostgresException (0x80004005): 42501: permission denied to create extension "adminpack"
at Codidact.Core.WebApp.Startup.ApplyDatabaseMigrations(IApplicationBuilder app, ILogger logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 163
at Codidact.Core.WebApp.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger`1 logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 140
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Codidact.Core.WebApp.Program.Main(String[] args) in /home/me/dev/codidact/core/src/WebApp/Program.cs:line 13
at Codidact.Core.WebApp.Program.<Main>(String[] args)
Exception data:
Severity: ERROR
SqlState: 42501
MessageText: permission denied to create extension "adminpack"
Hint: Must be superuser to create this extension.
File: extension.c
Line: 806
Routine: execute_extension_script
I remember having a discussion somewhere, that some of the generated code referenced the "adminpack" extension somewhere. It is mentioned in some of the database migrations.
We should remove this from the migrations and find the cause of this issue.