fix: remove dummy data from sql and automate schema migrations on startup
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m7s

This commit is contained in:
Cauê Faleiros
2026-03-06 10:20:43 -03:00
parent 3efb949605
commit 34ff18d8dc
2 changed files with 15 additions and 22 deletions

View File

@@ -661,6 +661,21 @@ const provisionSuperAdmin = async (retries = 10, delay = 10000) => {
PRIMARY KEY (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`);
// Add slug column if it doesn't exist
try {
await connection.query('ALTER TABLE users ADD COLUMN slug VARCHAR(255) UNIQUE DEFAULT NULL');
} catch (err) {
// Ignore error if column already exists (ER_DUP_FIELDNAME)
if (err.code !== 'ER_DUP_FIELDNAME') console.log('Schema update note (slug):', err.message);
}
// Update origin enum
try {
await connection.query("ALTER TABLE attendances MODIFY COLUMN origin ENUM('WhatsApp','Instagram','Website','LinkedIn','Indicação') NOT NULL");
} catch (err) {
console.log('Schema update note (origin):', err.message);
}
connection.release();