Advertisement
Guest User

Untitled

a guest
Jun 1st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. var orm = require('orm');
  2.  
  3.  
  4. var db = orm.connect({
  5. host: 'localhost',
  6. database: 'ofp',
  7. user: 'root',
  8. password: 'password',
  9. protocol: 'mysql',
  10. port: '3306',
  11.  
  12. }, function (err, db) {
  13. if (err) return console.error('Connection error: ' + err);
  14.  
  15. });
  16.  
  17. var Teacher = db.define('teacher', {
  18. name: {type: 'text', size: 90, key: true},
  19. post: {type: 'text', size: 90},
  20. qualification: {type: 'text', size: 90},
  21. authority: {type: 'boolean'}
  22. }, {
  23. methods : {
  24. getTeacherName: function() {
  25. return this.name;
  26. },
  27. getTeacherPost: function () {
  28. return this.post;
  29. },
  30. getTeacherQualification: function () {
  31. return this.qualification;
  32. },
  33. getTeacherAuthority: function () {
  34. return this.authority;
  35. }
  36. }
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement