mirror of
https://github.com/knex/knex.git
synced 2025-10-09 15:06:55 +00:00
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
// SQLite3: Column Builder & Compiler
|
|
// -------
|
|
module.exports = function(client) {
|
|
|
|
var inherits = require('inherits');
|
|
var Schema = require('../../../schema');
|
|
|
|
// Column Builder
|
|
// -------
|
|
|
|
function ColumnBuilder_SQLite3() {
|
|
this.client = client;
|
|
Schema.ColumnBuilder.apply(this, arguments);
|
|
}
|
|
inherits(ColumnBuilder_SQLite3, Schema.ColumnBuilder);
|
|
|
|
// Column Compiler
|
|
// -------
|
|
|
|
function ColumnCompiler_SQLite3() {
|
|
this.modifiers = ['nullable', 'defaultTo'];
|
|
this.Formatter = client.Formatter;
|
|
Schema.ColumnCompiler.apply(this, arguments);
|
|
}
|
|
inherits(ColumnCompiler_SQLite3, Schema.ColumnCompiler);
|
|
|
|
// Types
|
|
// -------
|
|
|
|
ColumnCompiler_SQLite3.prototype.double =
|
|
ColumnCompiler_SQLite3.prototype.decimal =
|
|
ColumnCompiler_SQLite3.prototype.floating = 'float';
|
|
ColumnCompiler_SQLite3.prototype.timestamp = 'datetime';
|
|
|
|
// Compile a drop column command.
|
|
ColumnCompiler_SQLite3.prototype.dropColumn = function() {
|
|
throw new Error("Drop column not supported for SQLite.");
|
|
};
|
|
|
|
client.ColumnBuilder = ColumnBuilder_SQLite3;
|
|
client.ColumnCompiler = ColumnCompiler_SQLite3;
|
|
|
|
}; |