Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: Linearlite load initial data #1987

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions examples/linearlite/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ export default $config({

const db = new neon.Database(`linearlite`, {
...base,
name:
$app.stage === `Production`
? `linearlite-production`
: `linearlite-${$app.stage}`,
ownerName: `neondb_owner`,
})

const databaseUri = getNeonDbUri(project, db)
try {
databaseUri.apply(applyMigrations)
databaseUri.apply(loadData)

const electricInfo = databaseUri.apply((uri) =>
addDatabaseToElectric(uri)
Expand Down Expand Up @@ -60,6 +65,15 @@ function applyMigrations(uri: string) {
})
}

function loadData(uri: string) {
execSync(`pnpm run db:load-data`, {
env: {
...process.env,
DATABASE_URL: uri,
},
})
}

function deployLinearLite(
electricInfo: $util.Output<{ id: string; token: string }>
) {
Expand Down
Loading