knex/lib/dialects/sqlite3/schema/sqlite-columncompiler.js

29 lines
740 B
JavaScript
Raw Normal View History

const ColumnCompiler = require('../../../schema/columncompiler');
2015-05-09 13:58:18 -04:00
// Column Compiler
// -------
class ColumnCompiler_SQLite3 extends ColumnCompiler {
constructor() {
super(...arguments);
this.modifiers = ['nullable', 'defaultTo'];
}
2015-05-09 13:58:18 -04:00
// Types
// -------
2015-05-09 13:58:18 -04:00
enu(allowed) {
return `text check (${this.formatter.wrap(
this.args[0]
)} in ('${allowed.join("', '")}'))`;
}
}
2015-05-09 13:58:18 -04:00
ColumnCompiler_SQLite3.prototype.json = 'json';
ColumnCompiler_SQLite3.prototype.jsonb = 'json';
ColumnCompiler_SQLite3.prototype.double = ColumnCompiler_SQLite3.prototype.decimal = ColumnCompiler_SQLite3.prototype.floating =
'float';
ColumnCompiler_SQLite3.prototype.timestamp = 'datetime';
module.exports = ColumnCompiler_SQLite3;