Skip to content

Fix missing device columns when migrating from <1.0#145

Merged
julien-nc merged 9 commits intojulien-nc:mainfrom
TrafficLight42:fix-no-db-columns
Apr 26, 2026
Merged

Fix missing device columns when migrating from <1.0#145
julien-nc merged 9 commits intojulien-nc:mainfrom
TrafficLight42:fix-no-db-columns

Conversation

@TrafficLight42
Copy link
Copy Markdown
Contributor

@TrafficLight42 TrafficLight42 commented Apr 17, 2026

Fixes #144

When upgrading to v1.0, having originally installed <v1.0 installed, some database columns for the Device and Session models aren't added. Those columns are:

phonetrack_devices
------------------
line_enabled
auto_zoom
color_criteria
enabled
phonetrack_sessions
-------------------
enabled

I looked through all the other database tables and no columns for any other classes appear to be missing.

I have created a new migration that adds these columns if they don't exist. I wasn't too sure on what to put for the notnull, default, or unsigned parameters so I copied them from an earlier migration:

'notnull' => true,
'default' => 0,
'unsigned' => true

Through manual testing it seems everything is working as it should! The show line and auto zoom features are now working and there are no errors in Firefox's JavaScript console or the Nextcloud logs.

*note: I did not vibe code this!

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc
Copy link
Copy Markdown
Owner

julien-nc commented Apr 26, 2026

Thanks a lot for this PR.

*note: I did not vibe code this!

Very rare these days 😁, congrats.

Good that you set those columns to unsigned.

I'm very curious to know what went wrong with the previous migration which was supposed to add those columns. The difference I can see is that you're using Types::INTEGER instead of the Types::SMALLINT of my previous migration.
But some old columns like oc_phonetrack_session.public and oc_phonetrack_session.locked are smallint and they didn't cause issues. Maybe it's the combination between NOTNULL and smallint...

Which database system are you using? Postgres, MariaDB/MySQL, sqlite, Oracle?
It would be nice to make sure everybody has the same DB schema. So in case the old migration succeeded, we should change those column types and make them unsigned.

I pushed a few commits in your branch. I hope you don't mind.

  • changed the types to unsigned integer if the columns are there
  • renamed the migration to reflect in which release it will be included
  • bumped the app version to 1.2.0 to make sure people using the sources will get the migration triggered
  • fix indentation
  • update psalm, weird error on method attributes
  • fix notification action links (they now have to be absolute)

@julien-nc julien-nc self-requested a review April 26, 2026 10:47
Copy link
Copy Markdown
Owner

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💙

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc
Copy link
Copy Markdown
Owner

I'll check how to fix the CI issues soon.

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…ould be absolute)

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc merged commit 67193f4 into julien-nc:main Apr 26, 2026
48 checks passed
@TrafficLight42
Copy link
Copy Markdown
Contributor Author

Thanks for merging this! I can confirm it's still working, having updated to version 1.2.0

I can't provide much insight on my it worked with Types::Integer, I'm afraid, as I'm not very familiar with the intricacies of Nextcloud apps. My choice to use it was just out of habit, really. My Nextcloud 33.0.2 instance (I'm normally at the latest version) uses Postgres 18, and I am running it on TrueNAS Scale 25.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New UI Backend: Can't toggle "Show Lines" or "Auto Zoom"

2 participants