30 lines
764 B
TypeScript
30 lines
764 B
TypeScript
|
|
import { db, appsTable } from "@workspace/db";
|
||
|
|
import { inArray } from "drizzle-orm";
|
||
|
|
|
||
|
|
const SLUGS = ["calendar", "notifications"];
|
||
|
|
|
||
|
|
async function main() {
|
||
|
|
console.log(`Enabling apps: ${SLUGS.join(", ")}...`);
|
||
|
|
const updated = await db
|
||
|
|
.update(appsTable)
|
||
|
|
.set({ isActive: true })
|
||
|
|
.where(inArray(appsTable.slug, SLUGS))
|
||
|
|
.returning({ slug: appsTable.slug, isActive: appsTable.isActive });
|
||
|
|
|
||
|
|
if (updated.length === 0) {
|
||
|
|
console.warn("No matching apps found — did seed run yet?");
|
||
|
|
} else {
|
||
|
|
for (const row of updated) {
|
||
|
|
console.log(` ✓ ${row.slug} (isActive=${row.isActive})`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
console.log("Done.");
|
||
|
|
}
|
||
|
|
|
||
|
|
main()
|
||
|
|
.catch((err) => {
|
||
|
|
console.error(err);
|
||
|
|
process.exit(1);
|
||
|
|
})
|
||
|
|
.finally(() => process.exit(0));
|