浏览代码

Fixed a bug which caused dockerd to not create its DB if an empty /var/lib/docker/images existed; fixed a bug which caused dockerd to not create missing tables in the images DB.

Solomon Hykes 12 年之前
父节点
当前提交
b5b2f005eb
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      fs/store.go

+ 2 - 4
fs/store.go

@@ -4,9 +4,9 @@ import (
 	"database/sql"
 	"errors"
 	"fmt"
-	"github.com/coopernurse/gorp"
 	"github.com/dotcloud/docker/future"
 	_ "github.com/mattn/go-sqlite3"
+	"github.com/shykes/gorp" //Forked to implement CreateTablesOpts
 	"io"
 	"os"
 	"path"
@@ -29,8 +29,6 @@ func New(root string) (*Store, error) {
 
 	if err := os.Mkdir(root, 0700); err != nil && !os.IsExist(err) {
 		return nil, err
-	} else if os.IsExist(err) {
-		isNewStore = false
 	}
 	db, err := sql.Open("sqlite3", path.Join(root, "db"))
 	if err != nil {
@@ -42,7 +40,7 @@ func New(root string) (*Store, error) {
 	orm.AddTableWithName(Mountpoint{}, "mountpoints").SetKeys(false, "Root")
 	orm.AddTableWithName(Tag{}, "tags").SetKeys(false, "TagName")
 	if isNewStore {
-		if err := orm.CreateTables(); err != nil {
+		if err := orm.CreateTablesOpts(true); err != nil {
 			return nil, err
 		}
 	}