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.
This commit is contained in:
parent
4474cd5677
commit
b5b2f005eb
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue