1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 08:20:58 -05:00
Daggerbot-TS/src/models/MPServer.ts

35 lines
990 B
TypeScript
Raw Normal View History

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,
storage: 'src/database/MPDB.dat'
2022-11-11 19:58:11 -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;
}
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
}
}, { sequelize: db, modelName: 'urls', timestamps: false });
export default MPDB