@@ -9,7 +9,9 @@ CREATE TABLE users (
99 email TEXT UNIQUE NOT NULL ,
1010 age INTEGER ,
1111 created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ,
12- is_active BOOLEAN DEFAULT TRUE
12+ is_active BOOLEAN DEFAULT TRUE,
13+ profile JSON,
14+ preferences JSONB
1315);
1416
1517-- Create products table with arrays
@@ -19,32 +21,69 @@ CREATE TABLE products (
1921 tags TEXT [], -- Array of text
2022 scores INTEGER [], -- Array of integers
2123 metadata JSONB,
24+ details JSON,
2225 created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
2326);
2427
2528-- Insert comprehensive test data for users
26- INSERT INTO users (name, email, age, created_at, is_active) VALUES
27- (
' John Doe' ,
' [email protected] ' ,
30 ,
' 2024-07-01 10:00:00+00' , TRUE),
28- (
' Jane Smith' ,
' [email protected] ' ,
25 ,
' 2024-06-15 15:30:00+00' , TRUE),
29- (
' Bob Johnson' ,
' [email protected] ' ,
35 ,
' 2024-05-20 09:45:00+00' , FALSE),
30- (
' Alice Brown' ,
' [email protected] ' ,
28 ,
' 2024-08-10 14:20:00+00' , TRUE),
31- (
' Charlie Wilson' ,
' [email protected] ' ,
42 ,
' 2024-03-12 11:15:00+00' , TRUE),
32- (
' Diana Davis' ,
' [email protected] ' ,
23 ,
' 2024-09-01 16:45:00+00' , TRUE),
33- (
' Eve Martinez' ,
' [email protected] ' ,
31 ,
' 2024-04-18 08:30:00+00' , FALSE);
29+ INSERT INTO users (name, email, age, created_at, is_active, profile, preferences) VALUES
30+ (
' John Doe' ,
' [email protected] ' ,
30 ,
' 2024-07-01 10:00:00+00' , TRUE,
31+ ' {"bio": "Software developer", "location": "New York", "skills": ["JavaScript", "Python"]}' ,
32+ ' {"theme": "dark", "notifications": true, "language": "en"}' ),
33+ (
' Jane Smith' ,
' [email protected] ' ,
25 ,
' 2024-06-15 15:30:00+00' , TRUE,
34+ ' {"bio": "Designer", "location": "San Francisco", "skills": ["UI/UX", "Photoshop"]}' ,
35+ ' {"theme": "light", "notifications": false, "language": "en"}' ),
36+ (
' Bob Johnson' ,
' [email protected] ' ,
35 ,
' 2024-05-20 09:45:00+00' , FALSE,
37+ ' {"bio": "Manager", "location": "Chicago", "skills": ["Leadership", "Strategy"]}' ,
38+ ' {"theme": "auto", "notifications": true, "language": "es"}' ),
39+ (
' Alice Brown' ,
' [email protected] ' ,
28 ,
' 2024-08-10 14:20:00+00' , TRUE,
40+ ' {"bio": "Data scientist", "location": "Seattle", "skills": ["Python", "R", "SQL"]}' ,
41+ ' {"theme": "dark", "notifications": true, "language": "en"}' ),
42+ (
' Charlie Wilson' ,
' [email protected] ' ,
42 ,
' 2024-03-12 11:15:00+00' , TRUE,
43+ ' {"bio": "Architect", "location": "Austin", "skills": ["Design", "Planning"]}' ,
44+ ' {"theme": "light", "notifications": false, "language": "fr"}' ),
45+ (
' Diana Davis' ,
' [email protected] ' ,
23 ,
' 2024-09-01 16:45:00+00' , TRUE,
46+ ' {"bio": "Student", "location": "Boston", "skills": ["Learning", "Research"]}' ,
47+ ' {"theme": "dark", "notifications": true, "language": "en"}' ),
48+ (
' Eve Martinez' ,
' [email protected] ' ,
31 ,
' 2024-04-18 08:30:00+00' , FALSE,
49+ ' {"bio": "Marketing", "location": "Miami", "skills": ["Marketing", "Social Media"]}' ,
50+ ' {"theme": "auto", "notifications": false, "language": "es"}' );
3451
3552-- Insert comprehensive test data for products with arrays
36- INSERT INTO products (name, tags, scores, metadata, created_at) VALUES
37- (' Smartphone Pro' , ARRAY[' electronics' , ' mobile' , ' gadgets' ], ARRAY[95 , 87 , 92 ], ' {"brand": "TechCorp", "category": "electronics"}' , ' 2024-06-01 10:00:00+00' ),
38- (' Laptop Ultra' , ARRAY[' electronics' , ' computers' ], ARRAY[92 , 95 , 88 ], ' {"brand": "CompuTech", "category": "electronics"}' , ' 2024-05-15 14:30:00+00' ),
39- (' Mystery Novel' , ARRAY[' books' , ' fiction' , ' mystery' ], ARRAY[85 , 90 , 87 ], ' {"author": "John Author", "genre": "fiction"}' , ' 2024-07-20 09:15:00+00' ),
40- (' Sports T-Shirt' , ARRAY[' clothing' , ' apparel' ], ARRAY[88 , 91 , 89 ], ' {"size": "M", "color": "blue"}' , ' 2024-08-05 12:45:00+00' ),
41- (' Gaming Console' , ARRAY[' electronics' , ' gaming' ], ARRAY[96 , 94 , 93 ], ' {"brand": "GameTech", "category": "gaming"}' , ' 2024-04-22 16:20:00+00' );
53+ INSERT INTO products (name, tags, scores, metadata, details, created_at) VALUES
54+ (' Smartphone Pro' , ARRAY[' electronics' , ' mobile' , ' gadgets' ], ARRAY[95 , 87 , 92 ],
55+ ' {"brand": "TechCorp", "category": "electronics", "price": 999.99, "features": ["5G", "Camera", "GPS"]}' ,
56+ ' {"warranty": "2 years", "color": "black", "storage": "256GB"}' ,
57+ ' 2024-06-01 10:00:00+00' ),
58+ (' Laptop Ultra' , ARRAY[' electronics' , ' computers' ], ARRAY[92 , 95 , 88 ],
59+ ' {"brand": "CompuTech", "category": "electronics", "price": 1499.99, "features": ["SSD", "16GB RAM", "Intel i7"]}' ,
60+ ' {"warranty": "3 years", "color": "silver", "screen": "15.6 inch"}' ,
61+ ' 2024-05-15 14:30:00+00' ),
62+ (' Mystery Novel' , ARRAY[' books' , ' fiction' , ' mystery' ], ARRAY[85 , 90 , 87 ],
63+ ' {"author": "John Author", "genre": "fiction", "price": 12.99, "pages": 320}' ,
64+ ' {"publisher": "BookHouse", "language": "English", "isbn": "978-0123456789"}' ,
65+ ' 2024-07-20 09:15:00+00' ),
66+ (' Sports T-Shirt' , ARRAY[' clothing' , ' apparel' ], ARRAY[88 , 91 , 89 ],
67+ ' {"size": "M", "color": "blue", "price": 29.99, "material": "cotton"}' ,
68+ ' {"brand": "SportWear", "care": "machine wash", "fit": "regular"}' ,
69+ ' 2024-08-05 12:45:00+00' ),
70+ (' Gaming Console' , ARRAY[' electronics' , ' gaming' ], ARRAY[96 , 94 , 93 ],
71+ ' {"brand": "GameTech", "category": "gaming", "price": 499.99, "features": ["4K", "HDR", "VR Ready"]}' ,
72+ ' {"warranty": "1 year", "color": "white", "storage": "1TB"}' ,
73+ ' 2024-04-22 16:20:00+00' );
4274
4375-- Add some additional test data for edge cases
44- INSERT INTO users (name, email, age, created_at, is_active) VALUES
45- (
' Test User Old' ,
' [email protected] ' ,
65 ,
' 2023-12-01 10:00:00+00' , FALSE),
46- (
' Test User Young' ,
' [email protected] ' ,
18 ,
' 2024-10-01 10:00:00+00' , TRUE);
76+ INSERT INTO users (name, email, age, created_at, is_active, profile, preferences) VALUES
77+ (
' Test User Old' ,
' [email protected] ' ,
65 ,
' 2023-12-01 10:00:00+00' , FALSE,
78+ ' {"bio": "Retired", "location": "Florida", "skills": ["Wisdom", "Experience"]}' ,
79+ ' {"theme": "light", "notifications": false, "language": "en"}' ),
80+ (
' Test User Young' ,
' [email protected] ' ,
18 ,
' 2024-10-01 10:00:00+00' , TRUE,
81+ ' {"bio": "Student", "location": "California", "skills": ["Learning", "Gaming"]}' ,
82+ ' {"theme": "dark", "notifications": true, "language": "en"}' );
4783
4884-- Add product with empty arrays for testing
49- INSERT INTO products (name, tags, scores, metadata, created_at) VALUES
50- (' Empty Product' , ARRAY[]::TEXT [], ARRAY[]::INTEGER [], ' {"empty": true}' , ' 2024-01-01 00:00:00+00' );
85+ INSERT INTO products (name, tags, scores, metadata, details, created_at) VALUES
86+ (' Empty Product' , ARRAY[]::TEXT [], ARRAY[]::INTEGER [],
87+ ' {"empty": true, "test": "data"}' ,
88+ ' {"description": "Test product with empty arrays"}' ,
89+ ' 2024-01-01 00:00:00+00' );
0 commit comments