2022-11-16 13:53:42 -05:00
|
|
|
import {Sequelize, DataTypes, Model, InferAttributes, InferCreationAttributes} from 'sequelize';
|
2022-11-11 19:58:11 -05:00
|
|
|
var db = new Sequelize('database', 'daggerbot', 'toastsus', {
|
|
|
|
host: 'localhost',
|
|
|
|
dialect: 'sqlite',
|
|
|
|
logging: false,
|
2022-11-16 13:53:42 -05:00
|
|
|
storage: 'src/database/MPDB.dat'
|
2022-11-11 19:58:11 -05:00
|
|
|
})
|
2022-11-16 13:53:42 -05:00
|
|
|
class MPDB extends Model<InferAttributes<MPDB>, InferCreationAttributes<MPDB>>{
|
|
|
|
declare serverId: string | null;
|
|
|
|
declare ip: string | null;
|
|
|
|
declare code: string | null;
|
2022-11-19 05:17:04 -05:00
|
|
|
declare timesUpdated: number | null;
|
2022-11-16 13:53:42 -05:00
|
|
|
}
|
|
|
|
MPDB.init({
|
2022-11-11 19:58:11 -05:00
|
|
|
serverId: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
unique: true
|
|
|
|
},
|
|
|
|
ip: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
defaultValue: 'Missing IP',
|
|
|
|
allowNull: false
|
|
|
|
},
|
|
|
|
code: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
defaultValue: 'Missing Code',
|
|
|
|
allowNull: false
|
2022-11-19 05:17:04 -05:00
|
|
|
},
|
|
|
|
timesUpdated: {
|
|
|
|
type: DataTypes.INTEGER,
|
|
|
|
defaultValue: 0,
|
|
|
|
allowNull: false
|
2022-11-11 19:58:11 -05:00
|
|
|
}
|
2022-11-16 13:53:42 -05:00
|
|
|
}, { sequelize: db, modelName: 'urls', timestamps: false });
|
|
|
|
export default MPDB
|