Skip to content

Commit

Permalink
creating impression model #58
Browse files Browse the repository at this point in the history
  • Loading branch information
a-kamel committed Apr 25, 2015
1 parent c37ce60 commit 30252be
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
44 changes: 44 additions & 0 deletions db/migrate/create-impression.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use strict"
module.exports = {
up: function(migration, DataTypes, done) {
migration.createTable("Impression", {
id: {

allowNull: false,
autoIncrement: true,
primaryKey: true,
type: DataTypes.INTEGER
},

This comment has been minimized.

Copy link
@salmatarzi

salmatarzi Apr 26, 2015

Collaborator

@a-kamel Fix indentation, and delete white space trails.

creativeID: {
allowNull: false,
type: DataTypes.INTEGER,
references: 'creative',
referenceskey: 'id'
},
publisherID: {
allowNull: false,
type: DataTypes.INTEGER
},
userID: {
allowNull: false,
type:DataTypes.INTEGER
},
longitude: {
allowNull: false,
type: DataTypes.INTEGER
},
latitude: {
allowNull: false,
type: DataTypes.INTEGER
},
price: {
allowNull: false,
type: DataTypes.INTEGER
}
}).done(done);
},
down: function(migration, DataTypes, done) {
migration.dropTable("Impression").done(done);
}
};
20 changes: 20 additions & 0 deletions models/Impression.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use strict" ;
module.exports = function(sequelize, DataTypes) {
var Impression = sequelize.define("Impression", {

This comment has been minimized.

Copy link
@salmatarzi

salmatarzi Apr 26, 2015

Collaborator

@a-kamel Delete white space trails.

creativeID: DataTypes.INTEGER,
publisherID: DataTypes.INTEGER,
userID: DataTypes.INTEGER,
longitude: DataTypes.INTEGER,
latitude: DataTypes.INTEGER,
price: DataTypes.INTEGER
}, {
classMethods: {
associate: function(models) {
Impression.belongsTo(models.creative, {foreignKey: 'creativeID'});
Impression.belongsTo(models.publisher , {forgeinKey: 'publisherID'});
}
}
});
return Impression;
};

0 comments on commit 30252be

Please sign in to comment.