[GH-ISSUE #904] Shiori can't migrate from 1.6.3 to last commit in master, if you use Postgres or Mariadb #410

Closed
opened 2026-02-25 23:34:10 +03:00 by kerem · 4 comments
Owner

Originally created by @Monirzadeh on GitHub (May 10, 2024).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/904

Originally assigned to: @fmartingr on GitHub.

Data

  • Shiori version: last commit in master branch c107e974ca
  • Database Engine: postgress
  • Operating system: linux
  • CLI/Web interface/Web Extension: Web interface

Describe the bug / actual behavior

Shiori can't done migration from last release 1.6.3 to last we have in master (currently is commit c107e974ca) if you use postgres database and you will get this error

ERROR:  relation "shiori_system" does not exist at character 37

Expected behavior

Shiori can migrate without any error if you use Postgres

To Reproduce

Steps to reproduce the behavior:

  1. Get last Shiori release 1.6.3
  2. 
Run that with with a pg database with SHIORI_DATABASE_URL
  3. 
Shutdown Shiori

  4. Clone Shiori repository and try to setup same pg database with SHIORI_DATABASE_URL and run with go run main.go server

  5. As you see get bellow error in postgress log and Shiori not run
    ERROR: relation "shiori_system" does not exist at character 37

Notes

It not happen for Sqlite and happen in pg and mariadb

Originally created by @Monirzadeh on GitHub (May 10, 2024). Original GitHub issue: https://github.com/go-shiori/shiori/issues/904 Originally assigned to: @fmartingr on GitHub. ## Data - **Shiori version**: last commit in master branch c107e974caa4c983544856ef76c70c00f708dc8e - **Database Engine**: postgress - **Operating system**: linux - **CLI/Web interface/Web Extension**: Web interface ## Describe the bug / actual behavior Shiori can't done migration from last release [1.6.3](https://github.com/go-shiori/shiori/releases/tag/v1.6.3) to last we have in master (currently is commit c107e974caa4c983544856ef76c70c00f708dc8e) if you use postgres database and you will get this error ``` ERROR: relation "shiori_system" does not exist at character 37 ``` ## Expected behavior Shiori can migrate without any error if you use Postgres ## To Reproduce Steps to reproduce the behavior: 1. Get last Shiori release [1.6.3](https://github.com/go-shiori/shiori/releases/tag/v1.6.3) 2. 
Run that with with a pg database with `SHIORI_DATABASE_URL` 3. 
Shutdown Shiori
 4. Clone Shiori repository and try to setup same pg database with `SHIORI_DATABASE_URL` and run with `go run main.go server
` 5. As you see get bellow error in postgress log and Shiori not run `ERROR: relation "shiori_system" does not exist at character 37` ## Notes It not happen for Sqlite and happen in pg and mariadb
Author
Owner

@fmartingr commented on GitHub (May 11, 2024):

If my assumption is correct is weird that is not happening for SQLite, should happen for all engines. I will take a look at this later in the date or tomorrow, should be an easy fix.

<!-- gh-comment-id:2105574019 --> @fmartingr commented on GitHub (May 11, 2024): If my assumption is correct is weird that is not happening for SQLite, should happen for all engines. I will take a look at this later in the date or tomorrow, should be an easy fix.
Author
Owner

@fmartingr commented on GitHub (May 12, 2024):

Hey @Monirzadeh I can't replicate this. I create my PSQL database with 1.6.3, when I run the master branch I get the shiori_system database properly.

I got a different error though: https://github.com/go-shiori/shiori/pull/906

<!-- gh-comment-id:2106224616 --> @fmartingr commented on GitHub (May 12, 2024): Hey @Monirzadeh I can't replicate this. I create my PSQL database with 1.6.3, when I run the `master` branch I get the `shiori_system` database properly. I got a different error though: https://github.com/go-shiori/shiori/pull/906
Author
Owner

@Monirzadeh commented on GitHub (May 12, 2024):

@fmartingr i test again. i have this in pg log

[postgres] | ERROR:  relation "shiori_system" does not exist at character 37
[postgres] | STATEMENT:  SELECT database_schema_version FROM shiori_system

and this in shiori log

WARN SHIORI_HTTP_SECRET_KEY is not set, using random value. This means that all sessions will be invalidated on server restart. 
error during commit: sql: transaction has already been committed or rolled back
error during commit: sql: transaction has already been committed or rolled back
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc5be91]

