knex/src/dialects/sqlite3/schema/columncompiler.js

26 lines
714 B
JavaScript
Raw Normal View History

2015-05-09 13:58:18 -04:00
import inherits from 'inherits';
import ColumnCompiler from '../../../schema/columncompiler';
2015-05-09 13:58:18 -04:00
// Column Compiler
// -------
function ColumnCompiler_SQLite3() {
ColumnCompiler.apply(this, arguments);
this.modifiers = ['nullable', 'defaultTo'];
2015-05-09 13:58:18 -04:00
}
inherits(ColumnCompiler_SQLite3, ColumnCompiler);
// Types
// -------
ColumnCompiler_SQLite3.prototype.double =
ColumnCompiler_SQLite3.prototype.decimal =
ColumnCompiler_SQLite3.prototype.floating = 'float';
ColumnCompiler_SQLite3.prototype.timestamp = 'datetime';
ColumnCompiler_SQLite3.prototype.enu = function(allowed) {
return `text check (${this.formatter.wrap(this.args[0])} in ('${allowed.join("', '")}'))`;
};
2015-05-09 13:58:18 -04:00
export default ColumnCompiler_SQLite3;