migrate auth db to sql server
This commit is contained in:
+14
-5
@@ -77,15 +77,24 @@ GOOGLE_MAP_API_KEY = AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo
|
|||||||
|
|
||||||
|
|
||||||
//Next Auth vars
|
//Next Auth vars
|
||||||
EMAIL_SERVER_HOST=smtp.sendgrid.net
|
//EMAIL_SERVER_HOST=smtp.sendgrid.net
|
||||||
|
//EMAIL_SERVER_PORT=465
|
||||||
|
//EMAIL_SERVER_USER=apikey
|
||||||
|
//EMAIL_SERVER_PASSWORD=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
|
||||||
|
//EMAIL_FROM=rob@rdbsolutions.co.uk
|
||||||
|
|
||||||
|
|
||||||
|
EMAIL_SERVER_HOST=rdbdigital.com
|
||||||
EMAIL_SERVER_PORT=465
|
EMAIL_SERVER_PORT=465
|
||||||
EMAIL_SERVER_USER=apikey
|
EMAIL_SERVER_USER=rob@rdbdigital.com
|
||||||
EMAIL_SERVER_PASSWORD=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
|
EMAIL_SERVER_PASSWORD=!Sky9fish2020
|
||||||
EMAIL_FROM=rob@rdbsolutions.co.uk
|
EMAIL_FROM=no-reply@rdbdigital.com
|
||||||
|
|
||||||
NEXTAUTH_URL=http://localhost:3000
|
NEXTAUTH_URL=http://localhost:3000
|
||||||
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
NEXTAUTH_URL_INTERNAL=http://localhost:3000
|
||||||
DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
//DATABASE_URL=mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true
|
||||||
|
DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
|
||||||
|
|
||||||
SECRET=SuperSecret
|
SECRET=SuperSecret
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -26,7 +26,7 @@ const WEBAPI_URL =
|
|||||||
|
|
||||||
export const consoleLogger = (err) => {
|
export const consoleLogger = (err) => {
|
||||||
var errStr =
|
var errStr =
|
||||||
"///////\nServer Error " +
|
"\n\n/////////////////////////////////////////////////\nServer Error " +
|
||||||
"\n" +
|
"\n" +
|
||||||
err.response.status +
|
err.response.status +
|
||||||
" : " +
|
" : " +
|
||||||
@@ -35,7 +35,7 @@ export const consoleLogger = (err) => {
|
|||||||
err.response.config.url +
|
err.response.config.url +
|
||||||
"\nRequest Time: " +
|
"\nRequest Time: " +
|
||||||
err.response.headers.date +
|
err.response.headers.date +
|
||||||
"\n///////";
|
"\n/////////////////////////////////////////////////\n\n";
|
||||||
return errStr;
|
return errStr;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -602,7 +602,7 @@ export const getAppealID = (
|
|||||||
// getFormCollection(updateFormCollection)
|
// getFormCollection(updateFormCollection)
|
||||||
// )
|
// )
|
||||||
|
|
||||||
let formCollectionName = getFormCollection(updateFormCollection);
|
//let formCollectionName = getFormCollection(updateFormCollection);
|
||||||
//console.log(formCollectionName);
|
//console.log(formCollectionName);
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
@@ -617,12 +617,12 @@ export const getAppealID = (
|
|||||||
const result = Object.entries(res.data.value[0]).filter(
|
const result = Object.entries(res.data.value[0]).filter(
|
||||||
([key]) => !key.startsWith("_")
|
([key]) => !key.startsWith("_")
|
||||||
)[0][1];
|
)[0][1];
|
||||||
|
console.log("result:", res.data);
|
||||||
var appealID = result;
|
var appealID = result;
|
||||||
return appealID;
|
return appealID;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
//console.log("API call error", error);
|
console.log("API call error", error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -915,7 +915,7 @@ export const updateCase = async (
|
|||||||
var config = {
|
var config = {
|
||||||
method: "post",
|
method: "post",
|
||||||
url: queryUrl,
|
url: queryUrl,
|
||||||
data: data,
|
data: updateBody,
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ module.exports = {
|
|||||||
"pages": {
|
"pages": {
|
||||||
"*": ["common", "newappeal", "search"],
|
"*": ["common", "newappeal", "search"],
|
||||||
"/": ["common", "home"],
|
"/": ["common", "home"],
|
||||||
|
"/error": ["common", "home", "myportal"],
|
||||||
"/myportal": ["myportal", "common", "home"],
|
"/myportal": ["myportal", "common", "home"],
|
||||||
"/myportal/viewall": ["search"],
|
"/myportal/viewall": ["search"],
|
||||||
"/myportal/advancedsearch": ["search", "myportal"],
|
"/myportal/advancedsearch": ["search", "myportal"],
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@
|
|||||||
"@azure/storage-blob": "^12.10.0",
|
"@azure/storage-blob": "^12.10.0",
|
||||||
"@googlemaps/react-wrapper": "^1.1.24",
|
"@googlemaps/react-wrapper": "^1.1.24",
|
||||||
"@magic-sdk/admin": "^1.4.0",
|
"@magic-sdk/admin": "^1.4.0",
|
||||||
"@next-auth/prisma-adapter": "^1.0.3",
|
"@next-auth/prisma-adapter": "^1.0.4",
|
||||||
"@prisma/client": "^3.12.0",
|
"@prisma/client": "^3.12.0",
|
||||||
"@webdeb/next-styles": "^1.1.1",
|
"@webdeb/next-styles": "^1.1.1",
|
||||||
"applicationinsights": "^2.2.0",
|
"applicationinsights": "^2.2.0",
|
||||||
@@ -86,4 +86,4 @@
|
|||||||
"prettier": "2.5.1",
|
"prettier": "2.5.1",
|
||||||
"prisma": "^3.12.0"
|
"prisma": "^3.12.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+16
-14
@@ -18,6 +18,7 @@ import { reduxForm, formValueSelector } from "redux-form";
|
|||||||
|
|
||||||
import RegisterForm from "../../components/account/registerform";
|
import RegisterForm from "../../components/account/registerform";
|
||||||
import { dehashString, hashAPIPath } from "../../actions";
|
import { dehashString, hashAPIPath } from "../../actions";
|
||||||
|
import { getSession, useSession, signIn, signOut } from "next-auth/react";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const { footerLinks, formData, loggedInUserEmail } = props;
|
const { footerLinks, formData, loggedInUserEmail } = props;
|
||||||
@@ -156,22 +157,23 @@ const Home = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) => async (ctx) => {
|
||||||
async ({ query, req, res }) => {
|
const { query, req, res } = ctx;
|
||||||
let hasRegistrationEmail = typeof query.id != "undefined";
|
|
||||||
let loginEmailStr = "";
|
|
||||||
|
|
||||||
if (hasRegistrationEmail == true) {
|
let thisSession = await getSession(ctx);
|
||||||
loginEmailStr = dehashString(query.id);
|
|
||||||
|
|
||||||
console.log(loginEmailStr);
|
console.log(
|
||||||
}
|
"auth sess for register :",
|
||||||
return {
|
thisSession,
|
||||||
props: {
|
thisSession.user.email
|
||||||
loggedInUserEmail: loginEmailStr,
|
);
|
||||||
},
|
|
||||||
};
|
return {
|
||||||
}
|
props: {
|
||||||
|
loggedInUserEmail: thisSession.user.email,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
|
|||||||
@@ -125,6 +125,12 @@ export default NextAuth({
|
|||||||
//signOut: "/auth/signout",
|
//signOut: "/auth/signout",
|
||||||
error: "/auth/error", // Error code passed in query string as ?error=
|
error: "/auth/error", // Error code passed in query string as ?error=
|
||||||
verifyRequest: "/auth/verify-request", // (used for check email message)
|
verifyRequest: "/auth/verify-request", // (used for check email message)
|
||||||
// newUser: "/auth/new-user", // New users will be directed here on first sign in (leave the property out if not of interest)
|
newUser: "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest)
|
||||||
|
},
|
||||||
|
callbacks: {
|
||||||
|
session: async (session, user) => {
|
||||||
|
console.log(user);
|
||||||
|
return Promise.resolve(session);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ function Error({ statusCode }, props) {
|
|||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
<title>
|
<title>
|
||||||
{t("case:page-title")} - {t("common:service-name")}
|
{t("common:error-page-title")} - {t("common:service-name")}
|
||||||
</title>
|
</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div id="page_wrapper">
|
<div id="page_wrapper">
|
||||||
|
|||||||
+13
-2
@@ -44,7 +44,13 @@ const Home = (props) => {
|
|||||||
expDate.setDate(now.getDate() + 1);
|
expDate.setDate(now.getDate() + 1);
|
||||||
|
|
||||||
//console.log("hashed email str", loginEmailStr);
|
//console.log("hashed email str", loginEmailStr);
|
||||||
hasLoginCode != false
|
|
||||||
|
//const { data: session } = useSession();
|
||||||
|
|
||||||
|
//console.log("has session:", session);
|
||||||
|
//console.log("has LoginCode", hasLoginCode);
|
||||||
|
|
||||||
|
hasLoginCode == false
|
||||||
? console.log("no session")
|
? console.log("no session")
|
||||||
: _.has(loggedInUserId, "value")
|
: _.has(loggedInUserId, "value")
|
||||||
? _.isEmpty(loggedInUserId.value)
|
? _.isEmpty(loggedInUserId.value)
|
||||||
@@ -163,6 +169,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
let thisSession = await getSession(ctx);
|
let thisSession = await getSession(ctx);
|
||||||
|
|
||||||
|
console.log(ctx);
|
||||||
|
|
||||||
var relayToken = await getToken();
|
var relayToken = await getToken();
|
||||||
relayToken = relayToken.access_token;
|
relayToken = relayToken.access_token;
|
||||||
|
|
||||||
@@ -171,7 +179,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||||
const showMapCheck = process.env.SHOWMAPS || false;
|
const showMapCheck = process.env.SHOWMAPS || false;
|
||||||
|
|
||||||
const hasLoginCode = thisSession != null;
|
let hasLoginCode = thisSession != null;
|
||||||
|
|
||||||
|
console.log("server side has session:", thisSession != null);
|
||||||
|
|
||||||
// let providerConfig = await getProviderConfig();
|
// let providerConfig = await getProviderConfig();
|
||||||
let ggLocale =
|
let ggLocale =
|
||||||
@@ -227,6 +237,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
hasSession: hasLoginCode,
|
hasSession: hasLoginCode,
|
||||||
loggedInUserId: portalUserObj,
|
loggedInUserId: portalUserObj,
|
||||||
loggedInUserEmail: loginEmailStr,
|
loggedInUserEmail: loginEmailStr,
|
||||||
|
hasLoginCode: hasLoginCode,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
|
import { getSession, useSession } from "next-auth/react";
|
||||||
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import {
|
import {
|
||||||
@@ -24,7 +26,7 @@ import { getGovGatewayConfig } from "../../store/govgateway/action";
|
|||||||
import { getProviderConfig } from "../../actions/govgateway";
|
import { getProviderConfig } from "../../actions/govgateway";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const { footerLinks, pages, formData } = props;
|
const { footerLinks, pages, formData, loggedInUserIdent } = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -118,6 +120,7 @@ const Home = (props) => {
|
|||||||
appealType={props.setAppealType}
|
appealType={props.setAppealType}
|
||||||
loggedInUser={props.accountDetails.loggedinUserId}
|
loggedInUser={props.accountDetails.loggedinUserId}
|
||||||
whichForm={props.form}
|
whichForm={props.form}
|
||||||
|
loggedInUserIdent={loggedInUserIdent}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
@@ -135,7 +138,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
const { cookies } = req;
|
const { cookies } = req;
|
||||||
|
|
||||||
console.log("/newappeal - cookies ", cookies);
|
console.log("/newappeal - cookies ", cookies);
|
||||||
|
let thisSession = await getSession(ctx);
|
||||||
|
console.log("nextAuth Session:", thisSession);
|
||||||
|
|
||||||
|
let loggedInUserIdent = thisSession.user.id;
|
||||||
let loggedInUser = cookies.pinsUser;
|
let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
console.log("has loggedInUser", loggedInUser);
|
console.log("has loggedInUser", loggedInUser);
|
||||||
@@ -157,6 +163,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
store.dispatch(setLPA(lpaData));
|
store.dispatch(setLPA(lpaData));
|
||||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: { loggedInUserIdent: loggedInUserIdent },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,57 +1,61 @@
|
|||||||
-- CreateTable
|
-- CreateTable
|
||||||
CREATE TABLE `accounts` (
|
-- SQLINES LICENSE FOR EVALUATION USE ONLY
|
||||||
`id` VARCHAR(191) NOT NULL,
|
CREATE TABLE accounts (
|
||||||
`user_id` VARCHAR(191) NOT NULL,
|
id VARCHAR(191) NOT NULL,
|
||||||
`type` VARCHAR(191) NOT NULL,
|
user_id VARCHAR(191) NOT NULL,
|
||||||
`provider` VARCHAR(191) NOT NULL,
|
type VARCHAR(191) NOT NULL,
|
||||||
`provider_account_id` VARCHAR(191) NOT NULL,
|
provider VARCHAR(191) NOT NULL,
|
||||||
`refresh_token` TEXT NULL,
|
provider_account_id VARCHAR(191) NOT NULL,
|
||||||
`access_token` TEXT NULL,
|
refresh_token VARCHAR(max) NULL,
|
||||||
`expires_at` INTEGER NULL,
|
access_token VARCHAR(max) NULL,
|
||||||
`token_type` VARCHAR(191) NULL,
|
expires_at INTEGER NULL,
|
||||||
`scope` VARCHAR(191) NULL,
|
token_type VARCHAR(191) NULL,
|
||||||
`id_token` TEXT NULL,
|
scope VARCHAR(191) NULL,
|
||||||
`session_state` VARCHAR(191) NULL,
|
id_token VARCHAR(max) NULL,
|
||||||
|
session_state VARCHAR(191) NULL,
|
||||||
|
|
||||||
UNIQUE INDEX `accounts_provider_provider_account_id_key`(`provider`, `provider_account_id`),
|
CONSTRAINT accounts_provider_provider_account_id_key UNIQUE (provider, provider_account_id),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (id)
|
||||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
)
|
||||||
|
|
||||||
-- CreateTable
|
-- CreateTable
|
||||||
CREATE TABLE `sessions` (
|
-- SQLINES LICENSE FOR EVALUATION USE ONLY
|
||||||
`id` VARCHAR(191) NOT NULL,
|
CREATE TABLE sessions (
|
||||||
`session_token` VARCHAR(191) NOT NULL,
|
id VARCHAR(191) NOT NULL,
|
||||||
`user_id` VARCHAR(191) NOT NULL,
|
session_token VARCHAR(191) NOT NULL,
|
||||||
`expires` DATETIME(3) NOT NULL,
|
user_id VARCHAR(191) NOT NULL,
|
||||||
|
expires DATETIME2(3) NOT NULL,
|
||||||
|
|
||||||
UNIQUE INDEX `sessions_session_token_key`(`session_token`),
|
CONSTRAINT sessions_session_token_key UNIQUE (session_token),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (id)
|
||||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
)
|
||||||
|
|
||||||
-- CreateTable
|
-- CreateTable
|
||||||
CREATE TABLE `users` (
|
-- SQLINES LICENSE FOR EVALUATION USE ONLY
|
||||||
`id` VARCHAR(191) NOT NULL,
|
CREATE TABLE users (
|
||||||
`name` VARCHAR(191) NULL,
|
id VARCHAR(191) NOT NULL,
|
||||||
`email` VARCHAR(191) NULL,
|
name VARCHAR(191) NULL,
|
||||||
`email_verified` DATETIME(3) NULL,
|
email VARCHAR(191) NULL,
|
||||||
`image` VARCHAR(191) NULL,
|
email_verified DATETIME2(3) NULL,
|
||||||
|
image VARCHAR(191) NULL,
|
||||||
|
|
||||||
UNIQUE INDEX `users_email_key`(`email`),
|
CONSTRAINT users_email_key UNIQUE (email),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (id)
|
||||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
)
|
||||||
|
|
||||||
-- CreateTable
|
-- CreateTable
|
||||||
CREATE TABLE `verificationtokens` (
|
-- SQLINES LICENSE FOR EVALUATION USE ONLY
|
||||||
`identifier` VARCHAR(191) NOT NULL,
|
CREATE TABLE verificationtokens (
|
||||||
`token` VARCHAR(191) NOT NULL,
|
identifier VARCHAR(191) NOT NULL,
|
||||||
`expires` DATETIME(3) NOT NULL,
|
token VARCHAR(191) NOT NULL,
|
||||||
|
expires DATETIME2(3) NOT NULL,
|
||||||
|
|
||||||
UNIQUE INDEX `verificationtokens_token_key`(`token`),
|
CONSTRAINT verificationtokens_token_key UNIQUE (token),
|
||||||
UNIQUE INDEX `verificationtokens_identifier_token_key`(`identifier`, `token`)
|
CONSTRAINT verificationtokens_identifier_token_key UNIQUE (identifier, token)
|
||||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
)
|
||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE `accounts` ADD CONSTRAINT `accounts_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
ALTER TABLE accounts ADD CONSTRAINT accounts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE `sessions` ADD CONSTRAINT `sessions_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
ALTER TABLE sessions ADD CONSTRAINT sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
datasource db {
|
||||||
|
provider = "mysql"
|
||||||
|
url = env("DATABASE_URL")
|
||||||
|
}
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
model Account {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
userId String @map("user_id")
|
||||||
|
type String
|
||||||
|
provider String
|
||||||
|
providerAccountId String @map("provider_account_id")
|
||||||
|
refresh_token String? @db.Text
|
||||||
|
access_token String? @db.Text
|
||||||
|
expires_at Int?
|
||||||
|
token_type String?
|
||||||
|
scope String?
|
||||||
|
id_token String? @db.Text
|
||||||
|
session_state String?
|
||||||
|
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@unique([provider, providerAccountId])
|
||||||
|
@@map("accounts")
|
||||||
|
}
|
||||||
|
|
||||||
|
model Session {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
sessionToken String @unique @map("session_token")
|
||||||
|
userId String @map("user_id")
|
||||||
|
expires DateTime
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@map("sessions")
|
||||||
|
}
|
||||||
|
|
||||||
|
model User {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
name String?
|
||||||
|
email String? @unique
|
||||||
|
emailVerified DateTime? @map("email_verified")
|
||||||
|
image String?
|
||||||
|
accounts Account[]
|
||||||
|
sessions Session[]
|
||||||
|
|
||||||
|
@@map("users")
|
||||||
|
}
|
||||||
|
|
||||||
|
model VerificationToken {
|
||||||
|
identifier String
|
||||||
|
token String @unique
|
||||||
|
expires DateTime
|
||||||
|
|
||||||
|
@@unique([identifier, token])
|
||||||
|
@@map("verificationtokens")
|
||||||
|
}
|
||||||
+16
-17
@@ -1,27 +1,26 @@
|
|||||||
datasource db {
|
datasource db {
|
||||||
provider = "mysql"
|
provider = "sqlserver"
|
||||||
url = env("DATABASE_URL")
|
url = env("DATABASE_URL")
|
||||||
|
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
model Account {
|
model Account {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
userId String @map("user_id")
|
userId String @map("user_id")
|
||||||
type String
|
type String
|
||||||
provider String
|
provider String
|
||||||
providerAccountId String @map("provider_account_id")
|
providerAccountId String
|
||||||
refresh_token String? @db.Text
|
refresh_token String? @db.Text
|
||||||
access_token String? @db.Text
|
access_token String? @db.Text
|
||||||
expires_at Int?
|
expires_at Int?
|
||||||
token_type String?
|
token_type String?
|
||||||
scope String?
|
scope String?
|
||||||
id_token String? @db.Text
|
id_token String? @db.Text
|
||||||
session_state String?
|
session_state String?
|
||||||
|
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user