Skip to content

Commit

Permalink
Merge 6e1e252 into beb918c
Browse files Browse the repository at this point in the history
  • Loading branch information
Proception committed Jan 16, 2019
2 parents beb918c + 6e1e252 commit b55f0b7
Show file tree
Hide file tree
Showing 23 changed files with 672 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/db/migrations/20190114154904-create-category.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Categories', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
categoryName: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Categories')
};
52 changes: 52 additions & 0 deletions src/db/migrations/20190114155001-create-art.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Arts', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
artistId: {
type: Sequelize.INTEGER,
references: {
model: 'Users',
key: 'id',
as: 'artistId',
}
},
slug: {
type: Sequelize.STRING
},
title: {
type: Sequelize.STRING
},
description: {
type: Sequelize.TEXT
},
categoryId: {
type: Sequelize.INTEGER,
references: {
model: 'Categories',
key: 'id',
as: 'categoryId',
}
},
featuredImg: {
type: Sequelize.STRING
},
status: {
type: Sequelize.BOOLEAN
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Arts')
};
35 changes: 35 additions & 0 deletions src/db/migrations/20190114160429-create-media.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Media', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
contentUrl: {
type: Sequelize.TEXT
},
mediaType: {
type: Sequelize.STRING
},
artId: {
type: Sequelize.INTEGER,
references: {
model: 'Arts',
key: 'id',
as: 'artId',
}
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Media')
};
42 changes: 42 additions & 0 deletions src/db/migrations/20190115112633-create-rate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Rates', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
artId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
references: {
model: 'Arts',
key: 'id',
as: 'artId',
}
},
userId: {
type: Sequelize.INTEGER,
references: {
model: 'Users',
key: 'id',
as: 'userid',
}
},
rating: {
type: Sequelize.INTEGER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Rates')
};
42 changes: 42 additions & 0 deletions src/db/migrations/20190115144222-create-comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Comments', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
artId: {
type: Sequelize.INTEGER,
references: {
model: 'Arts',
key: 'id',
as: 'artId',
}
},
userId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
references: {
model: 'Users',
key: 'id',
as: 'userId',
}
},
body: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Comments')
};
39 changes: 39 additions & 0 deletions src/db/migrations/20190115144306-create-like.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Likes', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
artId: {
type: Sequelize.INTEGER,
references: {
model: 'Arts',
key: 'id',
as: 'artId',
}
},
userId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
references: {
model: 'Users',
key: 'id',
as: 'userId',
}
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Likes')
};
41 changes: 41 additions & 0 deletions src/db/migrations/20190115144703-create-following.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Followings', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
references: {
model: 'Users',
key: 'id',
as: 'userId',
}
},
followerId: {
type: Sequelize.INTEGER,
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
references: {
model: 'Users',
key: 'id',
as: 'followerId',
}
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Followings')
};
35 changes: 35 additions & 0 deletions src/db/migrations/20190115144953-create-follow-summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('FollowSummaries', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userId: {
type: Sequelize.INTEGER,
references: {
model: 'Users',
key: 'id',
as: 'userId',
}
},
followers: {
type: Sequelize.INTEGER
},
following: {
type: Sequelize.INTEGER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('FollowSummaries')
};
32 changes: 32 additions & 0 deletions src/db/migrations/20190115145052-create-like-summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('LikeSummaries', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
artId: {
type: Sequelize.INTEGER,
references: {
model: 'Arts',
key: 'id',
as: 'artId',
}
},
noOfLikes: {
type: Sequelize.INTEGER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('LikeSummaries')
};
48 changes: 48 additions & 0 deletions src/db/migrations/20190115154728-create-transaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Transactions', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
buyerId: {
type: Sequelize.INTEGER,
references: {
model: 'Users',
key: 'id',
as: 'buyerId',
}
},
sellerId: {
type: Sequelize.INTEGER,
references: {
model: 'Users',
key: 'id',
as: 'sellerId',
}
},
artId: {
type: Sequelize.INTEGER,
references: {
model: 'Arts',
key: 'id',
as: 'artId',
}
},
amount: {
type: Sequelize.INTEGER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => queryInterface.dropTable('Transactions')
};
Loading

0 comments on commit b55f0b7

Please sign in to comment.