Project

General

Profile

createTables throws, but no Tables exist

Added by Christian Meyer over 3 years ago

Hello

Trying to implement Postgre Dbo Backend in Docker environment

Connection is working somehow, but the Tables are not created.

I had massive Problems getting sqlite to work in same Docker Container, so I switched to PostgreSQL

after getting the connection string right and the db container running, I can't get the tables to be created.

createTables throws exception

DB Container throws

app_1           | [2020-Nov-19 02:16:12.896] 1 [/ e7rJ8PiR9pRmcqRx] [notice] "pre createTables()"
app_1           | [2020-Nov-19 02:16:12.898] 1 [/ e7rJ8PiR9pRmcqRx] [error] "std::exception"
app_1           | Dbo.backend.Postgres: select "id", "version", "name", "country", "city" from "users_home" 
db_psql_1       | 2020-11-19 01:16:12.926 UTC [92] ERROR:  relation "users_home" does not exist at character 114
db_psql_1       | 2020-11-19 01:16:12.926 UTC [92] STATEMENT:  select "id", "version", "name", "country", "city" from "users_home" 
app_1           | [2020-Nov-19 02:16:12.930] 1 [/ e7rJ8PiR9pRmcqRx] [error] "Wt: fatal error: ERROR:  relation ""users_home"" does not exist

before createTables() , tableCreationSql() is empty, after the call it returns what I would expect from experience.

Tried to delete the DB-Datafolder to force recreation, but to no avail.

I will try to provide a minimal working code tomorrow ...

Anyone have an idea what that could be?

Cheers,
Christian


Replies (2)

RE: createTables throws, but no Tables exist - Added by Christian Meyer over 3 years ago

Minimal working sample ... apparently works just out of the box ... in Docker environment ...

Will check differences, though there should be not that many ...

Just an update should you be wondering what could have gone wrong ...

in the working sample, the call to tableCreateSql() seems to be working just fine even before the call to createTables()

Any Idea what could go wrong inside?

RE: createTables throws, but no Tables exist - Added by Christian Meyer over 3 years ago

So, as it turns out, you will need all ManyToOne relations to be defined with a proper belongsTo on the counterpart

it was a faulty persist function that stirred up the problem.

Thank you for your time!

Cheers =)

    (1-2/2)