🚧 wip: rewrite reprovision logic to match new user schema

This commit is contained in:
2026-05-28 21:01:54 +07:00
parent 8cebc0cd20
commit 57d19d4302
13 changed files with 120 additions and 110 deletions

View File

@ -15,8 +15,6 @@ Table users {
sex user_sex
phone_number String
country countries
auth_provider String
provider_token String
address user_addresses
preferences user_preferences
created_at DateTime [default: `now()`, not null]
@ -76,7 +74,6 @@ Table user_oauth_accounts {
provider_token String
refresh_token String
expires_at DateTime
last_login DateTime [default: `now()`, not null]
created_at DateTime [default: `now()`, not null]
updated_at DateTime [not null]
user_id String [not null]
@ -98,7 +95,7 @@ Table user_sessions {
Table user_preferences {
user users [not null]
char_as_partner characters [not null]
char_as_partner characters
comment_picture String
enable_watch_history Boolean [not null, default: true]
enable_search_history Boolean [not null, default: false]
@ -115,7 +112,7 @@ Table user_preferences {
rating_preferences user_rating_preferences [not null]
country_preferences user_country_preferences [not null]
user_id String [pk]
char_as_partner_id String [not null]
char_as_partner_id String
}
Table user_genre_preferences {

View File

@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `auth_provider` on the `users` table. All the data in the column will be lost.
- You are about to drop the column `provider_token` on the `users` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "users" DROP COLUMN "auth_provider",
DROP COLUMN "provider_token";

View File

@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `last_login` on the `user_oauth_accounts` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "user_oauth_accounts" DROP COLUMN "last_login";

View File

@ -178,7 +178,6 @@ model UserOauthAccounts {
provider_token String? @db.VarChar(255)
refresh_token String? @db.VarChar(255)
expires_at DateTime? @db.Timestamptz()
last_login DateTime @default(now()) @db.Timestamptz()
created_at DateTime @default(now()) @db.Timestamptz()
updated_at DateTime @updatedAt @db.Timestamptz()
@ -204,7 +203,7 @@ model UserSession {
model UserPreference {
user User @relation(fields: [user_id], references: [id])
char_as_partner Character @relation(fields: [char_as_partner_id], references: [id])
char_as_partner Character? @relation(fields: [char_as_partner_id], references: [id])
comment_picture String? @db.VarChar(255)
enable_watch_history Boolean @default(true)
enable_search_history Boolean @default(false)
@ -221,8 +220,8 @@ model UserPreference {
rating_preferences UserRatingPreference[]
country_preferences UserCountryPreference[]
user_id String @id @db.Uuid
char_as_partner_id String @db.Uuid
user_id String @id @db.Uuid
char_as_partner_id String? @db.Uuid
@@map("user_preferences")
}