Merge branch 'prisma-upgrade' into dev

This commit is contained in:
Mike Cao 2021-12-17 20:40:40 -08:00
commit 7b7557ec90
5 changed files with 31 additions and 31 deletions

View File

@ -106,12 +106,19 @@ export default function Calendar({ date, minDate, maxDate, onChange }) {
} }
const DaySelector = ({ date, minDate, maxDate, locale, onSelect }) => { const DaySelector = ({ date, minDate, maxDate, locale, onSelect }) => {
const startWeek = startOfWeek(date, { locale: getDateLocale(locale) }); const dateLocale = getDateLocale(locale);
const startMonth = startOfMonth(date, { locale: getDateLocale(locale) }); const weekStartsOn = dateLocale?.options?.weekStartsOn || 0;
const startDay = subDays(startMonth, startMonth.getDay()); const startWeek = startOfWeek(date, {
locale: dateLocale,
weekStartsOn,
});
const startMonth = startOfMonth(date);
const startDay = subDays(startMonth, startMonth.getDay() - weekStartsOn);
const month = date.getMonth(); const month = date.getMonth();
const year = date.getFullYear(); const year = date.getFullYear();
console.log({ dateLocale, startDay, startWeek, startMonth, month, year });
const daysOfWeek = []; const daysOfWeek = [];
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
daysOfWeek.push(addDays(startWeek, i)); daysOfWeek.push(addDays(startWeek, i));

View File

@ -35,7 +35,6 @@ export default function ReferrersTable({ websiteId, websiteDomain, showFilters,
]; ];
const renderLink = ({ w: link, x: label }) => { const renderLink = ({ w: link, x: label }) => {
console.log({ link, label });
return ( return (
<div className={styles.row}> <div className={styles.row}>
<Link href={resolve({ ref: label })} replace={true}> <Link href={resolve({ ref: label })} replace={true}>

View File

@ -36,7 +36,7 @@ export async function rawQuery(query, params = []) {
const sql = db === MYSQL ? query.replace(/\$[0-9]+/g, '?') : query; const sql = db === MYSQL ? query.replace(/\$[0-9]+/g, '?') : query;
return prisma.$queryRaw.apply(prisma, [sql, ...params]); return prisma.$queryRawUnsafe.apply(prisma, [sql, ...params]);
} }
export function getDateQuery(field, unit, timezone) { export function getDateQuery(field, unit, timezone) {
@ -170,14 +170,11 @@ export async function resetWebsite(website_id) {
export async function deleteWebsite(website_id) { export async function deleteWebsite(website_id) {
return runQuery( return runQuery(
/* Prisma bug, does not cascade on non-nullable foreign keys
prisma.website.delete({ prisma.website.delete({
where: { where: {
website_id, website_id,
}, },
}), }),
*/
prisma.$queryRaw`delete from website where website_id=${website_id}`,
); );
} }
@ -269,14 +266,11 @@ export async function updateAccount(user_id, data) {
export async function deleteAccount(user_id) { export async function deleteAccount(user_id) {
return runQuery( return runQuery(
/* Prisma bug, does not cascade on non-nullable foreign keys
prisma.account.delete({ prisma.account.delete({
where: { where: {
user_id, user_id,
}, },
}), }),
*/
prisma.$queryRaw`delete from account where user_id=${user_id}`,
); );
} }

View File

@ -54,7 +54,7 @@
}, },
"dependencies": { "dependencies": {
"@fontsource/inter": "4.5.0", "@fontsource/inter": "4.5.0",
"@prisma/client": "2.29.1", "@prisma/client": "3.6.0",
"@reduxjs/toolkit": "^1.6.1", "@reduxjs/toolkit": "^1.6.1",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"chalk": "^4.1.1", "chalk": "^4.1.1",
@ -122,7 +122,7 @@
"postcss-rtlcss": "^3.3.2", "postcss-rtlcss": "^3.3.2",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"prettier-eslint": "^13.0.0", "prettier-eslint": "^13.0.0",
"prisma": "2.29.1", "prisma": "3.6.0",
"rollup": "^2.48.0", "rollup": "^2.48.0",
"rollup-plugin-hashbang": "^2.2.2", "rollup-plugin-hashbang": "^2.2.2",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",

View File

@ -1631,22 +1631,22 @@
resolved "https://registry.yarnpkg.com/@panva/asn1.js/-/asn1.js-1.0.0.tgz#dd55ae7b8129e02049f009408b97c61ccf9032f6" resolved "https://registry.yarnpkg.com/@panva/asn1.js/-/asn1.js-1.0.0.tgz#dd55ae7b8129e02049f009408b97c61ccf9032f6"
integrity sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw== integrity sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw==
"@prisma/client@2.29.1": "@prisma/client@3.6.0":
version "2.29.1" version "3.6.0"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-2.29.1.tgz#a7b91c9644800de4e00b2f7c3789ff4bae42b3d6" resolved "https://registry.yarnpkg.com/@prisma/client/-/client-3.6.0.tgz#68a60cd4c73a369b11f72e173e86fd6789939293"
integrity sha512-GhieSvHGPIV5IwRYIkJ4FrGSNfX18lPhFtlyVWxhvX0ocdy8oTnjNZVTFgGxB6qVmJIUpH1HsckAzIoAX689IA== integrity sha512-ycSGY9EZGROtje0iCNsgC5Zqi/ttX2sO7BNMYaLsUMiTlf3F69ZPH+08pRo0hrDfkZzyimXYqeXJlaoYDH1w7A==
dependencies: dependencies:
"@prisma/engines-version" "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" "@prisma/engines-version" "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727"
"@prisma/engines-version@2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a": "@prisma/engines-version@3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727":
version "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" version "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a.tgz#96db92f09714d4dd2a5e21054c28bd1c0820fa77" resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727.tgz#25aa447776849a774885866b998732b37ec4f4f5"
integrity sha512-BU1DNNDhdzqjHtycpUzDrU8+jf6ZY+fbXvCV/rbqG+0JifljlIo4vbkHDMg97gBi1Do8pTLZGlTH16FlniKgAg== integrity sha512-vtoO2ys6mSfc8ONTWdcYztKN3GBU1tcKBj0aXObyjzSuGwHFcM/pEA0xF+n1W4/0TAJgfoPX2khNEit6g0jtNA==
"@prisma/engines@2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a": "@prisma/engines@3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727":
version "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" version "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a.tgz#0a44a6dcbee7e0a2850ea086675a8a4f4d627f9d" resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727.tgz#c68ede6aeffa9ef7743a32cfa6daf9172a4e15b3"
integrity sha512-cgEoGK3dmKZkMp/sRbL8TsuVS50rHXYBHk2NY18DPUGr5//4ICno46EjzlayqAFVak8J6RtWZEs+8tE8j8frAQ== integrity sha512-dRClHS7DsTVchDKzeG72OaEyeDskCv91pnZ72Fftn0mp4BkUvX2LvWup65hCNzwwQm5IDd6A88APldKDnMiEMA==
"@reduxjs/toolkit@^1.6.1": "@reduxjs/toolkit@^1.6.1":
version "1.6.2" version "1.6.2"
@ -6568,12 +6568,12 @@ pretty-format@^23.0.1:
ansi-regex "^3.0.0" ansi-regex "^3.0.0"
ansi-styles "^3.2.0" ansi-styles "^3.2.0"
prisma@2.29.1: prisma@3.6.0:
version "2.29.1" version "3.6.0"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-2.29.1.tgz#7845f55c7f09955b01f973c6a4b1f330cb212e7d" resolved "https://registry.yarnpkg.com/prisma/-/prisma-3.6.0.tgz#99532abc02e045e58c6133a19771bdeb28cecdbe"
integrity sha512-fRGh90+z0m3Jw3D6KBE6wyVCRR0w6M6QD93jh+em8IOQycmC48zB8hho8zeri3J9//C0k8fkDeQrRLJUosXROw== integrity sha512-6SqgHS/5Rq6HtHjsWsTxlj+ySamGyCLBUQfotc2lStOjPv52IQuDVpp58GieNqc9VnfuFyHUvTZw7aQB+G2fvQ==
dependencies: dependencies:
"@prisma/engines" "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" "@prisma/engines" "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727"
process@0.11.10: process@0.11.10:
version "0.11.10" version "0.11.10"