|
| 1 | +/** |
| 2 | + * Seed data for documentation examples. |
| 3 | + * This command is run automatically when the WASM database initializes. |
| 4 | + * All statements are combined with semicolons and executed as a single command. |
| 5 | + */ |
| 6 | + |
| 7 | +export const seedCommand = ` |
| 8 | +create namespace app; |
| 9 | +
|
| 10 | +create table app.users { id: int4, name: utf8, email: utf8, role: utf8, age: int4, status: utf8, active: bool, created_at: datetime, first_name: utf8, last_name: utf8, deleted_at: datetime }; |
| 11 | +from [ |
| 12 | + { id: 1, name: "Alice", email: "alice@example.com", role: "admin", age: 30, status: "active", active: true, created_at: cast("2024-01-15T10:30:00", datetime), first_name: "Alice", last_name: "Smith", deleted_at: undefined }, |
| 13 | + { id: 2, name: "Bob", email: "bob@example.com", role: "user", age: 25, status: "active", active: true, created_at: cast("2024-02-20T14:00:00", datetime), first_name: "Bob", last_name: "Jones", deleted_at: undefined }, |
| 14 | + { id: 3, name: "Carol", email: "carol@example.com", role: "user", age: 35, status: "inactive", active: false, created_at: cast("2023-12-01T09:00:00", datetime), first_name: "Carol", last_name: "Wilson", deleted_at: cast("2024-06-01T00:00:00", datetime) }, |
| 15 | + { id: 4, name: "David", email: "david@example.com", role: "admin", age: 28, status: "active", active: true, created_at: cast("2024-03-10T08:15:00", datetime), first_name: "David", last_name: "Brown", deleted_at: undefined }, |
| 16 | + { id: 5, name: "Eve", email: "eve@example.com", role: "user", age: 32, status: "active", active: true, created_at: cast("2024-04-05T16:45:00", datetime), first_name: "Eve", last_name: "Davis", deleted_at: undefined } |
| 17 | +] insert app.users; |
| 18 | +
|
| 19 | +create table app.orders { id: int4, total: float4, status: utf8, region: utf8, created_at: datetime, order_date: date }; |
| 20 | +from [ |
| 21 | + { id: 1, total: 150.50, status: "completed", region: "North", created_at: cast("2024-01-15T10:30:00", datetime), order_date: cast("2024-01-15", date) }, |
| 22 | + { id: 2, total: 89.99, status: "pending", region: "South", created_at: cast("2024-02-20T14:00:00", datetime), order_date: cast("2024-02-20", date) }, |
| 23 | + { id: 3, total: 245.00, status: "completed", region: "East", created_at: cast("2024-03-10T09:15:00", datetime), order_date: cast("2024-03-10", date) }, |
| 24 | + { id: 4, total: 55.25, status: "completed", region: "West", created_at: cast("2024-04-05T11:30:00", datetime), order_date: cast("2024-04-05", date) }, |
| 25 | + { id: 5, total: 320.75, status: "pending", region: "North", created_at: cast("2024-05-12T16:00:00", datetime), order_date: cast("2024-05-12", date) } |
| 26 | +] insert app.orders; |
| 27 | +
|
| 28 | +create table app.products { id: int4, name: utf8, sku: utf8, price: float4, category: utf8 }; |
| 29 | +from [ |
| 30 | + { id: 1, name: "Widget", sku: "WGT-001", price: 29.99, category: "Electronics" }, |
| 31 | + { id: 2, name: "Gadget", sku: "GDT-002", price: 49.99, category: "Electronics" }, |
| 32 | + { id: 3, name: "Gizmo", sku: "GZM-003", price: 19.99, category: "Accessories" }, |
| 33 | + { id: 4, name: "Doohickey", sku: "DHK-004", price: 99.99, category: "Hardware" }, |
| 34 | + { id: 5, name: "Thingamajig", sku: "TMJ-005", price: 15.50, category: "Accessories" } |
| 35 | +] insert app.products; |
| 36 | +
|
| 37 | +create table app.sales { id: int4, amount: float4, region: utf8, month: utf8 }; |
| 38 | +from [ |
| 39 | + { id: 1, amount: 1500.00, region: "North", month: "January" }, |
| 40 | + { id: 2, amount: 2300.50, region: "South", month: "January" }, |
| 41 | + { id: 3, amount: 1800.25, region: "East", month: "February" }, |
| 42 | + { id: 4, amount: 2100.00, region: "West", month: "February" }, |
| 43 | + { id: 5, amount: 1950.75, region: "North", month: "March" } |
| 44 | +] insert app.sales; |
| 45 | +
|
| 46 | +create table app.events { id: int4, created_at: datetime, timestamp: datetime }; |
| 47 | +from [ |
| 48 | + { id: 1, created_at: cast("2024-01-15T10:30:00", datetime), timestamp: cast("2024-01-15T10:30:00", datetime) }, |
| 49 | + { id: 2, created_at: cast("2024-02-20T14:00:00", datetime), timestamp: cast("2024-02-20T14:00:00", datetime) }, |
| 50 | + { id: 3, created_at: cast("2024-03-10T09:15:00", datetime), timestamp: cast("2024-03-10T09:15:00", datetime) }, |
| 51 | + { id: 4, created_at: cast("2024-04-05T16:45:00", datetime), timestamp: cast("2024-04-05T16:45:00", datetime) }, |
| 52 | + { id: 5, created_at: cast("2024-05-12T08:00:00", datetime), timestamp: cast("2024-05-12T08:00:00", datetime) } |
| 53 | +] insert app.events; |
| 54 | +
|
| 55 | +create table app.employees { id: int4, dept_id: int4, salary: float4 }; |
| 56 | +from [ |
| 57 | + { id: 1, dept_id: 1, salary: 75000.00 }, |
| 58 | + { id: 2, dept_id: 1, salary: 82000.00 }, |
| 59 | + { id: 3, dept_id: 2, salary: 65000.00 }, |
| 60 | + { id: 4, dept_id: 2, salary: 71000.00 }, |
| 61 | + { id: 5, dept_id: 3, salary: 90000.00 } |
| 62 | +] insert app.employees; |
| 63 | +
|
| 64 | +create table app.departments { id: int4, name: utf8 }; |
| 65 | +from [ |
| 66 | + { id: 1, name: "Engineering" }, |
| 67 | + { id: 2, name: "Marketing" }, |
| 68 | + { id: 3, name: "Sales" }, |
| 69 | + { id: 4, name: "HR" } |
| 70 | +] insert app.departments; |
| 71 | +
|
| 72 | +create table app.subscriptions { id: int4, start_date: datetime }; |
| 73 | +from [ |
| 74 | + { id: 1, start_date: cast("2024-01-01T00:00:00", datetime) }, |
| 75 | + { id: 2, start_date: cast("2024-02-15T00:00:00", datetime) }, |
| 76 | + { id: 3, start_date: cast("2024-03-20T00:00:00", datetime) }, |
| 77 | + { id: 4, start_date: cast("2024-04-10T00:00:00", datetime) } |
| 78 | +] insert app.subscriptions; |
| 79 | +
|
| 80 | +create table app.sessions { id: int4, start_time: datetime, end_time: datetime }; |
| 81 | +from [ |
| 82 | + { id: 1, start_time: cast("2024-01-15T09:00:00", datetime), end_time: cast("2024-01-15T10:30:00", datetime) }, |
| 83 | + { id: 2, start_time: cast("2024-01-15T11:00:00", datetime), end_time: cast("2024-01-15T12:00:00", datetime) }, |
| 84 | + { id: 3, start_time: cast("2024-01-16T14:00:00", datetime), end_time: cast("2024-01-16T15:45:00", datetime) }, |
| 85 | + { id: 4, start_time: cast("2024-01-17T08:30:00", datetime), end_time: cast("2024-01-17T09:15:00", datetime) } |
| 86 | +] insert app.sessions; |
| 87 | +
|
| 88 | +create table app.logs { id: int4, timestamp: datetime }; |
| 89 | +from [ |
| 90 | + { id: 1, timestamp: cast("2024-01-15T10:30:45", datetime) }, |
| 91 | + { id: 2, timestamp: cast("2024-01-15T10:31:22", datetime) }, |
| 92 | + { id: 3, timestamp: cast("2024-01-15T10:32:01", datetime) }, |
| 93 | + { id: 4, timestamp: cast("2024-01-15T10:33:18", datetime) } |
| 94 | +] insert app.logs; |
| 95 | +
|
| 96 | +create table app.tasks { id: int4, due_date: datetime }; |
| 97 | +from [ |
| 98 | + { id: 1, due_date: cast("2024-02-01T17:00:00", datetime) }, |
| 99 | + { id: 2, due_date: cast("2024-02-15T12:00:00", datetime) }, |
| 100 | + { id: 3, due_date: cast("2024-03-01T09:00:00", datetime) }, |
| 101 | + { id: 4, due_date: cast("2024-03-15T14:00:00", datetime) } |
| 102 | +] insert app.tasks; |
| 103 | +
|
| 104 | +create table app.records { id: int4, created_at: datetime }; |
| 105 | +from [ |
| 106 | + { id: 1, created_at: cast("2024-01-10T08:00:00", datetime) }, |
| 107 | + { id: 2, created_at: cast("2024-01-20T09:30:00", datetime) }, |
| 108 | + { id: 3, created_at: cast("2024-02-05T14:15:00", datetime) }, |
| 109 | + { id: 4, created_at: cast("2024-02-25T16:45:00", datetime) } |
| 110 | +] insert app.records; |
| 111 | +
|
| 112 | +create table app.requests { id: int4, timestamp: datetime }; |
| 113 | +from [ |
| 114 | + { id: 1, timestamp: cast("2024-01-15T10:30:00", datetime) }, |
| 115 | + { id: 2, timestamp: cast("2024-01-15T10:30:05", datetime) }, |
| 116 | + { id: 3, timestamp: cast("2024-01-15T10:30:10", datetime) }, |
| 117 | + { id: 4, timestamp: cast("2024-01-15T10:30:15", datetime) } |
| 118 | +] insert app.requests; |
| 119 | +
|
| 120 | +create table app.posts { id: int4, content: utf8 }; |
| 121 | +from [ |
| 122 | + { id: 1, content: "Hello world! This is my first post." }, |
| 123 | + { id: 2, content: "Learning RQL is fun and easy." }, |
| 124 | + { id: 3, content: "Check out this amazing new feature!" }, |
| 125 | + { id: 4, content: "Tips for better database design." } |
| 126 | +] insert app.posts; |
| 127 | +
|
| 128 | +create table app.articles { id: int4, body: utf8 }; |
| 129 | +from [ |
| 130 | + { id: 1, body: "Introduction to ReifyDB and its powerful features for modern applications." }, |
| 131 | + { id: 2, body: "Advanced query techniques using RQL expressions and transforms." }, |
| 132 | + { id: 3, body: "Best practices for data modeling in document databases." }, |
| 133 | + { id: 4, body: "Performance optimization strategies for large datasets." } |
| 134 | +] insert app.articles; |
| 135 | +
|
| 136 | +create table app.usernames { id: int4, username: utf8 }; |
| 137 | +from [ |
| 138 | + { id: 1, username: "alice_smith" }, |
| 139 | + { id: 2, username: "bob_jones" }, |
| 140 | + { id: 3, username: "carol_wilson" }, |
| 141 | + { id: 4, username: "david_brown" } |
| 142 | +] insert app.usernames; |
| 143 | +
|
| 144 | +create table app.comments { id: int4, text: utf8 }; |
| 145 | +from [ |
| 146 | + { id: 1, text: "Great article! Very helpful." }, |
| 147 | + { id: 2, text: "Thanks for sharing this information." }, |
| 148 | + { id: 3, text: "I have a question about the second point." }, |
| 149 | + { id: 4, text: "This solved my problem perfectly." } |
| 150 | +] insert app.comments; |
| 151 | +
|
| 152 | +create table app.inputs { id: int4, value: utf8 }; |
| 153 | +from [ |
| 154 | + { id: 1, value: " hello world " }, |
| 155 | + { id: 2, value: " test input " }, |
| 156 | + { id: 3, value: "trimmed" }, |
| 157 | + { id: 4, value: " spaces " } |
| 158 | +] insert app.inputs; |
| 159 | +
|
| 160 | +create table app.codes { id: int4, code: utf8 }; |
| 161 | +from [ |
| 162 | + { id: 1, code: "ABC123" }, |
| 163 | + { id: 2, code: "def456" }, |
| 164 | + { id: 3, code: "GHI789" }, |
| 165 | + { id: 4, code: "jkl012" } |
| 166 | +] insert app.codes; |
| 167 | +
|
| 168 | +create table app.identifiers { id: int4, code: utf8 }; |
| 169 | +from [ |
| 170 | + { id: 1, code: "ID-001-A" }, |
| 171 | + { id: 2, code: "ID-002-B" }, |
| 172 | + { id: 3, code: "ID-003-C" }, |
| 173 | + { id: 4, code: "ID-004-D" } |
| 174 | +] insert app.identifiers; |
| 175 | +
|
| 176 | +create table app.pages { id: int4, category: utf8, slug: utf8 }; |
| 177 | +from [ |
| 178 | + { id: 1, category: "blog", slug: "getting-started" }, |
| 179 | + { id: 2, category: "docs", slug: "api-reference" }, |
| 180 | + { id: 3, category: "blog", slug: "advanced-queries" }, |
| 181 | + { id: 4, category: "docs", slug: "installation-guide" } |
| 182 | +] insert app.pages; |
| 183 | +
|
| 184 | +create table app.transactions { id: int4, amount: float4 }; |
| 185 | +from [ |
| 186 | + { id: 1, amount: 150.50 }, |
| 187 | + { id: 2, amount: -75.25 }, |
| 188 | + { id: 3, amount: 200.00 }, |
| 189 | + { id: 4, amount: -30.00 }, |
| 190 | + { id: 5, amount: 500.75 } |
| 191 | +] insert app.transactions; |
| 192 | +
|
| 193 | +create table app.balances { id: int4, balance: float4 }; |
| 194 | +from [ |
| 195 | + { id: 1, balance: 1250.50 }, |
| 196 | + { id: 2, balance: 890.75 }, |
| 197 | + { id: 3, balance: 3200.00 }, |
| 198 | + { id: 4, balance: 45.25 } |
| 199 | +] insert app.balances; |
| 200 | +
|
| 201 | +create table app.measurements { id: int4, value: float4 }; |
| 202 | +from [ |
| 203 | + { id: 1, value: 23.456 }, |
| 204 | + { id: 2, value: 45.789 }, |
| 205 | + { id: 3, value: 12.345 }, |
| 206 | + { id: 4, value: 67.890 } |
| 207 | +] insert app.measurements; |
| 208 | +
|
| 209 | +create table app.scores { id: int4, score: float4 }; |
| 210 | +from [ |
| 211 | + { id: 1, score: 85.5 }, |
| 212 | + { id: 2, score: 92.0 }, |
| 213 | + { id: 3, score: 78.25 }, |
| 214 | + { id: 4, score: 88.75 }, |
| 215 | + { id: 5, score: 95.0 } |
| 216 | +] insert app.scores; |
| 217 | +
|
| 218 | +create table app.resources { id: int4, usage_ratio: float4 }; |
| 219 | +from [ |
| 220 | + { id: 1, usage_ratio: 0.75 }, |
| 221 | + { id: 2, usage_ratio: 0.45 }, |
| 222 | + { id: 3, usage_ratio: 0.92 }, |
| 223 | + { id: 4, usage_ratio: 0.33 } |
| 224 | +] insert app.resources; |
| 225 | +
|
| 226 | +create table app.numbers { id: int4, value: float4 }; |
| 227 | +from [ |
| 228 | + { id: 1, value: 3.7 }, |
| 229 | + { id: 2, value: 8.2 }, |
| 230 | + { id: 3, value: 5.5 }, |
| 231 | + { id: 4, value: 9.9 } |
| 232 | +] insert app.numbers; |
| 233 | +
|
| 234 | +create table app.investments { id: int4, principal: float4, rate: float4, years: int4 }; |
| 235 | +from [ |
| 236 | + { id: 1, principal: 10000.00, rate: 0.05, years: 5 }, |
| 237 | + { id: 2, principal: 5000.00, rate: 0.07, years: 3 }, |
| 238 | + { id: 3, principal: 25000.00, rate: 0.04, years: 10 }, |
| 239 | + { id: 4, principal: 15000.00, rate: 0.06, years: 7 } |
| 240 | +] insert app.investments; |
| 241 | +
|
| 242 | +create table app.prices { id: int4, price: float4 }; |
| 243 | +from [ |
| 244 | + { id: 1, price: 19.99 }, |
| 245 | + { id: 2, price: 49.50 }, |
| 246 | + { id: 3, price: 99.95 }, |
| 247 | + { id: 4, price: 29.99 } |
| 248 | +] insert app.prices; |
| 249 | +
|
| 250 | +create table app.metrics { id: int4, value: float4 }; |
| 251 | +from [ |
| 252 | + { id: 1, value: 125.5 }, |
| 253 | + { id: 2, value: 230.75 }, |
| 254 | + { id: 3, value: 89.25 }, |
| 255 | + { id: 4, value: 312.00 } |
| 256 | +] insert app.metrics; |
| 257 | +
|
| 258 | +create table app.data { id: int4, value: float4 }; |
| 259 | +from [ |
| 260 | + { id: 1, value: 42.0 }, |
| 261 | + { id: 2, value: 17.5 }, |
| 262 | + { id: 3, value: 99.9 }, |
| 263 | + { id: 4, value: 55.5 } |
| 264 | +] insert app.data |
| 265 | +`; |
0 commit comments