-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Postgres database does not created if it's not named as tinode #860
Comments
I found that in // Ignore missing database here. If we are initializing the database
// missing DB is OK.
if a.poolConfig.ConnConfig.Database == "tinode" {
a.poolConfig.ConnConfig.Database = "postgres"
a.db, err = pgxpool.ConnectConfig(ctx, a.poolConfig)
} I tried to change the tinode string to the actual name of my database and it worked as I expected. But since I am very new in this project and in golang development I am not sure for what this statement for. P.S. Thank you for your great work! |
Thanks, fixed in 52f33fe |
Have you had a chance to verify? |
For some reason it tries to create database named tinode and ignores the configs. As I understood it gets it from |
Ok I got it. It happens only when |
Can you share your config? I cannot reproduce. |
I removed some unnecessary logic: b7817c7 |
My config is below. Notice I specified database name as my_db but it created database named tinode: {
"store_config": {
"uid_key": "la6YsO+bNX/+XIkOqc5Svw==",
"use_adapter": "",
"adapters": {
"postgres": {
"dsn": "postgresql://postgres:postgres@localhost:5432/my_db?sslmode=disable"
},
"mysql": {
"database": "tinode",
"dsn": "root@tcp(localhost)/tinode?parseTime=true&collation=utf8mb4_unicode_ci"
},
"rethinkdb": {
"database": "tinode",
"addresses": "localhost:28015"
},
"mongodb": {
"database": "tinode",
"addresses": "localhost:27017"
}
}
}
} |
That's expected. For historical reasons in addition to DSN, the config also needs to specify the database name separately as |
Yes worked after adding |
I removed the requirement for specifying db name in addition to DSN: 8491f05 |
I assume everything is fixed here and working as expected. If not, please let me knwo. |
PostgreSQL migration
When I compile and run tinode-db using PostgreSQL and set the database name in tinode.conf to something other than 'tinode', the database is not created and program panics.
Your environment
Server-side
Client-side
index-dev.html
to reproduce the problem, notindex.html
.Steps to reproduce
Rename database name in
tinode-db/tinode.conf
to something other than tinode.Run tinode-db binary file.
Expected behaviour
Create database specified in
tinode-db/tinode.conf
if it doesn't exists. And all required tables.Actual behaviour
Program panics without any explanation of the error. Just a debug information from panic.
Server-side log
Client-side log
Have no logs
The text was updated successfully, but these errors were encountered: