2013-05-17 45 views
2

我按照本指南http://compoundjs.com/docs创建了一个非常基本的REST服务器。 当使用内存作为存储时,它起作用。之后,我试图移动到MySQL。复合数据库更新/迁移不在mysql中工作

当执行“化合物分贝迁移”(或更新)的响应是:

Perform migrate on 
- mysql 
1 

但是数据库和表不创建。 然后,在启动服务器或控制台时,将创建数据库。 但表格不是。迁移/更新操作似乎没有奏效。

这是我schema.coffee文件

Pin = define 'Pin', -> 
    property 'name', String 

Book = define 'Book', -> 
    property 'link', String 
    property 'pin_id', Number 

Pin.hasMany(Book, {as: 'books', foreignKey: 'pin_id'}) 
Book.belongsTo(Pin, {as: 'pin', foreignKey: 'pin_id'}) 

这些都是我的package.json依赖

{ "ejs": "*" 
    , "ejs-ext": "latest" 
    , "express": "~3.x" 
    , "compound": ">= 1.1.0" 
    , "jugglingdb": ">= 0.1.0" 
    , "coffee-script": ">= 1.1.1" 
    , "stylus": "latest" 
    , "seedjs": "latest" 
    , "co-assets-compiler": "*" 
} 

任何帮助将超过赞赏:)

回答

1

我创建2测试应用程序:

a)无咖啡:

compound init no_coffee_app --db mysql 
cd no_coffee_app 
npm install 
npm install jugglingdb-mysq 
compound generate crud post title content published:boolean 
compound db update 

b)用咖啡:

compound init testcoffee --coffee --db mysql 
cd testcoffee 
npm install 
npm install jugglingdb-mysq 
compound generate crud post title content published:boolean 
compound db update 

它不会对咖啡变种为我工作。

并且适用于没有 - coffee标志的项目。

+0

它固定在v1.1.9 – Anatoliy