done
This commit is contained in:
20
apps/backend/prisma/add-allowed-companies.js
Normal file
20
apps/backend/prisma/add-allowed-companies.js
Normal file
@@ -0,0 +1,20 @@
|
||||
require('dotenv').config({ path: __dirname + '/../.env' });
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
await prisma.$executeRawUnsafe('ALTER TABLE `User` ADD COLUMN `allowedCompanies` TEXT NULL AFTER `companyName`;');
|
||||
console.log('✓ Successfully added allowedCompanies column to User table');
|
||||
} catch (err) {
|
||||
if (err.message && err.message.includes('Duplicate column name')) {
|
||||
console.log('✓ Column allowedCompanies already exists');
|
||||
} else {
|
||||
console.error('Error adding column:', err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(() => prisma.$disconnect());
|
||||
Reference in New Issue
Block a user