github.com/wawandco/oxplugins@v0.7.11/tools/liquibase/liquibase.go (about)

     1  // Liquibase package aims to provide a ox plugin to manage migrations
     2  // with the Liquibase style.  That is, using the databasechangelog and
     3  // databasechangeloglock as well as the xml format for liquibase
     4  // migrations.
     5  //
     6  // IMPORTANT: This plugin is not ready to be used in production, rather
     7  // it aims to allow developers to avoid the java and liquibase installation
     8  // by doing what liquibase does.
     9  package liquibase
    10  
    11  import (
    12  	"fmt"
    13  
    14  	pop4 "github.com/gobuffalo/pop"
    15  	pop5 "github.com/gobuffalo/pop/v5"
    16  	"github.com/wawandco/oxplugins/plugins"
    17  )
    18  
    19  // Plugins on this package.
    20  func Plugins(conns interface{}) []plugins.Plugin {
    21  	connections := map[string]URLProvider{}
    22  
    23  	switch v := conns.(type) {
    24  	case map[string]*pop4.Connection:
    25  		for k, conn := range v {
    26  			connections[k] = conn
    27  		}
    28  	case map[string]*pop5.Connection:
    29  		for k, conn := range v {
    30  			connections[k] = conn
    31  		}
    32  	default:
    33  		fmt.Println("[warning] Liquibase plugin ONLY receives pop v4 and v5 connections")
    34  	}
    35  
    36  	return []plugins.Plugin{
    37  		&Command{connections: connections},
    38  		&Generator{},
    39  	}
    40  }