mirror of
https://github.com/knex/knex.git
synced 2025-12-29 07:59:31 +00:00
parent
0b1af71ac3
commit
a768c7881b
@ -34,7 +34,7 @@ ColumnCompiler_PG.prototype.bool = 'boolean';
|
||||
// Create the column definition for an enum type.
|
||||
// Using method "2" here: http://stackoverflow.com/a/10984951/525714
|
||||
ColumnCompiler_PG.prototype.enu = function(allowed) {
|
||||
return 'text check (' + this.args[0] + " in ('" + allowed.join("', '") + "'))";
|
||||
return 'text check (' + this.formatter.wrap(this.args[0]) + " in ('" + allowed.join("', '") + "'))";
|
||||
};
|
||||
|
||||
ColumnCompiler_PG.prototype.double = 'double precision',
|
||||
|
||||
@ -120,7 +120,7 @@ module.exports = function(knex) {
|
||||
table.uuid('uuid').notNull();
|
||||
}).testSql(function(tester) {
|
||||
tester('mysql', ['create table `datatype_test` (`enum_value` enum(\'a\', \'b\', \'c\'), `uuid` char(36) not null) default character set utf8']);
|
||||
tester('postgresql', ['create table "datatype_test" ("enum_value" text check (enum_value in (\'a\', \'b\', \'c\')), "uuid" uuid not null)']);
|
||||
tester('postgresql', ['create table "datatype_test" ("enum_value" text check ("enum_value" in (\'a\', \'b\', \'c\')), "uuid" uuid not null)']);
|
||||
tester('sqlite3', ['create table "datatype_test" ("enum_value" varchar, "uuid" char(36) not null)']);
|
||||
tester('oracle', ['create table "datatype_test" ("enum_value" varchar2(1) check ("enum_value" in (\'a\', \'b\', \'c\')), "uuid" char(36) not null)']);
|
||||
});
|
||||
|
||||
@ -352,7 +352,7 @@ module.exports = function(client) {
|
||||
table.enum('foo', ['bar', 'baz']);
|
||||
}).toSQL();
|
||||
equal(1, tableSql.length);
|
||||
expect(tableSql[0].sql).to.equal('alter table "users" add column "foo" text check (foo in (\'bar\', \'baz\'))');
|
||||
expect(tableSql[0].sql).to.equal('alter table "users" add column "foo" text check ("foo" in (\'bar\', \'baz\'))');
|
||||
});
|
||||
|
||||
it("adding date", function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user