mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
cli: misc fixes related to actions (#3942)
This commit is contained in:
parent
7b045f1a24
commit
89b6ce86ca
@ -365,14 +365,14 @@ jobs:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key:
|
||||
cli-ext-npm-cache-v1-{{ checksum "cli-ext/package.json" }}-{{ checksum "cli-ext/package-lock.json" }}
|
||||
cli-ext-npm-cache-v2-{{ checksum "cli-ext/package.json" }}-{{ checksum "cli-ext/package-lock.json" }}
|
||||
- run:
|
||||
name: install dependencies
|
||||
working_directory: cli-ext
|
||||
command: make ci-deps
|
||||
- save_cache:
|
||||
key:
|
||||
cli-ext-npm-cache-v1-{{ checksum "cli-ext/package.json" }}-{{ checksum "cli-ext/package-lock.json" }}
|
||||
cli-ext-npm-cache-v2-{{ checksum "cli-ext/package.json" }}-{{ checksum "cli-ext/package-lock.json" }}
|
||||
paths:
|
||||
- cli-ext/node_modules
|
||||
- ~/.npm
|
||||
|
@ -89,7 +89,17 @@ func (o *migrateCreateOptions) run() (version int64, err error) {
|
||||
|
||||
if o.fromServer {
|
||||
o.sqlServer = true
|
||||
o.metaDataServer = true
|
||||
if o.EC.Config.Version == cli.V1 {
|
||||
o.metaDataServer = true
|
||||
}
|
||||
}
|
||||
|
||||
if o.flags.Changed("metadata-from-file") && o.EC.Config.Version != cli.V1 {
|
||||
return 0, errors.New("metadata-from-file flag can be set only with config version 1")
|
||||
}
|
||||
|
||||
if o.flags.Changed("metadata-from-server") && o.EC.Config.Version != cli.V1 {
|
||||
return 0, errors.New("metadata-from-server flag can be set only with config version 1")
|
||||
}
|
||||
|
||||
if o.flags.Changed("metadata-from-file") && o.sqlServer {
|
||||
@ -131,7 +141,7 @@ func (o *migrateCreateOptions) run() (version int64, err error) {
|
||||
}
|
||||
|
||||
// Create metadata migrations only if config version is V1
|
||||
if o.metaDataServer && ec.Config.Version == cli.V1 {
|
||||
if o.metaDataServer {
|
||||
// To create metadata.yaml, set metadata plugin
|
||||
tmpDirName, err := ioutil.TempDir("", "*")
|
||||
if err != nil {
|
||||
@ -159,12 +169,18 @@ func (o *migrateCreateOptions) run() (version int64, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
if !o.flags.Changed("sql-from-file") && !o.flags.Changed("metadata-from-file") && !o.metaDataServer && !o.sqlServer {
|
||||
if !o.flags.Changed("sql-from-file") && !o.flags.Changed("metadata-from-file") && !o.metaDataServer && !o.sqlServer && o.EC.Config.Version == cli.V1 {
|
||||
// Set empty data for [up|down].yaml
|
||||
createOptions.MetaUp = []byte(`[]`)
|
||||
createOptions.MetaDown = []byte(`[]`)
|
||||
}
|
||||
|
||||
if !o.flags.Changed("sql-from-file") && !o.flags.Changed("metadata-from-file") && !o.metaDataServer && !o.sqlServer && o.EC.Config.Version != cli.V1 {
|
||||
// Set empty data for [up|down].sql
|
||||
createOptions.SQLUp = []byte(``)
|
||||
createOptions.SQLDown = []byte(``)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
createOptions.Delete()
|
||||
|
@ -766,7 +766,7 @@ func (m *Migrate) squashDown(version uint64, ret chan<- interface{}) {
|
||||
}
|
||||
|
||||
prev, err := m.sourceDrv.Prev(from)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
migr, err := m.metanewMigration(from, -1)
|
||||
if err != nil {
|
||||
ret <- err
|
||||
@ -782,6 +782,10 @@ func (m *Migrate) squashDown(version uint64, ret chan<- interface{}) {
|
||||
}
|
||||
ret <- migr
|
||||
go migr.Buffer()
|
||||
return
|
||||
} else if err != nil {
|
||||
ret <- err
|
||||
return
|
||||
}
|
||||
|
||||
migr, err := m.metanewMigration(from, int64(prev))
|
||||
|
Loading…
Reference in New Issue
Block a user