*************************** 101. row ***************************
       TABLE_CATALOG: def
        TABLE_SCHEMA: dogalhayat_02022022
          TABLE_NAME: vw_city_stats
     VIEW_DEFINITION: select `d`.`determination_city_id` AS `determination_city_id`,`dc`.`title` AS `city_title`,`d`.`determination_category_id` AS `determination_category_id`,`dcat`.`title` AS `category_title`,`d`.`user_id` AS `user_id`,`u`.`name` AS `user_name`,`d`.`determination_specie_id` AS `determination_specie_id`,`ds`.`title` AS `specie_title`,count(0) AS `total_count` from ((((`dogalhayat_02022022`.`determinations` `d` join `dogalhayat_02022022`.`determination_cities` `dc` on((`dc`.`id` = `d`.`determination_city_id`))) join `dogalhayat_02022022`.`determination_categories` `dcat` on((`dcat`.`id` = `d`.`determination_category_id`))) join `dogalhayat_02022022`.`users` `u` on((`u`.`id` = `d`.`user_id`))) left join `dogalhayat_02022022`.`determination_species` `ds` on((`ds`.`id` = `d`.`determination_specie_id`))) group by `d`.`determination_city_id`,`d`.`determination_category_id`,`d`.`user_id`,`d`.`determination_specie_id`
        CHECK_OPTION: NONE
        IS_UPDATABLE: NO
             DEFINER: dba_fkglss2@%
       SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: utf8mb4
COLLATION_CONNECTION: utf8mb4_unicode_ci
*************************** 102. row ***************************
       TABLE_CATALOG: def
        TABLE_SCHEMA: dogalhayat_02022022
          TABLE_NAME: vw_updates
     VIEW_DEFINITION: select `x`.`id` AS `id`,`x`.`title` AS `title`,`x`.`main_photo` AS `main_photo`,`x`.`slug` AS `slug`,`x`.`created_at` AS `created_at`,`x`.`type` AS `type`,`u`.`name` AS `name`,`u`.`avatar` AS `avatar`,(case when (`x`.`type` = 'determination') then concat(`x`.`title`,' başlıklı yeni bir tespit girişi yapılmıştır') when (`x`.`type` = 'comment') then `x`.`title` when (`x`.`type` = 'user') then concat(`u`.`name`,' isimli kullanıcı kaydı gerçekleşmiştir') end) AS `update_text` from ((select `d`.`id` AS `id`,`d`.`title` AS `title`,`d`.`main_photo` AS `main_photo`,`d`.`slug` AS `slug`,`d`.`created_at` AS `created_at`,'determination' AS `type`,`d`.`user_id` AS `user_id` from `dogalhayat_02022022`.`determinations` `d` where (`d`.`deleted_at` is null) union select `m`.`id` AS `id`,`m`.`comment_text` AS `comment_text`,NULL AS `NULL`,`d2`.`slug` AS `slug`,`m`.`created_at` AS `created_at`,'comment' AS `type`,`m`.`user_id` AS `user_id` from (`dogalhayat_02022022`.`determination_comments` `m` join `dogalhayat_02022022`.`determinations` `d2` on((`d2`.`id` = `m`.`determination_id`))) union select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`avatar` AS `avatar`,`u`.`user_name` AS `user_name`,`u`.`created_at` AS `created_at`,'user' AS `type`,`u`.`id` AS `user_id` from `dogalhayat_02022022`.`users` `u` where (0 <> (select count(0) from `dogalhayat_02022022`.`model_has_roles` `mhr` where (`mhr`.`model_id` = `u`.`id`)))) `x` left join `dogalhayat_02022022`.`users` `u` on((`u`.`id` = `x`.`user_id`))) order by `x`.`created_at` desc
        CHECK_OPTION: NONE
        IS_UPDATABLE: NO
             DEFINER: dba_fkglss2@%
       SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: utf8mb4
