fix(scripts): use mysql.js registry in create-user instead of deleted barrel

This commit is contained in:
2026-04-27 01:10:29 +02:00
parent 29a29a5074
commit ec61ae6721
+1 -24
View File
@@ -116,32 +116,9 @@ const createUser = async () => {
await sequelize.authenticate(); await sequelize.authenticate();
console.log('✅ Connexion établie\n'); console.log('✅ Connexion établie\n');
// Initialize all models by calling their functions const DB = require('../src/database/mysql');
const rawDB = require('../src/database/models/mysql');
// Call each model function to initialize it
rawDB.User();
rawDB.Role();
rawDB.Article();
rawDB.Tag();
rawDB.TagList();
rawDB.UserRoleXref();
rawDB.Follower();
rawDB.Favorite();
rawDB.Comment();
rawDB.Brand();
rawDB.Category();
rawDB.Packaging();
rawDB.Product();
rawDB.ProductCategoryXref();
rawDB.ProductTagXref();
// Also initialize relationships
require('../src/database/relationships')(); require('../src/database/relationships')();
// Get the initialized models from sequelize
const DB = sequelize.models;
// Hash password with same algorithm as UserService // Hash password with same algorithm as UserService
const { salt, hash } = hashPassword(password); const { salt, hash } = hashPassword(password);