Files
LingChair/server/data/User.ts
CrescentLeaf 6698e2f6ae User.ts
2025-07-07 19:56:45 +08:00

32 lines
857 B
TypeScript

// @ts-types="npm:sequelize"
import { Sequelize, Model, DataTypes } from 'sequelize'
export default class User extends Model {
declare created_id: number
static async initTable(sequelize: Sequelize, name: string) {
this.init({
created_id: {
type: DataTypes.INTEGER.UNSIGNED,
autoIncrement: true,
primaryKey: true,
},
user_name: {
type: DataTypes.STRING,
allowNull: true,
},
nick_name: {
type: DataTypes.STRING,
allowNull: true,
},
avatar: {
type: DataTypes.BLOB,
},
}, {
sequelize: sequelize,
tableName: name,
})
await this.sync({ alter: true })
}
}