stack/apps/backend/prisma
Zai Shi aacbdf4dd6
Fix OAuth provider migration (#793)
<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<!-- ELLIPSIS_HIDDEN -->

----

> [!IMPORTANT]
> Fixes OAuth provider migration by updating schema, constraints, and
foreign keys in `ProjectUserOAuthAccount`, `OAuthAccessToken`, and
`OAuthToken`.
> 
>   - **Schema Changes**:
> - `ProjectUserOAuthAccount`: Add `allowConnectedAccounts` and
`allowSignIn` columns with default `true`. Add `id` column, generate
UUIDs for existing rows, set `id` as NOT NULL and primary key.
> - `OAuthAccessToken` and `OAuthToken`: Add `oauthAccountId` column,
update with `ProjectUserOAuthAccount.id`, drop `configOAuthProviderId`
and `providerAccountId` columns, set `oauthAccountId` as NOT NULL.
>   - **Constraints and Indexes**:
> - Add unique index on `OAuthAuthMethod` for `tenancyId`,
`projectUserId`, `configOAuthProviderId`.
> - Add foreign keys linking `OAuthAuthMethod`, `OAuthToken`, and
`OAuthAccessToken` to `ProjectUserOAuthAccount`.
>     - Drop `ConnectedAccount` table.
>   - **Misc**:
>     - `ProjectUserOAuthAccount`: Allow `projectUserId` to be NULL.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for a27230eb54. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
2025-07-23 19:19:47 +02:00
..
migrations Fix OAuth provider migration (#793) 2025-07-23 19:19:47 +02:00
schema.prisma Add an OAuth provider for Twitch (#728) 2025-07-23 02:31:47 +02:00
seed.ts Source of Truth (#660) 2025-07-11 17:59:03 -07:00
tsup.config.ts Config DB migration step 2 (#629) 2025-04-29 14:52:45 -07:00