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