Skip to content

Commit 537242c

Browse files
authored
[FDC] Add seed data for the initial template (#9232)
1 parent fdff7aa commit 537242c

4 files changed

Lines changed: 288 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
- CloudSQL instances created with `firebase dataconnect:connect` now default to Postgres 17.
21
- Fixed an issue with deploying indexes to Firestore Enterprise edition databases where explicit `__name__` fields could be incorrectly handled.
32
- The `experimental:mcp` command has been renamed to `mcp`. The old name is now an alias.
43
- `firebase_update_environment` MCP tool supports accepting Gemini in Firebase Terms of Service.
54
- Fixed a bug when `firebase init dataconnect` failed to create a React app when launched from VS Code extension (#9171).
6-
- Improved the clarity of the `firebase apptesting:execute` command when you have zero or multiple apps.
5+
- Added seed_data.gql to Data Connect's initial movie template (#9232).
76
- `firebase dataconnect:sql:migrate` now supports Cloud SQL instances with only private IPs. The command must be run in the same VPC of the instance to work. (##9200)
7+
- CloudSQL instances created with `firebase deploy` now default to Postgres 17.
8+
- Improved the clarity of the `firebase apptesting:execute` command when you have zero or multiple apps.
89
- Fixed an issue where `firebase deploy --only firestore` would fail with 403 errors on projects that never had a database created.

src/init/features/dataconnect/index.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ describe("init dataconnect", () => {
5454
expectedSource: "dataconnect",
5555
expectedFiles: [
5656
"dataconnect/dataconnect.yaml",
57+
"dataconnect/seed_data.gql",
5758
"dataconnect/schema/schema.gql",
5859
"dataconnect/example/connector.yaml",
5960
"dataconnect/example/queries.gql",
@@ -69,6 +70,7 @@ describe("init dataconnect", () => {
6970
expectedSource: "not-dataconnect",
7071
expectedFiles: [
7172
"not-dataconnect/dataconnect.yaml",
73+
"not-dataconnect/seed_data.gql",
7274
// Populate the default template.
7375
"not-dataconnect/schema/schema.gql",
7476
"not-dataconnect/example/connector.yaml",
@@ -133,6 +135,7 @@ describe("init dataconnect", () => {
133135
expectedSource: "dataconnect",
134136
expectedFiles: [
135137
"dataconnect/dataconnect.yaml",
138+
"dataconnect/seed_data.gql",
136139
"dataconnect/schema/schema.gql",
137140
"dataconnect/example/connector.yaml",
138141
"dataconnect/example/queries.gql",

src/init/features/dataconnect/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const CONNECTOR_YAML_TEMPLATE = readTemplateSync("init/dataconnect/connector.yam
4545
const SCHEMA_TEMPLATE = readTemplateSync("init/dataconnect/schema.gql");
4646
const QUERIES_TEMPLATE = readTemplateSync("init/dataconnect/queries.gql");
4747
const MUTATIONS_TEMPLATE = readTemplateSync("init/dataconnect/mutations.gql");
48+
const SEED_DATA_TEMPLATE = readTemplateSync("init/dataconnect/seed_data.gql");
4849

4950
export interface RequiredInfo {
5051
// The GA analytics metric to track how developers go through `init dataconnect`.
@@ -88,6 +89,7 @@ const templateServiceInfo: ServiceGQL = {
8889
],
8990
},
9091
],
92+
seedDataGql: SEED_DATA_TEMPLATE,
9193
};
9294

9395
// askQuestions prompts the user about the Data Connect service they want to init. Any prompting
@@ -114,7 +116,7 @@ export async function askQuestions(setup: Setup): Promise<void> {
114116
);
115117
}
116118
info.appDescription = await input({
117-
message: `Describe your app to automatically generate a schema with Gemini [Enter to skip]:`,
119+
message: `Describe your app to automatically generate a schema with Gemini [Enter to use a template]:`,
118120
});
119121
if (info.appDescription) {
120122
configstore.set("gemini", true);
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
mutation @transaction {
2+
movie_insertMany(
3+
data: [
4+
{
5+
id: "550e8400-e29b-41d4-a716-446655440000",
6+
title: "Quantum Paradox",
7+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fquantum_paradox.jpeg?alt=media&token=4142e2a1-bf43-43b5-b7cf-6616be3fd4e3",
8+
genre: "sci-fi"
9+
},
10+
{
11+
id: "550e8400-e29b-41d4-a716-446655440001",
12+
title: "The Lone Outlaw",
13+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Flone_outlaw.jpeg?alt=media&token=15525ffc-208f-4b59-b506-ae8348e06e85",
14+
genre: "western"
15+
},
16+
{
17+
id: "550e8400-e29b-41d4-a716-446655440002",
18+
title: "Celestial Harmony",
19+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fcelestial_harmony.jpeg?alt=media&token=3edf1cf9-c2f5-4c75-9819-36ff6a734c9a",
20+
genre: "romance"
21+
},
22+
{
23+
id: "550e8400-e29b-41d4-a716-446655440003",
24+
title: "Noir Mystique",
25+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fnoir_mystique.jpeg?alt=media&token=3299adba-cb98-4302-8b23-aeb679a4f913",
26+
genre: "mystery"
27+
},
28+
{
29+
id: "550e8400-e29b-41d4-a716-446655440004",
30+
title: "The Forgotten Island",
31+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fforgotten_island.jpeg?alt=media&token=bc2b16e1-caed-4649-952c-73b6113f205c",
32+
genre: "adventure"
33+
},
34+
{
35+
id: "550e8400-e29b-41d4-a716-446655440005",
36+
title: "Digital Nightmare",
37+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fdigital_nightmare.jpeg?alt=media&token=335ec842-1ca4-4b09-abd1-e96d9f5c0c2f",
38+
genre: "horror"
39+
},
40+
{
41+
id: "550e8400-e29b-41d4-a716-446655440006",
42+
title: "Eclipse of Destiny",
43+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Feclipse_destiny.jpeg?alt=media&token=346649b3-cb5c-4d7e-b0d4-6f02e3df5959",
44+
genre: "fantasy"
45+
},
46+
{
47+
id: "550e8400-e29b-41d4-a716-446655440007",
48+
title: "Heart of Steel",
49+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fheart_steel.jpeg?alt=media&token=17883d71-329b-415a-86f8-dd4d9e941d7f",
50+
genre: "sci-fi"
51+
},
52+
{
53+
id: "550e8400-e29b-41d4-a716-446655440008",
54+
title: "Rise of the Crimson Empire",
55+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Frise_crimson_empire.jpeg?alt=media&token=6faa73ad-7504-4146-8f3a-50b90f607f33",
56+
genre: "action"
57+
},
58+
{
59+
id: "550e8400-e29b-41d4-a716-446655440009",
60+
title: "Silent Waves",
61+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fsilent_waves.jpeg?alt=media&token=bd626bf1-ec60-4e57-aa07-87ba14e35bb7",
62+
genre: "drama"
63+
},
64+
{
65+
id: "550e8400-e29b-41d4-a716-446655440010",
66+
title: "Echoes of the Past",
67+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fecho_of_past.jpeg?alt=media&token=d866aa27-8534-4d72-8988-9da4a1b9e452",
68+
genre: "historical"
69+
},
70+
{
71+
id: "550e8400-e29b-41d4-a716-446655440011",
72+
title: "Beyond the Horizon",
73+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fbeyond_horizon.jpeg?alt=media&token=31493973-0692-4e6e-8b88-afb1aaea17ee",
74+
genre: "sci-fi"
75+
},
76+
{
77+
id: "550e8400-e29b-41d4-a716-446655440012",
78+
title: "Shadows and Lies",
79+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fshadows_lies.jpeg?alt=media&token=01afb80d-caee-47f8-a00e-aea8b9e459a2",
80+
genre: "crime"
81+
},
82+
{
83+
id: "550e8400-e29b-41d4-a716-446655440013",
84+
title: "The Last Symphony",
85+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Flast_symphony.jpeg?alt=media&token=f9bf80cd-3d8e-4e24-8503-7feb11f4e397",
86+
genre: "drama"
87+
},
88+
{
89+
id: "550e8400-e29b-41d4-a716-446655440014",
90+
title: "Moonlit Crusade",
91+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fmoonlit_crusade.jpeg?alt=media&token=b13241f5-d7d0-4370-b651-07847ad99dc2",
92+
genre: "fantasy"
93+
},
94+
{
95+
id: "550e8400-e29b-41d4-a716-446655440015",
96+
title: "Abyss of the Deep",
97+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fabyss_deep.jpeg?alt=media&token=2417321d-2451-4ec0-9ed6-6297042170e6",
98+
genre: "horror"
99+
},
100+
{
101+
id: "550e8400-e29b-41d4-a716-446655440017",
102+
title: "The Infinite Knot",
103+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Finfinite_knot.jpeg?alt=media&token=93d54d93-d933-4663-a6fe-26b707ef823e",
104+
genre: "romance"
105+
},
106+
{
107+
id: "550e8400-e29b-41d4-a716-446655440019",
108+
title: "Veil of Illusion",
109+
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fveil_illusion.jpeg?alt=media&token=7bf09a3c-c531-478a-9d02-5d99fca9393b",
110+
genre: "mystery"
111+
}
112+
]
113+
)
114+
movieMetadata_insertMany(
115+
data: [
116+
{
117+
movieId: "550e8400-e29b-41d4-a716-446655440000",
118+
rating: 7.9,
119+
releaseYear: 2025,
120+
description: "A group of scientists accidentally open a portal to a parallel universe, causing a rift in time. As the team races to close the portal, they encounter alternate versions of themselves, leading to shocking revelations."
121+
},
122+
{
123+
movieId: "550e8400-e29b-41d4-a716-446655440001",
124+
rating: 8.2,
125+
releaseYear: 2023,
126+
description: "In the lawless Wild West, a mysterious gunslinger with a hidden past takes on a corrupt sheriff and his band of outlaws to bring justice to a small town."
127+
},
128+
{
129+
movieId: "550e8400-e29b-41d4-a716-446655440002",
130+
rating: 7.5,
131+
releaseYear: 2024,
132+
description: "Two astronauts, stationed on a remote space station, fall in love amidst the isolation of deep space. But when a mysterious signal disrupts their communication, they must find a way to reconnect and survive."
133+
},
134+
{
135+
movieId: "550e8400-e29b-41d4-a716-446655440003",
136+
rating: 8.0,
137+
releaseYear: 2022,
138+
description: "A private detective gets caught up in a web of lies, deception, and betrayal while investigating the disappearance of a famous actress in 1940s Hollywood."
139+
},
140+
{
141+
movieId: "550e8400-e29b-41d4-a716-446655440004",
142+
rating: 7.6,
143+
releaseYear: 2025,
144+
description: "An explorer leads an expedition to a remote island rumored to be home to mythical creatures. As the team ventures deeper into the island, they uncover secrets that change the course of history."
145+
},
146+
{
147+
movieId: "550e8400-e29b-41d4-a716-446655440005",
148+
rating: 6.9,
149+
releaseYear: 2024,
150+
description: "A tech-savvy teenager discovers a cursed app that brings nightmares to life. As the horrors of the digital world cross into reality, she must find a way to break the curse before it's too late."
151+
},
152+
{
153+
movieId: "550e8400-e29b-41d4-a716-446655440006",
154+
rating: 8.1,
155+
releaseYear: 2026,
156+
description: "In a kingdom on the brink of war, a prophecy speaks of an eclipse that will grant power to the rightful ruler. As factions vie for control, a young warrior must decide where his true loyalty lies."
157+
},
158+
{
159+
movieId: "550e8400-e29b-41d4-a716-446655440007",
160+
rating: 7.7,
161+
releaseYear: 2023,
162+
description: "A brilliant scientist creates a robot with a human heart. As the robot struggles to understand emotions, it becomes entangled in a plot that could change the fate of humanity."
163+
},
164+
{
165+
movieId: "550e8400-e29b-41d4-a716-446655440008",
166+
rating: 8.4,
167+
releaseYear: 2025,
168+
description: "A legendary warrior rises to challenge the tyrannical rule of a powerful empire. As rebellion brews, the warrior must unite different factions to lead an uprising."
169+
},
170+
{
171+
movieId: "550e8400-e29b-41d4-a716-446655440009",
172+
rating: 8.2,
173+
releaseYear: 2024,
174+
description: "A talented pianist, who loses his hearing in a tragic accident, must rediscover his passion for music with the help of a young music teacher who believes in him."
175+
},
176+
{
177+
movieId: "550e8400-e29b-41d4-a716-446655440010",
178+
rating: 7.8,
179+
releaseYear: 2023,
180+
description: "A historian stumbles upon an ancient artifact that reveals hidden truths about an empire long forgotten. As she deciphers the clues, a shadowy organization tries to stop her from unearthing the past."
181+
},
182+
{
183+
movieId: "550e8400-e29b-41d4-a716-446655440011",
184+
rating: 8.5,
185+
releaseYear: 2026,
186+
description: "In the future, Earth's best pilots are sent on a mission to explore a mysterious planet beyond the solar system. What they find changes humanity's understanding of the universe forever."
187+
},
188+
{
189+
movieId: "550e8400-e29b-41d4-a716-446655440012",
190+
rating: 7.9,
191+
releaseYear: 2022,
192+
description: "A young detective with a dark past investigates a series of mysterious murders in a city plagued by corruption. As she digs deeper, she realizes nothing is as it seems."
193+
},
194+
{
195+
movieId: "550e8400-e29b-41d4-a716-446655440013",
196+
rating: 8.0,
197+
releaseYear: 2024,
198+
description: "An aging composer struggling with memory loss attempts to complete his final symphony. With the help of a young prodigy, he embarks on an emotional journey through his memories and legacy."
199+
},
200+
{
201+
movieId: "550e8400-e29b-41d4-a716-446655440014",
202+
rating: 8.3,
203+
releaseYear: 2025,
204+
description: "A knight is chosen by an ancient order to embark on a quest under the light of the full moon. Facing mythical beasts and treacherous landscapes, he seeks a relic that could save his kingdom."
205+
},
206+
{
207+
movieId: "550e8400-e29b-41d4-a716-446655440015",
208+
rating: 7.2,
209+
releaseYear: 2023,
210+
description: "When a group of marine biologists descends into the unexplored depths of the ocean, they encounter a terrifying and ancient force. Now, they must survive as the abyss comes alive."
211+
},
212+
{
213+
movieId: "550e8400-e29b-41d4-a716-446655440017",
214+
rating: 7.4,
215+
releaseYear: 2026,
216+
description: "Two souls destined to meet across multiple lifetimes struggle to find each other in a chaotic world. With each incarnation, they get closer, but time itself becomes their greatest obstacle."
217+
},
218+
{
219+
movieId: "550e8400-e29b-41d4-a716-446655440019",
220+
rating: 7.8,
221+
releaseYear: 2022,
222+
description: "A magician-turned-detective uses his skills in illusion to solve crimes. When a series of murders leaves the city in fear, he must reveal the truth hidden behind a veil of deceit."
223+
}
224+
]
225+
)
226+
user_insertMany(
227+
data: [
228+
{ id: "SnLgOC3lN4hcIl69s53cW0Q8R1T2", username: "sherlock_h" },
229+
{ id: "fep4fXpGWsaRpuphq9CIrBIXQ0S2", username: "hercule_p" },
230+
{ id: "TBedjwCX0Jf955Uuoxk6k74sY0l1", username: "jane_d" }
231+
]
232+
)
233+
review_insertMany(
234+
data: [
235+
{
236+
userId: "SnLgOC3lN4hcIl69s53cW0Q8R1T2",
237+
movieId: "550e8400-e29b-41d4-a716-446655440000",
238+
rating: 5,
239+
reviewText: "An incredible movie with a mind-blowing plot!",
240+
reviewDate: "2025-10-01"
241+
},
242+
{
243+
userId: "fep4fXpGWsaRpuphq9CIrBIXQ0S2",
244+
movieId: "550e8400-e29b-41d4-a716-446655440001",
245+
rating: 5,
246+
reviewText: "A revolutionary film that changed cinema forever.",
247+
reviewDate: "2025-10-01"
248+
},
249+
{
250+
userId: "TBedjwCX0Jf955Uuoxk6k74sY0l1",
251+
movieId: "550e8400-e29b-41d4-a716-446655440002",
252+
rating: 5,
253+
reviewText: "A visually stunning and emotionally impactful movie.",
254+
reviewDate: "2025-10-01"
255+
},
256+
{
257+
userId: "SnLgOC3lN4hcIl69s53cW0Q8R1T2",
258+
movieId: "550e8400-e29b-41d4-a716-446655440003",
259+
rating: 4,
260+
reviewText: "A fantastic superhero film with great performances.",
261+
reviewDate: "2025-10-01"
262+
},
263+
{
264+
userId: "fep4fXpGWsaRpuphq9CIrBIXQ0S2",
265+
movieId: "550e8400-e29b-41d4-a716-446655440004",
266+
rating: 5,
267+
reviewText: "An amazing film that keeps you on the edge of your seat.",
268+
reviewDate: "2025-10-01"
269+
},
270+
{
271+
userId: "TBedjwCX0Jf955Uuoxk6k74sY0l1",
272+
movieId: "550e8400-e29b-41d4-a716-446655440005",
273+
rating: 5,
274+
reviewText: "An absolute classic with unforgettable dialogue.",
275+
reviewDate: "2025-10-01"
276+
}
277+
]
278+
)
279+
}

0 commit comments

Comments
 (0)