2020-10-05 23:59:12 +03:00
|
|
|
const { inherits } = require('util');
|
2019-06-04 00:37:17 +02:00
|
|
|
const ColumnCompiler = require('../../../schema/columncompiler');
|
2015-05-09 13:58:18 -04:00
|
|
|
|
|
|
|
// Column Compiler
|
|
|
|
// -------
|
|
|
|
|
|
|
|
function ColumnCompiler_SQLite3() {
|
|
|
|
ColumnCompiler.apply(this, arguments);
|
2016-12-11 17:23:44 +01:00
|
|
|
this.modifiers = ['nullable', 'defaultTo'];
|
2015-05-09 13:58:18 -04:00
|
|
|
}
|
|
|
|
inherits(ColumnCompiler_SQLite3, ColumnCompiler);
|
|
|
|
|
|
|
|
// Types
|
|
|
|
// -------
|
|
|
|
|
2018-07-09 08:10:34 -04:00
|
|
|
ColumnCompiler_SQLite3.prototype.double = ColumnCompiler_SQLite3.prototype.decimal = ColumnCompiler_SQLite3.prototype.floating =
|
|
|
|
'float';
|
2015-05-09 13:58:18 -04:00
|
|
|
ColumnCompiler_SQLite3.prototype.timestamp = 'datetime';
|
2020-04-19 00:40:23 +02:00
|
|
|
ColumnCompiler_SQLite3.prototype.enu = function (allowed) {
|
2018-07-09 08:10:34 -04:00
|
|
|
return `text check (${this.formatter.wrap(this.args[0])} in ('${allowed.join(
|
|
|
|
"', '"
|
|
|
|
)}'))`;
|
2017-05-10 11:04:13 -06:00
|
|
|
};
|
2015-05-09 13:58:18 -04:00
|
|
|
|
2018-09-26 08:15:31 +02:00
|
|
|
ColumnCompiler_SQLite3.prototype.json = 'json';
|
2020-12-30 21:16:09 +01:00
|
|
|
ColumnCompiler_SQLite3.prototype.jsonb = 'json';
|
2018-09-26 08:15:31 +02:00
|
|
|
|
2019-06-04 00:37:17 +02:00
|
|
|
module.exports = ColumnCompiler_SQLite3;
|