goroutine 1 [running]:
github.com/go-shiori/shiori/internal/database.init.func2(0xc000593450)
	/tmp/shiori/internal/database/pg.go:31 +0x111
github.com/go-shiori/shiori/internal/database.runMigrations({0x149ca18, 0x249e420}, {0x14a4cc0, 0xc00058ecf0}, {0x243c2c0, 0x3, 0x1c?})
	/tmp/shiori/internal/database/migrations.go:85 +0x31e
github.com/go-shiori/shiori/internal/database.(*PGDatabase).Migrate(0xc00041c220?, {0x149ca18?, 0x249e420?})
	/tmp/shiori/internal/database/pg.go:90 +0x46
github.com/go-shiori/shiori/internal/cmd.initShiori({0x149ca18, 0x249e420}, 0xc000174308)
	/tmp/shiori/internal/cmd/root.go:94 +0x60b
github.com/go-shiori/shiori/internal/cmd.newServerCommand.newServerCommandHandler.func1(0xc000174308, {0xf93dbe?, 0x4?, 0xf93d42?})
	/tmp/shiori/internal/cmd/server.go:50 +0x145
github.com/spf13/cobra.(*Command).execute(0xc000174308, {0x249e420, 0x0, 0x0})
	/home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xc000182308)
	/home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x409f85?)
	/home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
	/tmp/shiori/main.go:26 +0x18
exit status 2

i remove time from logs

<!-- gh-comment-id:2106228986 --> @Monirzadeh commented on GitHub (May 12, 2024): @fmartingr i test again. i have this in pg log ``` [postgres] | ERROR: relation "shiori_system" does not exist at character 37 [postgres] | STATEMENT: SELECT database_schema_version FROM shiori_system ``` and this in shiori log ``` WARN SHIORI_HTTP_SECRET_KEY is not set, using random value. This means that all sessions will be invalidated on server restart. error during commit: sql: transaction has already been committed or rolled back error during commit: sql: transaction has already been committed or rolled back panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc5be91] goroutine 1 [running]: github.com/go-shiori/shiori/internal/database.init.func2(0xc000593450) /tmp/shiori/internal/database/pg.go:31 +0x111 github.com/go-shiori/shiori/internal/database.runMigrations({0x149ca18, 0x249e420}, {0x14a4cc0, 0xc00058ecf0}, {0x243c2c0, 0x3, 0x1c?}) /tmp/shiori/internal/database/migrations.go:85 +0x31e github.com/go-shiori/shiori/internal/database.(*PGDatabase).Migrate(0xc00041c220?, {0x149ca18?, 0x249e420?}) /tmp/shiori/internal/database/pg.go:90 +0x46 github.com/go-shiori/shiori/internal/cmd.initShiori({0x149ca18, 0x249e420}, 0xc000174308) /tmp/shiori/internal/cmd/root.go:94 +0x60b github.com/go-shiori/shiori/internal/cmd.newServerCommand.newServerCommandHandler.func1(0xc000174308, {0xf93dbe?, 0x4?, 0xf93d42?}) /tmp/shiori/internal/cmd/server.go:50 +0x145 github.com/spf13/cobra.(*Command).execute(0xc000174308, {0x249e420, 0x0, 0x0}) /home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1 github.com/spf13/cobra.(*Command).ExecuteC(0xc000182308) /home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff github.com/spf13/cobra.(*Command).Execute(0x409f85?) /home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13 main.main() /tmp/shiori/main.go:26 +0x18 exit status 2 ``` *i remove time from logs*
Author
Owner

@Monirzadeh commented on GitHub (May 12, 2024):

i test that on mariadb too and similar thing happen
mariadb log

