Browse Source

Migration for shop template

Vova Tkach 5 years ago
parent
commit
f92433aadf
2 changed files with 26 additions and 0 deletions
  1. 1 0
      support/migrate/000000001.go
  2. 25 0
      support/migrate/000000005.go

+ 1 - 0
support/migrate/000000001.go

@@ -10,4 +10,5 @@ var Migrations = map[string]func(*sqlw.DB, string) error{
 	"000000002": Migrate_000000002,
 	"000000003": Migrate_000000003,
 	"000000004": Migrate_000000004,
+	"000000005": Migrate_000000005,
 }

+ 25 - 0
support/migrate/000000005.go

@@ -0,0 +1,25 @@
+package migrate
+
+import (
+	"io/ioutil"
+	"os"
+
+	ThemeFiles "golang-fave/assets/template"
+	"golang-fave/engine/sqlw"
+)
+
+func Migrate_000000005(db *sqlw.DB, host string) error {
+	if err := ioutil.WriteFile(host+string(os.PathSeparator)+"/template/shop-category.html", ThemeFiles.AllData["shop-category.html"], 0664); err != nil {
+		return err
+	}
+
+	if err := ioutil.WriteFile(host+string(os.PathSeparator)+"/template/shop-product.html", ThemeFiles.AllData["shop-product.html"], 0664); err != nil {
+		return err
+	}
+
+	if err := ioutil.WriteFile(host+string(os.PathSeparator)+"/template/shop.html", ThemeFiles.AllData["shop.html"], 0664); err != nil {
+		return err
+	}
+
+	return nil
+}