Skip to content

Commit

Permalink
Merge pull request #41 from JacobDChamberlain/backendUpdateInventory
Browse files Browse the repository at this point in the history
Backend update inventory
  • Loading branch information
JacobDChamberlain authored Jan 1, 2025
2 parents a05e653 + 2aa5046 commit 080ef42
Show file tree
Hide file tree
Showing 11 changed files with 1,379 additions and 12 deletions.
35 changes: 35 additions & 0 deletions backend/migrations/20250101000059-create-users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('users', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
username: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
password: {
type: Sequelize.STRING,
allowNull: false,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
},
});
},

down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('users');
},
};
34 changes: 34 additions & 0 deletions backend/models/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

module.exports = (sequelize, DataTypes) => {
const User = sequelize.define('User', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false
},
username: {
type: DataTypes.STRING,
allowNull: false,
unique: true
},
password: {
type: DataTypes.STRING,
allowNull: false
},
createdAt: {
type: DataTypes.DATE,
allowNull: false
},
updatedAt: {
type: DataTypes.DATE,
allowNull: false
}
}, {
tableName: 'users', // Explicitly specify the table name
timestamps: true // Enable Sequelize to handle createdAt and updatedAt
});

return User;
};
Loading

0 comments on commit 080ef42

Please sign in to comment.