[mariadb] | [Warning] Aborted connection 3 to db: 'shiori' user: 'shiori' host: '10.89.0.3' (Got an error reading communication packets)
[mariadb] | [Warning] Aborted connection 10 to db: 'shiori' user: 'shiori' host: '10.89.0.3' (Got an error reading communication packets)

shiori log

WARN SHIORI_HTTP_SECRET_KEY is not set, using random value. This means that all sessions will be invalidated on server restart. 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc5b8b1]

goroutine 1 [running]:
github.com/go-shiori/shiori/internal/database.init.func1(0xc0006c8750)
	/tmp/shiori/internal/database/mysql.go:35 +0x111
github.com/go-shiori/shiori/internal/database.runMigrations({0x149ca18, 0x249e420}, {0x14a4d60, 0xc0000c05a0}, {0x243d1c0, 0x7, 0x1c?})
	/tmp/shiori/internal/database/migrations.go:85 +0x31e
github.com/go-shiori/shiori/internal/database.(*MySQLDatabase).Migrate(0xc000042440?, {0x149ca18?, 0x249e420?})
	/tmp/shiori/internal/database/mysql.go:94 +0x46
github.com/go-shiori/shiori/internal/cmd.initShiori({0x149ca18, 0x249e420}, 0xc0006ca308)
	/tmp/shiori/internal/cmd/root.go:94 +0x60b
github.com/go-shiori/shiori/internal/cmd.newServerCommand.newServerCommandHandler.func1(0xc0006ca308, {0xf93dbe?, 0x4?, 0xf93d42?})
	/tmp/shiori/internal/cmd/server.go:50 +0x145
github.com/spf13/cobra.(*Command).execute(0xc0006ca308, {0x249e420, 0x0, 0x0})
	/home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xc00068c608)
	/home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x409f85?)
	/home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
	/tmp/shiori/main.go:26 +0x18
exit status 2

i remove time from logs

<!-- gh-comment-id:2106231161 --> @Monirzadeh commented on GitHub (May 12, 2024): i test that on mariadb too and similar thing happen mariadb log ``` [mariadb] | [Warning] Aborted connection 3 to db: 'shiori' user: 'shiori' host: '10.89.0.3' (Got an error reading communication packets) [mariadb] | [Warning] Aborted connection 10 to db: 'shiori' user: 'shiori' host: '10.89.0.3' (Got an error reading communication packets) ``` shiori log ``` WARN SHIORI_HTTP_SECRET_KEY is not set, using random value. This means that all sessions will be invalidated on server restart. panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc5b8b1] goroutine 1 [running]: github.com/go-shiori/shiori/internal/database.init.func1(0xc0006c8750) /tmp/shiori/internal/database/mysql.go:35 +0x111 github.com/go-shiori/shiori/internal/database.runMigrations({0x149ca18, 0x249e420}, {0x14a4d60, 0xc0000c05a0}, {0x243d1c0, 0x7, 0x1c?}) /tmp/shiori/internal/database/migrations.go:85 +0x31e github.com/go-shiori/shiori/internal/database.(*MySQLDatabase).Migrate(0xc000042440?, {0x149ca18?, 0x249e420?}) /tmp/shiori/internal/database/mysql.go:94 +0x46 github.com/go-shiori/shiori/internal/cmd.initShiori({0x149ca18, 0x249e420}, 0xc0006ca308) /tmp/shiori/internal/cmd/root.go:94 +0x60b github.com/go-shiori/shiori/internal/cmd.newServerCommand.newServerCommandHandler.func1(0xc0006ca308, {0xf93dbe?, 0x4?, 0xf93d42?}) /tmp/shiori/internal/cmd/server.go:50 +0x145 github.com/spf13/cobra.(*Command).execute(0xc0006ca308, {0x249e420, 0x0, 0x0}) /home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1 github.com/spf13/cobra.(*Command).ExecuteC(0xc00068c608) /home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff github.com/spf13/cobra.(*Command).Execute(0x409f85?) /home/myusername/.cache/go/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13 main.main() /tmp/shiori/main.go:26 +0x18 exit status 2 ``` *i remove time from logs*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#410
No description provided.