-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.js
33 lines (29 loc) · 1.26 KB
/
models.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// models.js
const { Sequelize, DataTypes } = require('sequelize');
const path = require('path');
// Initialize Sequelize with SQLite
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: path.join(__dirname, 'database.sqlite')
});
// Define the User model
const User = sequelize.define('User', {
firstName: { type: DataTypes.STRING, allowNull: false },
lastName: { type: DataTypes.STRING, allowNull: false },
email: { type: DataTypes.STRING, allowNull: false, unique: true },
passwordHash: { type: DataTypes.STRING, allowNull: false },
orgName: { type: DataTypes.STRING, allowNull: true },
phone: { type: DataTypes.STRING, allowNull: true },
industry: { type: DataTypes.STRING, allowNull: true },
website: { type: DataTypes.STRING, allowNull: true },
address: { type: DataTypes.STRING, allowNull: true },
address2: { type: DataTypes.STRING, allowNull: true },
city: { type: DataTypes.STRING, allowNull: true },
state: { type: DataTypes.STRING, allowNull: true },
zip: { type: DataTypes.STRING, allowNull: true },
country: { type: DataTypes.STRING, allowNull: true },
accountType: { type: DataTypes.STRING, allowNull: false }
});
// Sync the database
sequelize.sync();
module.exports = { sequelize, User };