COLLATION_CONNECTION: utf8mb4_unicode_ci
*************************** 103. row ***************************
       TABLE_CATALOG: def
        TABLE_SCHEMA: dogalhayat_sercan
          TABLE_NAME: vw_city_stats
     VIEW_DEFINITION: select `d`.`determination_city_id` AS `determination_city_id`,`dc`.`title` AS `city_title`,`d`.`determination_category_id` AS `determination_category_id`,`dcat`.`title` AS `category_title`,`d`.`user_id` AS `user_id`,`u`.`name` AS `user_name`,`d`.`determination_specie_id` AS `determination_specie_id`,`ds`.`title` AS `specie_title`,count(0) AS `total_count` from ((((`dogalhayat_sercan`.`determinations` `d` join `dogalhayat_sercan`.`determination_cities` `dc` on((`dc`.`id` = `d`.`determination_city_id`))) join `dogalhayat_sercan`.`determination_categories` `dcat` on((`dcat`.`id` = `d`.`determination_category_id`))) join `dogalhayat_sercan`.`users` `u` on((`u`.`id` = `d`.`user_id`))) left join `dogalhayat_sercan`.`determination_species` `ds` on((`ds`.`id` = `d`.`determination_specie_id`))) group by `d`.`determination_city_id`,`d`.`determination_category_id`,`d`.`user_id`,`d`.`determination_specie_id`
        CHECK_OPTION: NONE
        IS_UPDATABLE: NO
             DEFINER: sercan@localhost
       SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: utf8mb4
COLLATION_CONNECTION: utf8mb4_unicode_ci
*************************** 104. row ***************************
       TABLE_CATALOG: def
        TABLE_SCHEMA: dogalhayat_sercan
          TABLE_NAME: vw_updates
     VIEW_DEFINITION: select `x`.`id` AS `id`,`x`.`title` AS `title`,`x`.`main_photo` AS `main_photo`,`x`.`slug` AS `slug`,`x`.`created_at` AS `created_at`,`x`.`type` AS `type`,`u`.`name` AS `name`,`u`.`avatar` AS `avatar` from ((select `d`.`id` AS `id`,`d`.`title` AS `title`,`d`.`main_photo` AS `main_photo`,`d`.`slug` AS `slug`,`d`.`created_at` AS `created_at`,'determination' AS `type`,`d`.`user_id` AS `user_id` from `dogalhayat_sercan`.`determinations` `d` union select `m`.`id` AS `id`,`m`.`comment_text` AS `comment_text`,NULL AS `NULL`,`m`.`id` AS `id`,`m`.`created_at` AS `created_at`,'comment' AS `type`,`m`.`user_id` AS `user_id` from `dogalhayat_sercan`.`determination_comments` `m` union select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`avatar` AS `avatar`,`u`.`user_name` AS `user_name`,`u`.`created_at` AS `created_at`,'user' AS `type`,`u`.`id` AS `user_id` from `dogalhayat_sercan`.`users` `u`) `x` left join `dogalhayat_sercan`.`users` `u` on((`u`.`id` = `x`.`user_id`))) order by `x`.`created_at` desc
        CHECK_OPTION: NONE
        IS_UPDATABLE: NO
             DEFINER: sercan@localhost
       SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: utf8mb4
COLLATION_CONNECTION: utf8mb4_unicode_ci
104 rows in set (0.00 sec)

| before_users_insert | INSERT | users | BEGIN
    DECLARE rowcount INT;
    
    SELECT COUNT(*) 
    INTO rowcount
    FROM users where created_at between (DATE_SUB(NOW(),INTERVAL 5 MINUTE)) AND NOW();
    
    IF rowcount > 50 THEN
        signal sqlstate '45000';
    END IF; 

END | BEFORE | 2023-04-16 15:47:21.49 | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION | dba_fkglss2@% | utf8mb4              | utf8mb4_unicode_ci   | utf8mb4_0900_ai_ci |
