@ranger1/dx 0.1.87 → 0.1.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -97,6 +97,7 @@ export function resolveBackendDeployConfig({ cli, targetConfig, environment, fla
|
|
|
97
97
|
const startupMode = String(startupConfig.mode || 'pm2').trim()
|
|
98
98
|
const prismaGenerate = runConfig.prismaGenerate !== false
|
|
99
99
|
const prismaMigrateDeploy = runConfig.prismaMigrateDeploy !== false
|
|
100
|
+
const prismaSeed = runConfig.prismaSeed === true
|
|
100
101
|
|
|
101
102
|
const normalized = {
|
|
102
103
|
projectRoot: cli.projectRoot,
|
|
@@ -153,6 +154,7 @@ export function resolveBackendDeployConfig({ cli, targetConfig, environment, fla
|
|
|
153
154
|
),
|
|
154
155
|
prismaGenerate,
|
|
155
156
|
prismaMigrateDeploy,
|
|
157
|
+
prismaSeed,
|
|
156
158
|
skipMigration: Boolean(flags.skipMigration),
|
|
157
159
|
},
|
|
158
160
|
verify: resolveVerifyConfig(verifyConfig),
|
|
@@ -168,7 +170,7 @@ export function resolveBackendDeployConfig({ cli, targetConfig, environment, fla
|
|
|
168
170
|
requireString(normalized.startup.entry, 'startup.entry')
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
if (normalized.deploy.prismaGenerate || normalized.deploy.prismaMigrateDeploy) {
|
|
173
|
+
if (normalized.deploy.prismaGenerate || normalized.deploy.prismaMigrateDeploy || normalized.deploy.prismaSeed) {
|
|
172
174
|
requireString(normalized.runtime.prismaSchemaDir, 'runtime.prismaSchemaDir')
|
|
173
175
|
requireString(normalized.runtime.prismaConfig, 'runtime.prismaConfig')
|
|
174
176
|
}
|
|
@@ -30,6 +30,7 @@ export function buildRemoteDeployScript(phaseModel = []) {
|
|
|
30
30
|
const keepReleases = Number(deploy.keepReleases || 5)
|
|
31
31
|
const shouldGenerate = deploy.prismaGenerate !== false
|
|
32
32
|
const shouldMigrate = deploy.prismaMigrateDeploy !== false && deploy.skipMigration !== true
|
|
33
|
+
const shouldSeed = deploy.prismaSeed === true
|
|
33
34
|
const healthCheckUrl = healthCheck?.url ? String(healthCheck.url) : ''
|
|
34
35
|
const healthCheckTimeoutSeconds = Number(healthCheck?.timeoutSeconds || 10)
|
|
35
36
|
const healthCheckMaxWaitSeconds = Number(healthCheck?.maxWaitSeconds || 24)
|
|
@@ -62,6 +63,7 @@ HEALTHCHECK_RETRY_DELAY_SECONDS=${healthCheckRetryIntervalSeconds}
|
|
|
62
63
|
KEEP_RELEASES=${keepReleases}
|
|
63
64
|
SHOULD_GENERATE=${shouldGenerate ? '1' : '0'}
|
|
64
65
|
SHOULD_MIGRATE=${shouldMigrate ? '1' : '0'}
|
|
66
|
+
SHOULD_SEED=${shouldSeed ? '1' : '0'}
|
|
65
67
|
|
|
66
68
|
LOCK_FILE="$APP_ROOT/.deploy.lock"
|
|
67
69
|
LOCK_DIR="$APP_ROOT/.deploy.lock.d"
|
|
@@ -345,6 +347,17 @@ if [[ "$SHOULD_MIGRATE" == "1" ]]; then
|
|
|
345
347
|
MIGRATION_EXECUTED=1
|
|
346
348
|
fi
|
|
347
349
|
|
|
350
|
+
if [[ "$SHOULD_SEED" == "1" ]]; then
|
|
351
|
+
CURRENT_PHASE="prisma-seed"
|
|
352
|
+
echo "DX_REMOTE_PHASE=prisma-seed"
|
|
353
|
+
PRISMA_BIN="$RELEASE_DIR/node_modules/.bin/prisma"
|
|
354
|
+
if [[ ! -x "$PRISMA_BIN" ]]; then
|
|
355
|
+
echo "缺少可执行文件: $PRISMA_BIN" >&2
|
|
356
|
+
exit 1
|
|
357
|
+
fi
|
|
358
|
+
run_with_env "$RELEASE_DIR" "$PRISMA_BIN" db seed --schema="$PRISMA_SCHEMA" --config="$PRISMA_CONFIG"
|
|
359
|
+
fi
|
|
360
|
+
|
|
348
361
|
CURRENT_PHASE="switch-current"
|
|
349
362
|
echo "DX_REMOTE_PHASE=switch-current"
|
|
350
363
|
ln -sfn "$RELEASE_DIR" "$CURRENT_LINK"
|