fix: auto-create auth tables on startup to bypass docker swarm config caching
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m8s

This commit is contained in:
Cauê Faleiros
2026-03-05 16:38:44 -03:00
parent daad542527
commit c8c6f5a080

View File

@@ -616,6 +616,32 @@ const provisionSuperAdmin = async (retries = 10, delay = 10000) => {
try {
// Test connection first
const connection = await pool.getConnection();
// Auto-create missing tables to prevent issues with outdated Docker configs/volumes
await connection.query(`
CREATE TABLE IF NOT EXISTS password_resets (
email varchar(255) NOT NULL,
token varchar(255) NOT NULL,
expires_at timestamp NOT NULL,
created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (token),
KEY email (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`);
await connection.query(`
CREATE TABLE IF NOT EXISTS pending_registrations (
email varchar(255) NOT NULL,
password_hash varchar(255) NOT NULL,
full_name varchar(255) NOT NULL,
organization_name varchar(255) NOT NULL,
verification_code varchar(10) NOT NULL,
expires_at timestamp NOT NULL,
created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`);
connection.release();
// Ensure system tenant exists