Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup crash: Relation "musician" does not exist #715

Closed
Jargendas opened this issue Apr 25, 2023 · 4 comments · Fixed by #718
Closed

Startup crash: Relation "musician" does not exist #715

Jargendas opened this issue Apr 25, 2023 · 4 comments · Fixed by #718
Labels
bug Something isn't working

Comments

@Jargendas
Copy link
Contributor

Hi, great project! I'm currently trying to install Arpa for my choir using Docker. I think I got the frontend running, but I was not yet able to run the backend due to a database problem during startup with docker-compose up:

postgres_1  | 2023-04-25 01:18:53.608 UTC [30] ERROR:  relation "musician" does not exist at character 390
postgres_1  | 2023-04-25 01:18:53.608 UTC [30] STATEMENT:  create or replace View user_appointments_for_projects as
postgres_1  | 	-- Termine, bei denen Projekte angegeben sind, für die der User mit mindestens einem Musikerprofil angemeldet ist
postgres_1  | 	select m.given_name, m.surname, m.person_id, m.mp_id, a.id, a.name, a.public_details, a.internal_details, a.start_time, a.end_time
postgres_1  | 	  from appointments a, project_appointments pa, projects p, project_participations pp, musician m
postgres_1  | 	 where a.id=pa.appointment_id and pa.project_id=p.id and p.id=pp.project_id and pp.musician_profile_id=m.mp_id 
postgres_1  | 	   and a.deleted=false and pa.deleted=false and p.deleted=false and pp.deleted=false and p.is_hidden_for_performers = false
postgres_1  | 	   and (a.status <> 'Refused' OR a.status is null)
postgres_1  | 	   AND (pp.participation_status_inner <> 'Refusal' OR pp.participation_status_inner is null)
postgres_1  | 	   AND (pp.participation_status_internal <> 'Refusal' OR pp.participation_status_internal is null)
postgres_1  | 	   AND (p.status <> 'Cancelled' OR p.status is null)
postgres_1  | 	
api_1       | 2023-04-25 01:18:53.6170|ERROR||Microsoft.EntityFrameworkCore.Database.Command|Failed executing DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
api_1       | create or replace View user_appointments_for_projects as
api_1       | -- Termine, bei denen Projekte angegeben sind, für die der User mit mindestens einem Musikerprofil angemeldet ist
api_1       | select m.given_name, m.surname, m.person_id, m.mp_id, a.id, a.name, a.public_details, a.internal_details, a.start_time, a.end_time
api_1       |   from appointments a, project_appointments pa, projects p, project_participations pp, musician m
api_1       |  where a.id=pa.appointment_id and pa.project_id=p.id and p.id=pp.project_id and pp.musician_profile_id=m.mp_id 
api_1       |    and a.deleted=false and pa.deleted=false and p.deleted=false and pp.deleted=false and p.is_hidden_for_performers = false
api_1       |    and (a.status <> 'Refused' OR a.status is null)
api_1       |    AND (pp.participation_status_inner <> 'Refusal' OR pp.participation_status_inner is null)
api_1       |    AND (pp.participation_status_internal <> 'Refusal' OR pp.participation_status_internal is null)
api_1       |    AND (p.status <> 'Cancelled' OR p.status is null)
api_1       | ;|url: |action: |exception: 
api_1       | 2023-04-25 01:18:53.6198|ERROR||Orso.Arpa.Api.Startup|An error occured during database migration|url: |action: |exception: Npgsql.PostgresException (0x80004005): 42P01: relation "musician" does not exist
api_1       | 
api_1       | POSITION: 390
api_1       |    at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|233_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
api_1       |    at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRawAsync(DatabaseFacade databaseFacade, String sql, IEnumerable`1 parameters, CancellationToken cancellationToken)
api_1       |    at Orso.Arpa.Persistence.DataAccess.ArpaContext.ExecuteSqlAsync(String sqlStatement) in /home/app/Orso.Arpa.Persistence/DataAccess/ArpaContext.cs:line 337
api_1       |    at Orso.Arpa.Persistence.DataSeeder.SeedViewsAndFunctionsAsync() in /home/app/Orso.Arpa.Persistence/DataSeeder.cs:line 53
api_1       |    at Orso.Arpa.Persistence.DataSeeder.SeedDataAsync() in /home/app/Orso.Arpa.Persistence/DataSeeder.cs:line 44
api_1       |   Exception data:
api_1       |     Severity: ERROR
api_1       |     SqlState: 42P01
api_1       |     MessageText: relation "musician" does not exist
api_1       |     Position: 390
api_1       |     File: parse_relation.c
api_1       |     Line: 1177
api_1       |     Routine: parserOpenTable
api_1       | 2023-04-25 01:18:53.6363|FATAL||Microsoft.AspNetCore.Hosting.Diagnostics|Application startup exception|url: |action: |exception: Npgsql.PostgresException (0x80004005): 42P01: relation "musician" does not exist
api_1       | 
api_1       | POSITION: 390
api_1       |    at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|233_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
api_1       |    at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRawAsync(DatabaseFacade databaseFacade, String sql, IEnumerable`1 parameters, CancellationToken cancellationToken)
api_1       |    at Orso.Arpa.Persistence.DataAccess.ArpaContext.ExecuteSqlAsync(String sqlStatement) in /home/app/Orso.Arpa.Persistence/DataAccess/ArpaContext.cs:line 337
api_1       |    at Orso.Arpa.Persistence.DataSeeder.SeedViewsAndFunctionsAsync() in /home/app/Orso.Arpa.Persistence/DataSeeder.cs:line 53
api_1       |    at Orso.Arpa.Persistence.DataSeeder.SeedDataAsync() in /home/app/Orso.Arpa.Persistence/DataSeeder.cs:line 44
api_1       |   Exception data:
api_1       |     Severity: ERROR
api_1       |     SqlState: 42P01
api_1       |     MessageText: relation "musician" does not exist
api_1       |     Position: 390
api_1       |     File: parse_relation.c
api_1       |     Line: 1177
api_1       |     Routine: parserOpenTable
api_1       | Unhandled exception. System.AggregateException: One or more errors occurred. (42P01: relation "musician" does not exist
api_1       | 
api_1       | POSITION: 390)
api_1       |  ---> Npgsql.PostgresException (0x80004005): 42P01: relation "musician" does not exist
api_1       | 
api_1       | POSITION: 390
api_1       |    at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|233_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
api_1       |    at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
api_1       |    at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQueryAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
api_1       |    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRawAsync(DatabaseFacade databaseFacade, String sql, IEnumerable`1 parameters, CancellationToken cancellationToken)
api_1       |    at Orso.Arpa.Persistence.DataAccess.ArpaContext.ExecuteSqlAsync(String sqlStatement) in /home/app/Orso.Arpa.Persistence/DataAccess/ArpaContext.cs:line 337
api_1       |    at Orso.Arpa.Persistence.DataSeeder.SeedViewsAndFunctionsAsync() in /home/app/Orso.Arpa.Persistence/DataSeeder.cs:line 53
api_1       |    at Orso.Arpa.Persistence.DataSeeder.SeedDataAsync() in /home/app/Orso.Arpa.Persistence/DataSeeder.cs:line 44
api_1       |   Exception data:
api_1       |     Severity: ERROR
api_1       |     SqlState: 42P01
api_1       |     MessageText: relation "musician" does not exist
api_1       |     Position: 390
api_1       |     File: parse_relation.c
api_1       |     Line: 1177
api_1       |     Routine: parserOpenTable
api_1       |    --- End of inner exception stack trace ---
api_1       |    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
api_1       |    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
api_1       |    at System.Threading.Tasks.Task.Wait()
api_1       |    at Orso.Arpa.Api.Startup.EnsureDatabaseMigrations(IApplicationBuilder app) in /home/app/Orso.Arpa.Api/Startup.cs:line 525
api_1       |    at Orso.Arpa.Api.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in /home/app/Orso.Arpa.Api/Startup.cs:line 471
api_1       |    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
api_1       |    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
api_1       |    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
api_1       |    at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
api_1       |    at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
api_1       |    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
api_1       |    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
api_1       |    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
api_1       |    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
api_1       |    at Orso.Arpa.Api.Program.Main(String[] args) in /home/app/Orso.Arpa.Api/Program.cs:line 26

What can I do about that?

@wolfgangroese
Copy link
Member

wolfgangroese commented Apr 26, 2023 via email

@Jargendas
Copy link
Contributor Author

Hi Wolf,

it's for the CM, we've had a small e-mail contact about it before, but I thought I would make this an official issue in case someone else has the same problem in the future, I hope that's okay. 🙂

I am aware that it's not yet fully production ready, but I think it still makes sense to start using it and giving feedback early.

I think the problem might come from the fresh setup (vs. continuously updating the dev system), maybe the database is not generated correctly from scratch? Just a wild guess, I have no experience with .NET.

Should have added before: I'm working on an Ubuntu 22.04 Server with Docker 23.0.4.

@wolfgangroese
Copy link
Member

wolfgangroese commented Apr 28, 2023 via email

@Jargendas
Copy link
Contributor Author

Jargendas commented Apr 28, 2023

Hi Wolf,
unfortunately, the mentioned screenshot seems to not have been properly attached, could you please send that again.

Sure, if you prefer we can switch to German and to another platform. And yes, I sing in the grand choir of the CM, bass. :)

@wolfgangroese wolfgangroese added the bug Something isn't working label May 1, 2023
wolfgangroese added a commit that referenced this issue May 3, 2023
At least in my environment (Docker on Ubuntu 22.04), the SQL scripts for
database creation were executed in the wrong order (I assume "last
edited"), which resulted in dependency errors. This small change ensures
they are executed in the right order. Fixes #715.

Co-authored-by: Wolfgang Roese <wolfgang.roese@orso.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants