How to use the sequelize.STRING function in sequelize

To help you get started, we’ve selected a few sequelize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hydractify / kanna_kobayashi / models / Quiz.js View on Github external
/* eslint-disable new-cap */

const { INTEGER, STRING, Model } = require('sequelize');

const { instance: { db } } = require('../structures/PostgreSQL');

class Quiz extends Model { }

Quiz.init(
	{
		guildId: {
			field: 'guild_id',
			type: STRING('20'),
			primaryKey: true,
			validate: value => {
				if (Number(value) < 11) throw new Error('ID must be 11 or larger!');
			}
		},
		name: {
			type: STRING,
			set: function setName(value) {
				this.setDataValue('name', value.toLowerCase());
			}
		},
		photo: STRING,
		duration: {
			allowNull: false,
			type: INTEGER,
			default: 15
github SideProjectGuys / invite-manager-bot / src / sequelize.ts View on Github external
export interface MemberInstance extends Sequelize.Instance, MemberAttributes {
	getInviteCodes: Sequelize.HasManyGetAssociationsMixin;
	getJoins: Sequelize.HasManyGetAssociationsMixin;
	getLeaves: Sequelize.HasManyGetAssociationsMixin;
	getMemberSettings: Sequelize.HasManyGetAssociationsMixin;
	getCustomInvites: Sequelize.HasManyGetAssociationsMixin;
	// TODO: get custom invites via creatorId
	getCommandUsage: Sequelize.HasManyGetAssociationsMixin;
	getLogs: Sequelize.HasManyGetAssociationsMixin;
	getPremiumSubscriptions: Sequelize.HasManyGetAssociationsMixin;
}

export const members = sequelize.define(
	'member',
	{
		id: { type: Sequelize.STRING(32), primaryKey: true },
		name: Sequelize.STRING,
		discriminator: Sequelize.STRING
	},
	{
		timestamps: true,
		paranoid: true
	}
);

// ------------------------------------
// Guilds
// ------------------------------------
export interface GuildAttributes extends BaseAttributes {
	id: string;
	name: string;
	icon: string;
github ddnlink / ddn / packages / ddn-peer / src / db / sequelize / models / issuer.js View on Github external
module.exports = (connection) => {
  return connection.define('issuer', {
    name: {
      type: Sequelize.STRING(16), // 原类型:VARCHAR,size:16
      primaryKey: true,
      allowNull: false,
    },
    desc: {
      type: Sequelize.STRING(4096), // 原类型:VARCHAR,size:22
      allowNull: false,
    },
    issuer_id: {
      type: Sequelize.STRING(50), // 原类型:VARCHAR,size:50
    },
    transaction_id: {
      type: Sequelize.STRING(64), // 原类型:VARCHAR,size:64
      allowNull: false,
    },
  }, {
    timestamps: false,
    indexes: [{
        unique: true,
        fields: ['transaction_id']
      },
      {
        fields: ['issuer_id']
      }
    ]
  });
github plamzi / Havoc / plugins / char.fight.js View on Github external
A_STOPS_FIGHTING_B:				"%s stops fighting %s.",
		YOU_STOP_FIGHTING_NULL: 		"You stop fighting.",
		A_STOPS_FIGHTING_NULL:			"%s stops fighting.",
		ALREADY_FIGHTING: 				"You are already fighting %s.",
		TOO_BUSY_FIGHTING: 				"You are too busy fighting %s.",
		YOU_NEED_MORE_STAMINA_TO:  		"You need more stamina to %s.",
		YOU_NEED_MORE_MANA_TO:  		"You need more mana to %s.",
		YOU_KILLED_X:					"You killed %s.",
		YOU_WERE_DEFEATED_BY:			"You were defeated by %s.",
		TOO_IMMORTAL_TO_DIE: 			"Alas, you are too immortal to die...",
		X_IS_TOO_IMMORTAL_TO_DIE:		"%s is too immortal to die...",
	}
});

var attack_struct = {
	name: Seq.STRING(100),
	source: Seq.STRING(45),
	thirdperson: Seq.STRING(45),
	hit: Seq.STRING(255),
	action: Seq.STRING(255),
	type: {
		type: Seq.TEXT,
		get: function() {
			return this.getDataValue('type').split(',').trim();
		},
		set: function(v) {
			this.setDataValue('type', stringify(v));
		}
	},
	targets: {
		type: Seq.TEXT,
		get: function() {
github plamzi / Havoc / plugins / act.social.js View on Github external
Command: Seq.STRING(45),
	CharNoArg: Seq.STRING(100),
	OthersNoArg: Seq.STRING(100),
	CharFound: Seq.STRING(100),
	OthersFound: Seq.STRING(100),
	VictFound: Seq.STRING(100),
	NotFound: Seq.STRING(100),
	CharAuto: Seq.STRING(100),
	OthersAuto: Seq.STRING(100),
	MinPos: Seq.STRING(100),
	Hide: Seq.INTEGER,
	Racy: Seq.INTEGER
};

var message_struct = {
	name: Seq.STRING(100),
	type: Seq.STRING(45),
	from: Seq.STRING(45),
	to: Seq.STRING(45),
	from_id: Seq.INTEGER,
	to_id: Seq.INTEGER,
	text: Seq.TEXT,
	attr: {
		type: Seq.TEXT,
		get: function() {
			return eval('('+this.getDataValue('attr')+')');
		},
		set: function(v) {
			this.setDataValue('attr', stringify(v));
		}
	}
};
github flatlogic / react-dashboard / src / data / models / User.js View on Github external
*/

import DataType from 'sequelize';
import Model from '../sequelize';

const User = Model.define(
  'User',
  {
    id: {
      type: DataType.UUID,
      defaultValue: DataType.UUIDV1,
      primaryKey: true,
    },

    email: {
      type: DataType.STRING(255),
      validate: { isEmail: true },
    },

    emailConfirmed: {
      type: DataType.BOOLEAN,
      defaultValue: false,
    },
  },
  {
    indexes: [{ fields: ['email'] }],
  },
);

export default User;
github hgq1211 / 3dmark / models / user.js View on Github external
register_date: {
      field: 'register_date',
      type: Sequelize.STRING(32),
      allowNull: false,
      comment: "电话"//备注
    },
    user_id: {
      field: 'user_id',
      type: Sequelize.STRING(64),
      allowNull: false,
      unique: true,//索引
      primaryKey: true
    },
    password: {
      field: 'password',
      type: Sequelize.STRING(255),
      allowNull: false
    }
  }, {
    timestamps: false,
    freezeTableName: true,
    createdAt: false
  });
  module.exports =User;
github ahnuchen / yizhaopinApp / lib / create_orm.js View on Github external
Type: {type: Sequelize.INTEGER(1), allowNull: false},//@职位类型{1:全职,2:兼职,3:实习}
    maxSalary: {type: Sequelize.INTEGER(2), allowNull: false},//@最高薪水 format(10,99):10k-99k
    minSalary: {type: Sequelize.INTEGER(2), allowNull: false},//@最低薪水 format(10,99):10k-99k
    Description: {type: Sequelize.TEXT, allowNull: false},//详细描述
    Degree: {type: Sequelize.INTEGER(1), allowNull: false},//@学历 {0:大专,1:本科,2:硕士,3:博士,4:不限}
    Experience: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 1},//@工作经验{1:不限,2:应届毕业生,3:1-3年,4:3-5年,5:5-10年}
    Delete: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 1},//删除字段:{-1:删除,>=1未删除}
  }, {
    timestamps: true
  });
  /**
   * 个人简历表
   */
  orm.Resume = yizhaopin.define('resume', {
    ID: {type: Sequelize.INTEGER(10), primaryKey: true, allowNull: false, autoIncrement: true},
    HeadImage: {type: Sequelize.STRING(200), allowNull: false},//头像
    Name: {type: Sequelize.STRING(200), allowNull: false},//姓名
    Sex: {type: Sequelize.STRING(20), allowNull: false},//性别
    Birthday: {type: Sequelize.DATE, allowNull: false},//出生日期
    Degree: {type: Sequelize.INTEGER(1), allowNull: false},//@学历 {0:大专,1:本科,2:硕士,3:博士,4:其他}
    Experience: {type: Sequelize.INTEGER(2), allowNull: false},//工作年限{0:应届毕业生,1-10(n):n年,11:十年以上}
    Telephone: {type: Sequelize.STRING(20), allowNull: false},//电话号码
    Email: {type: Sequelize.STRING(50), allowNull: false},//邮箱
    LiveCity: {type: Sequelize.STRING(20), allowNull: false},//所在城市
    LiveProvince: {type: Sequelize.STRING(20), allowNull: false},//所在省
    Brief: {type: Sequelize.STRING(100), allowNull: false},//一句话介绍
    WorkExperience: {type: Sequelize.TEXT, allowNull: false},//工作经历JSONString[{company:"",position:"",joinTime:"",leaveTime:"",content:""},...]
    EducationExperience: {type: Sequelize.TEXT, allowNull: false},//教育经历:JSONString[{school:"",major:"",endTime:"",degree:""}]
    ExpectWork: {type: Sequelize.TEXT, allowNull: false},//期待工作JSONString:{name:"前端",type:"全职",city:"南京",salary:1,addtion:"补充说明(若有)"}
    ProjectExperience: {type: Sequelize.TEXT, allowNull: true}, //项目经验 JSONString {name:"商城",position:"",startTime:"",endTime:"",description:"",link:""}
    PersonalDescription: Sequelize.TEXT,//个人描述
    Delete: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 1},//删除字段:{-1:删除,>=1未删除}

sequelize

Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.

MIT
Latest version published 28 days ago

Package Health Score

95 / 100
Full package analysis