LoginSignup
1
1

More than 5 years have passed since last update.

compoundでテーブル名を独自に定義したい時

Posted at

例えばusersという名前でテーブルを作っていて、それをcompoundで使いたい場合の対処。
そのままcompound g model とかでモデルを作るとUserテーブルを読もうとする。
その場合は作ったプロジェクトの中のschema.jsで以下のようにsetTableNameで定義してあげたら良い。

db/schema.js
var User = describe('User', function(){
  property('id',Number);
  property('name',String);
  setTableName('users');
  set('restPath', pathTo.users)
});
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1