【问题标题】:compound db update/migrate not working in mysql复合数据库更新/迁移在 mysql 中不起作用
【发布时间】:2013-05-13 03:44:47
【问题描述】:

我已按照本指南 http://compoundjs.com/docs 创建了一个非常基本的 REST 服务器。 它在使用内存作为存储时起作用。之后,我尝试迁移到 mysql。

执行“compound db migrate”(或更新)时,响应为:

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": "*"
}

任何帮助将不胜感激:)

【问题讨论】:

    标签: node.js compoundjs jugglingdb


    【解决方案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 标志的项目。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-05
      • 2018-10-10
      • 2018-06-20
      • 2021-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-20
      相关资源
      最近更新 更多