| 1 | CREATE EXTENSION IF NOT EXISTS vector;
|
|---|
| 2 |
|
|---|
| 3 | ALTER TABLE media
|
|---|
| 4 | ADD COLUMN embedding vector(4);
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 | TRUNCATE TABLE "review" RESTART IDENTITY;
|
|---|
| 8 |
|
|---|
| 9 | DO $$
|
|---|
| 10 | DECLARE
|
|---|
| 11 | user_ids int[] := ARRAY(SELECT UserID FROM "User");
|
|---|
| 12 | media_ids int[] := ARRAY(SELECT ContentID FROM "media");
|
|---|
| 13 | u_count int := cardinality(user_ids);
|
|---|
| 14 | m_count int := cardinality(media_ids);
|
|---|
| 15 | BEGIN
|
|---|
| 16 | INSERT INTO "review" (Comment, ReviewDate, UserUserID, ContentContentID)
|
|---|
| 17 | SELECT
|
|---|
| 18 | (ARRAY[
|
|---|
| 19 | 'Absolutely amazing, one of the best!',
|
|---|
| 20 | 'Great story, highly recommend.',
|
|---|
| 21 | 'A bit slow at the start but gets better.',
|
|---|
| 22 | 'Masterpiece of cinema.',
|
|---|
| 23 | 'Not what I expected but still enjoyable.',
|
|---|
| 24 | 'Incredible performances all around.',
|
|---|
| 25 | 'The ending blew my mind.',
|
|---|
| 26 | 'Would watch again without hesitation.',
|
|---|
| 27 | 'Overrated in my opinion.',
|
|---|
| 28 | 'A classic that stands the test of time.',
|
|---|
| 29 | 'Great cinematography and direction.',
|
|---|
| 30 | 'The plot had some holes but overall good.',
|
|---|
| 31 | 'One of the best series ever made.',
|
|---|
| 32 | 'Keeps you on the edge of your seat.',
|
|---|
| 33 | 'The writing is absolutely top-notch.',
|
|---|
| 34 | 'Brilliant acting from start to finish.',
|
|---|
| 35 | 'A must watch for everyone.',
|
|---|
| 36 | 'Did not live up to the hype.',
|
|---|
| 37 | 'Absolutely loved every minute of it.',
|
|---|
| 38 | 'A cinematic masterpiece.',
|
|---|
| 39 | 'This man is my worst nightmare. 10/10',
|
|---|
| 40 | 'No.',
|
|---|
| 41 | 'The portrayal of toxic relationships is very good.'
|
|---|
| 42 | ])[ceil(random() * 23)::int],
|
|---|
| 43 | CURRENT_DATE - (random() * 730)::int,
|
|---|
| 44 | -- Директно влечење од низата со нов случаен индекс за секој ред
|
|---|
| 45 | user_ids[ceil(random() * u_count)::int],
|
|---|
| 46 | media_ids[ceil(random() * m_count)::int]
|
|---|
| 47 | FROM
|
|---|
| 48 | generate_series(1, 10000000) AS gs;
|
|---|
| 49 | END $$; |
|---|