cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

Tables user and userPasswords showing errors

Open fendle opened this issue 1 year ago • 4 comments

Issue Summary

I can't login into my selfhosted instance, always says unknown user.

Checked in Studio the table user and userPassword and get the following errors:

  1. UserPassword: The table public.UserPassword does not exist in the current database.
  2. User The column users.appTheme does not exist in the current database

Was there an migration in one of the last versions? I am running watchtower to do the updates. Can I somehow run a script, that the tables are added?

Thanks

fendle avatar May 01 '24 12:05 fendle

It looks like your database is missing some updates, likely due to a migration issue. Here's how to fix it:

  1. Add the appTheme column to the User table:
ALTER TABLE "users" ADD COLUMN "appTheme" TEXT;
  1. Create the UserPassword table:
CREATE TABLE "UserPassword" (
  "hash" TEXT NOT NULL,
  "userId" INTEGER NOT NULL,
  PRIMARY KEY ("userId")
);

CREATE UNIQUE INDEX "UserPassword_userId_key" ON "UserPassword" ("userId");

ALTER TABLE "UserPassword" ADD CONSTRAINT "UserPassword_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE;

INSERT INTO "UserPassword" ("hash", "userId")
SELECT u."password", u.id FROM users u WHERE u."password" IS NOT NULL;

These steps address the missing UserPassword table and the appTheme column in the User table. After running these SQL commands, your database should be aligned with the expected schema, resolving the login issue.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 01 '24 12:05 dosubot[bot]

Thanks, now I can login but get the following error in the logs of my database ERROR: column DestinationCalendar.primaryEmail

Could I get as well the migration script for DestinationCalendar.primaryEmail? #

Thanks

fendle avatar May 05 '24 10:05 fendle

To add the primaryEmail column to the DestinationCalendar table, you can use the following SQL script:

ALTER TABLE "DestinationCalendar" ADD COLUMN "primaryEmail" TEXT;

This script will create the primaryEmail column in your DestinationCalendar table, which is necessary for storing the primary email addresses associated with destination calendars. Execute this script in your database to resolve the error you're encountering.

If there are any further adjustments or assistance you need, feel free to ask.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 05 '24 11:05 dosubot[bot]

Thanks a lot, somehow a lot of scripts were not executed. I did it now manually from the migrations folder from github

fendle avatar May 05 '24 11:05 fendle