Created
May 1, 2019 01:56
-
-
Save clarkbab/26c806c05fb66908cc09ef420c7acd7a to your computer and use it in GitHub Desktop.
Generates posts that we'll poll for comments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
CREATE PROCEDURE generate_data() | |
BEGIN | |
DECLARE i INT DEFAULT 1; | |
DECLARE num_records INT DEFAULT 150000; | |
DECLARE hours_per_year INT DEFAULT 8760; | |
DECLARE rand_time DATETIME; | |
WHILE i < num_records DO | |
SELECT NOW() - INTERVAL FLOOR(hours_per_year * RAND()) HOUR INTO rand_time; | |
INSERT INTO channels_resources (id, account_id, state, comment_id, ticket_id, resource_type, external_id, thread_id, source_id, created_at, updated_at) VALUES (i + 1000000, 2, 10, i, i, 'facebook_post', i, i, 12345, rand_time, rand_time); | |
SET i = i + 1; | |
END WHILE; | |
END$$ | |
DELIMITER ; | |
CALL generate_data(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment