A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

50 lines
1.0 KiB

  1. /*
  2. * Copyright © 2020-2021 Musing Studio LLC.
  3. *
  4. * This file is part of WriteFreely.
  5. *
  6. * WriteFreely is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. package main
  11. import (
  12. "github.com/urfave/cli/v2"
  13. "github.com/writefreely/writefreely"
  14. )
  15. var (
  16. cmdDB cli.Command = cli.Command{
  17. Name: "db",
  18. Usage: "db management tools",
  19. Subcommands: []*cli.Command{
  20. &cmdDBInit,
  21. &cmdDBMigrate,
  22. },
  23. }
  24. cmdDBInit cli.Command = cli.Command{
  25. Name: "init",
  26. Usage: "Initialize Database",
  27. Action: initDBAction,
  28. }
  29. cmdDBMigrate cli.Command = cli.Command{
  30. Name: "migrate",
  31. Usage: "Migrate Database",
  32. Action: migrateDBAction,
  33. }
  34. )
  35. func initDBAction(c *cli.Context) error {
  36. app := writefreely.NewApp(c.String("c"))
  37. return writefreely.CreateSchema(app)
  38. }
  39. func migrateDBAction(c *cli.Context) error {
  40. app := writefreely.NewApp(c.String("c"))
  41. return writefreely.Migrate(app)
  42. }