Sails 1.0 Models without primary key

后端 未结 1 1359
不思量自难忘°
不思量自难忘° 2021-01-25 01:31

I try to use new version 1.0 and refactoring my project. I have one problem and i don\'t now how i can solve her. Some tables on my BD don\'t have primary keys and when i migrat

相关标签:
1条回答
  • 2021-01-25 02:15

    i have the same problem i used to change the primarykey this: in file config/model.js

    attributes: {
          id: { 
             type: 'number', 
             autoIncrement: true, 
          },
        }
    
        and in the model api/any_model.js i used:
    
        tableName : 'table',
        attributes: {
          id: { 
           type: 'number',  
           columnName : 'column_you_like_to_be_a_primaryKEY',
           required : true
          },
        }
    
    0 讨论(0)
提交回复
热议问题