text: CREATE TABLE `badge_users` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `badge_id` int(10) unsigned NOT NULL,
    `user_id` int(10) unsigned NOT NULL,
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `badge_users_badge_id_user_id_unique` (`badge_id`,`user_id`),
    KEY `badge_users_user_id_foreign` (`user_id`),
    CONSTRAINT `badge_users_badge_id_foreign` FOREIGN KEY (`badge_id`) REFERENCES `badges` (`id`) ON DELETE CASCADE,
    CONSTRAINT `badge_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;