Init supabase
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { createClient } from '@/utils/supabase/server';
|
||||
|
||||
const tables = [
|
||||
'days',
|
||||
'hours',
|
||||
'colors',
|
||||
'categories',
|
||||
'metrics',
|
||||
'measurements'
|
||||
];
|
||||
|
||||
export default async function UpdateUserIdsPage() {
|
||||
const supabase = await createClient();
|
||||
const USERID = '1240aecb-a352-482c-a49a-9b45e166691a';
|
||||
|
||||
for (const table of tables) {
|
||||
const { data: schema } = await supabase.from(table).select();
|
||||
for (const row of schema!) {
|
||||
if (!row.userId) {
|
||||
// Update userId in supabase
|
||||
await supabase.from(table).update({ userId: USERID }).eq("id", schema!.id);
|
||||
console.log(`Updated row: ${row.id} in table: ${table}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return <pre>Updated tables.</pre>
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
Reference in New Issue
Block a user