mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-13 19:33:55 +03:00
cli: apply the migration after creating for flag --from-server
Issue: https://github.com/hasura/graphql-engine/issues/7510 Problem: - To mark the migration applied after creating the migration from the server with skip-execution flag Solution: After creating migration apply it with skip-execution true https://github.com/hasura/graphql-engine-mono/pull/2333 Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: 72eca352b76afe3a19d2198169b31284e38af07a
This commit is contained in:
parent
112d206fa6
commit
24d9bbcd93
@ -25,6 +25,7 @@
|
||||
- console: add GraphQL customisation under Remote schema edit tab
|
||||
- console: fix cross-schema array relationship suggestions
|
||||
- cli: add support for `network` metadata object
|
||||
- cli: `migrate create --from-server` creates the migration and marks it as applied on the server
|
||||
|
||||
## v2.0.9
|
||||
|
||||
|
@ -223,6 +223,19 @@ func (o *migrateCreateOptions) run() (version int64, err error) {
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "error creating migration files")
|
||||
}
|
||||
if o.fromServer {
|
||||
opts := &MigrateApplyOptions{
|
||||
EC: o.EC,
|
||||
SkipExecution: true,
|
||||
VersionMigration: fmt.Sprintf("%d", timestamp),
|
||||
Source: o.Source,
|
||||
}
|
||||
err := opts.Run()
|
||||
if err != nil {
|
||||
o.EC.Logger.Warnf("cannot mark created migration %d as applied: %v", timestamp, err)
|
||||
o.EC.Logger.Warnf("manually mark it as applied using command: hasura migrate apply --skip-execution --version %d", timestamp)
|
||||
}
|
||||
}
|
||||
return timestamp, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user