Skip to content

peeperklip/migration

Repository files navigation

Migration

Go get

go get https://github.com/peeperklip/[email protected]
# add the -u flag for updating

(proposal on how to) Intergrate in your own project

  1. Get according go get paragraph
  2. Create a directory cli
  3. create a file + function that you can exectute command line
//Exexute in: $PROJECT_ROOT
//File: $PROJECT_ROOT/cli/migration.go
//Execute as: 
func main() {
	mig := migrations.NewMigration(
		utils.CreateConnection(),
		"postgress",
		".")
	migrations.Init(*mig)
}

Architecture:

app.go Is the entry point for the CLI
dialect.go Will eventually be used to support multiple SQL dialects
migration.go Holds all the logic for managing migrations

Codestyle:

structs go first, interfaces second, then the methods, then general functions. Besides that it's pretty much just gofmt .

To be improved in 0.0.2 and 0.0.3:

  • The unsustainable swtich case in dialect.go
  • The typejuggeling througout migration.go
  • The last few methods in migration.go should be moved to its own file and struct
  • Inject a logger
  • unify output and make more of the underlying code swapable
  • general improvements throughout as well as a better distinction between exported and unexported methods

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages