kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at cd7cada2f86b4e866a15b4323bb8d6d7ab5bba8b 40 lines 1.1 kB view raw
1import { eq } from "drizzle-orm"; 2import { auth } from "../auth"; 3import db, { schema } from "../database"; 4 5async function migrateOrganizations() { 6 console.log("Migrating organizations..."); 7 8 const workspaces = await db.select().from(schema.workspaceTable); 9 10 for (const workspace of workspaces) { 11 const members = await db 12 .select() 13 .from(schema.workspaceUserTable) 14 .where(eq(schema.workspaceUserTable.workspaceId, workspace.id)); 15 16 const owner = members.find((member) => member.role === "owner"); 17 18 const data = await auth.api.createOrganization({ 19 body: { 20 name: workspace.name, 21 description: workspace.description || undefined, 22 slug: 23 workspace.slug || workspace.name.toLowerCase().replace(/\s+/g, "-"), 24 userId: owner?.userId, 25 }, 26 }); 27 28 // now we need to migrate the members 29 for (const member of members) { 30 await auth.api.addTeamMember({ 31 body: { 32 teamId: data?.id || "", 33 userId: member.userId, 34 }, 35 }); 36 } 37 } 38} 39 40export default migrateOrganizations;