database debugging

pull/4/head
Cameron Clough 2022-03-24 00:12:02 +00:00
parent a73fd28b72
commit c2296772d1
No known key found for this signature in database
GPG Key ID: BFB3B74B026ED43F
2 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,6 @@ sequelize.options.logging = () => {};
* if their types have changed!
* Use sequelize-cli and migrations instead!
*/
sequelize.sync({ force: process.env.DB_FORCE_SYNC });
sequelize.sync({ force: process.env.DB_FORCE_SYNC === 'true' });
export default sequelize;

View File

@ -6,6 +6,7 @@ import log4js from 'log4js';
import storageController from './controllers/storage';
import controllers from './controllers';
import router from './router';
import { Accounts, Devices, Drives } from '../models';
const logger = log4js.getLogger();
@ -22,6 +23,14 @@ const app = express();
storageController.initializeStorage();
tasks.push(storageController.updateTotalStorageUsed());
// debug: print out some info from the database
Promise.all([Accounts.findAll(), Devices.findAll(), Drives.findAll()])
.then(([accounts, devices, drives]) => {
logger.info(`Found ${accounts.length} accounts`);
logger.info(`Found ${devices.length} devices`);
logger.info(`Found ${drives.length} drives`);
});
app.use(cors({
origin: ['http://localhost:3000', 'https://connect.retropilot.org'],
credentials: true,