Repository navigation
Expand file tree
/
Copy pathdemoData.sql
More file actions
75 lines (70 loc) · 7.03 KB
/
Copy pathdemoData.sql
File metadata and controls
75 lines (70 loc) · 7.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
USE threadit;
-- --------------------------------------------------------
-- 1. Populate Users (Passwords updated to requested hash)
-- --------------------------------------------------------
INSERT INTO users (id, username, email, password, created_at) VALUES
(1, 'tech_guru', 'guru@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-01-10 10:00:00'),
(2, 'code_newbie', 'newbie@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-01-11 14:22:00'),
(3, 'alice_dev', 'alice@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-01-12 09:15:00'),
(4, 'bob_coder', 'bob@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-01-15 18:40:00'),
(5, 'database_boss', 'db_boss@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-01-18 11:05:00'),
(6, 'charlie_brown', 'charlie@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-02-01 08:30:00'),
(7, 'web_weaver', 'weaver@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-02-03 21:12:00'),
(8, 'shadow_coder', 'shadow@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-02-10 13:45:00'),
(9, 'pixel_perfect', 'pixel@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-02-14 16:18:00'),
(10, 'stack_master', 'stack@example.com', '$2y$10$jA3Xgo7pTdetqAGNXRhSJuQlEl0mS/.k/ErPZK3bJlgdbi9FCIr2G', '2026-02-20 19:02:00');
-- --------------------------------------------------------
-- 2. Populate Threads
-- --------------------------------------------------------
INSERT INTO threads (id, title, content, user_id, created_at) VALUES
(1, 'Why is Vanilla JavaScript making a comeback?', 'With frameworks getting heavier and build steps becoming overly complex, I find myself writing more vanilla JS with custom elements. Anyone else moving away from React/Vue?', 1, '2026-02-21 10:00:00'),
(2, 'How to optimize deeply nested SQL queries?', 'I have a tracking table with millions of rows. My JOIN statements are taking upwards of 4 seconds to execute. What are your go-to indexing strategies for optimization?', 5, '2026-02-22 11:30:00'),
(3, 'What is the best language to learn in 2026?', 'Hey everyone! Absolute beginner here. I want to dive into backend engineering but I am stuck choosing between Python, Go, and Rust. What do you recommend?', 2, '2026-02-23 15:45:00'),
(4, 'CSS Container Queries are a total game changer', 'Seriously, if you are still relying entirely on media queries for responsive components, go check out container queries right now. It makes modular design so much easier.', 7, '2026-02-24 09:15:00'),
(5, 'Is AI writing your code or are you writing it?', 'Lately, I feel like I am just an editor for AI-generated boilerplate code. It speeds things up, but I feel like my actual logic-solving skills are getting rusty. Thoughts?', 4, '2026-02-25 14:00:00'),
(6, 'The worst deployment mistake you ever made?', 'Let’s clear the air and share some horror stories. I once dropped a production database instead of the staging one because the terminal tabs looked identical. Your turn!', 3, '2026-02-26 17:20:00');
-- --------------------------------------------------------
-- 3. Populate Comments
-- --------------------------------------------------------
INSERT INTO comments (id, content, user_id, thread_id, created_at) VALUES
(1, 'Totally agree. Standard web APIs have caught up. Things like FormData and standard query selectors make frameworks feel optional for smaller projects.', 3, 1, '2026-02-21 10:15:00'),
(2, 'While that is true for blogs or simple landing pages, good luck managing state in a massive enterprise application without a structured framework.', 10, 1, '2026-02-21 10:45:00'),
(3, 'I love vanilla JS, but the script you shared earlier with an AJAX setup is exactly why people like frameworks. It handles all that boilerplate natively.', 4, 1, '2026-02-21 11:12:00'),
(4, 'Have you looked at your execution plan using EXPLAIN? Check if you are hitting full table scans. Indexing foreign keys is usually step one.', 1, 2, '2026-02-22 11:45:00'),
(5, 'Also, consider introducing a caching layer like Redis for data that doesn\'t change every second. Don\'t hit the database if you don\'t have to.', 10, 2, '2026-02-22 12:00:00'),
(6, 'Show us the query! It\'s hard to tell without seeing how many subqueries or aggregates you are running.', 8, 2, '2026-02-22 13:30:00'),
(7, 'Go with Python first to understand programming concepts without the brutal syntax. Once you get comfortable, look into Go for backend scaling.', 3, 3, '2026-02-23 16:00:00'),
(8, 'Do not start with Rust as a complete beginner. The borrow checker will make you want to throw your computer out the window.', 8, 3, '2026-02-23 16:15:00'),
(9, 'Thanks for the warning! I think I will stick to Python for a few months.', 2, 3, '2026-02-23 16:45:00'),
(10, 'Go is also incredibly elegant and readable. Definitely look into it after you grasp basic concepts.', 5, 3, '2026-02-23 17:00:00'),
(11, 'Browser support is finally great for this. It makes UI component libraries much more standalone and portable.', 9, 4, '2026-02-24 10:00:00'),
(12, 'I still catch myself using media queries out of muscle memory, but I am trying to break the habit.', 2, 4, '2026-02-24 11:22:00'),
(13, 'I treat it like a junior developer who writes incredibly fast but makes stupid mistakes. You have to review everything carefully.', 1, 5, '2026-02-25 14:30:00'),
(14, 'It has definitely made me lazier with syntax details, but it lets me focus much more on architecture and system design.', 6, 5, '2026-02-25 15:10:00'),
(15, 'Ouch! The terminal tab mistake is a classic. This is why my production terminal has a bright, flashing red background.', 5, 6, '2026-02-26 17:35:00'),
(16, 'I accidentally set an infinite loop in a script that emailed our entire user base. Sent about 15 duplicate marketing emails to 50k users before killing the process.', 7, 6, '2026-02-26 18:10:00'),
(17, 'Reading these comments makes me feel so much better about my minor git merge conflicts today.', 2, 6, '2026-02-26 19:00:00');
-- --------------------------------------------------------
-- 4. Populate Thread Votes (1 = Upvote, -1 = Downvote)
-- --------------------------------------------------------
INSERT INTO thread_votes (thread_id, user_id, value) VALUES
(1, 2, 1), (1, 3, 1), (1, 4, 1), (1, 10, -1), (1, 7, 1),
(2, 1, 1), (2, 8, 1), (2, 10, 1),
(3, 1, 1), (3, 3, 1), (3, 4, 1), (3, 5, 1), (3, 8, 1),
(4, 9, 1), (4, 2, 1),
(5, 1, 1), (5, 6, 1), (5, 2, -1), (5, 3, -1),
(6, 1, 1), (6, 2, 1), (6, 4, 1), (6, 5, 1), (6, 7, 1), (6, 9, 1);
-- --------------------------------------------------------
-- 5. Populate Comment Votes
-- --------------------------------------------------------
INSERT INTO comment_votes (comment_id, user_id, value) VALUES
(1, 1, 1), (1, 4, 1),
(2, 3, 1), (2, 1, -1),
(4, 5, 1), (4, 10, 1),
(5, 5, 1),
(7, 2, 1), (7, 8, 1),
(8, 2, 1), (8, 3, 1), (8, 5, 1),
(11, 7, 1),
(13, 4, 1), (13, 6, 1),
(15, 3, 1), (15, 7, 1),
(16, 3, 1), (16, 5, 1), (16, 1, 1);