Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//
// DataTypes
// ~~~~~~~~~~~
//
// https://github.com/sequelize/sequelize/blob/v3.4.1/test/unit/sql/data-types.test.js
//
Sequelize.STRING;
Sequelize.STRING( 1234 );
Sequelize.STRING( { length : 1234 } );
Sequelize.STRING( 1234 ).BINARY;
Sequelize.STRING.BINARY;
Sequelize.TEXT;
Sequelize.TEXT( 'tiny' );
Sequelize.TEXT( { length : 'tiny' } );
Sequelize.TEXT( 'medium' );
Sequelize.TEXT( 'long' );
Sequelize.CHAR;
Sequelize.CHAR( 12 );
Sequelize.CHAR( { length : 12 } );
Sequelize.CHAR( 12 ).BINARY;
Sequelize.CHAR.BINARY;
Sequelize.BOOLEAN;
Sequelize.DATE;
Sequelize.DATE(6);
Sequelize.UUID;
Sequelize.UUIDV1;
Sequelize.UUIDV4;
Sequelize.NOW;
Sequelize.INTEGER;
Sequelize.INTEGER.UNSIGNED;
// DataTypes
// ~~~~~~~~~~~
//
// https://github.com/sequelize/sequelize/blob/v3.4.1/test/unit/sql/data-types.test.js
//
Sequelize.STRING;
Sequelize.STRING( 1234 );
Sequelize.STRING( { length : 1234 } );
Sequelize.STRING( 1234 ).BINARY;
Sequelize.STRING.BINARY;
Sequelize.TEXT;
Sequelize.TEXT( 'tiny' );
Sequelize.TEXT( { length : 'tiny' } );
Sequelize.TEXT( 'medium' );
Sequelize.TEXT( 'long' );
Sequelize.CHAR;
Sequelize.CHAR( 12 );
Sequelize.CHAR( { length : 12 } );
Sequelize.CHAR( 12 ).BINARY;
Sequelize.CHAR.BINARY;
Sequelize.BOOLEAN;
Sequelize.DATE;
Sequelize.DATE(6);
Sequelize.UUID;
Sequelize.UUIDV1;
Sequelize.UUIDV4;
Sequelize.NOW;
Sequelize.INTEGER;
Sequelize.INTEGER.UNSIGNED;
Sequelize.INTEGER.UNSIGNED.ZEROFILL;
Sequelize.INTEGER( 11 );
default:
if (swaggerPropertySchema.maxLength) {
// http://stackoverflow.com/questions/13932750/tinytext-text-mediumtext-and-longtext-maximum-sto
// http://stackoverflow.com/questions/7755629/varchar255-vs-tinytext-tinyblob-and-varchar65535-v
// NOTE: text may be in multibyte format!
if (swaggerPropertySchema.maxLength > 5592415) {
return Sequelize.TEXT("long");
}
if (swaggerPropertySchema.maxLength > 21845) {
return Sequelize.TEXT("medium");
}
// NOTE: VARCHAR(255) may container 255 multibyte chars: it's _NOT_ byte delimited
if (swaggerPropertySchema.maxLength > 255) {
return Sequelize.TEXT();
}
}
return Sequelize.STRING; // === VARCHAR
}
case "array":
if (dialect === "postgres") {
return Sequelize.ARRAY(getSequalizeType(swaggerPropertySchema.items));
}
console.log(
"Warning: encountered",
JSON.stringify(swaggerPropertySchema)
);
console.log(
"Can only handle array for postgres (yet?), see http://docs.sequelizejs.com/en/latest/api/datatypes/#array, falling back to blob"
params: [db.queryInterface, Sequelize]
},
storageOptions: {
// The configured instance of Sequelize.
sequelize: db,
// this one is actually undocumented
schema: 'zappr_meta',
// The name of the to be used model.
// (not sure if we need this actually)
modelName: 'SequelizeMeta',
// The name of table to create if `model` option is not supplied
tableName: 'migrations',
// The name of table column holding migration name.
columnName: 'migration',
// The type of the column holding migration name.
columnType: new Sequelize.TEXT
}
})
await db.createSchemas()
// apply migrations
await umzug.up({from: nconf.get('DB_UMZUG_FROM') || null})
init().listen(port)
info(`listening on port ${port}`)
if (opts.metricsEnabled) {
const actualMetricsPort = opts.metricsPort || 3003
initMetrics().listen(actualMetricsPort)
info(`metrics available on port ${actualMetricsPort}`)
}
}
return Sequelize.DATE;
case "uuid":
return Sequelize.UUID;
default:
if (swaggerPropertySchema.maxLength) {
// http://stackoverflow.com/questions/13932750/tinytext-text-mediumtext-and-longtext-maximum-sto
// http://stackoverflow.com/questions/7755629/varchar255-vs-tinytext-tinyblob-and-varchar65535-v
// NOTE: text may be in multibyte format!
if (swaggerPropertySchema.maxLength > 5592415) {
return Sequelize.TEXT("long");
}
if (swaggerPropertySchema.maxLength > 21845) {
return Sequelize.TEXT("medium");
}
// NOTE: VARCHAR(255) may container 255 multibyte chars: it's _NOT_ byte delimited
if (swaggerPropertySchema.maxLength > 255) {
return Sequelize.TEXT();
}
}
return Sequelize.STRING; // === VARCHAR
}
case "array":
if (dialect === "postgres") {
return Sequelize.ARRAY(getSequalizeType(swaggerPropertySchema.items));
}
console.log(
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW
},
post_date_gmt : {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW
},
post_content : {
type: Sequelize.TEXT,
allowNull: false,
defaultValue: ''
},
post_title: {
type: Sequelize.TEXT( 'tiny' ),
allowNull: false
},
post_excerpt: {
type: Sequelize.TEXT( 'tiny' ),
allowNull: false,
defaultValue: ''
},
post_status: {
type: Sequelize.STRING( 20 ),
allowNull: false,
defaultValue: 'publish'
},
comment_status: {
type: Sequelize.STRING( 20 ),
allowNull: false,
defaultValue: 'open'
type: DataTypes.STRING
},
sig: {
allowNull: false,
type: DataTypes.STRING,
validate: {
is: ["^[a-f0-9]{130}$"]
}
},
signer: {
allowNull: false,
type: DataTypes.STRING
},
errorHint: {
type: Sequelize.TEXT("MEDIUM")
},
timestamp: {
type: DataTypes.INTEGER
},
isPending: {
allowNull: false,
type: DataTypes.BOOLEAN
},
pendingTimestamp: {
type: DataTypes.INTEGER
},
createdAt: {
allowNull: false,
type: DataTypes.DATE
},
updatedAt: {