不要怂,就是干,撸起袖子干!

Commit cf2581ed by Daniel Durante

Fixed up postgres native dialect.

1 parent 66ccf6b9
...@@ -112,7 +112,7 @@ module.exports = (function() { ...@@ -112,7 +112,7 @@ module.exports = (function() {
}, },
describeTableQuery: function(tableName) { describeTableQuery: function(tableName) {
var query = 'SELECT c.column_name as "Field", c.column_default as "Default", c.is_nullable as "Null", c.data_type as "Type", (SELECT array_agg(e.enumlabel) FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid=e.enumtypid WHERE t.typname=c.udt_name) AS special FROM information_schema.columns c WHERE table_name = <%= table %>;' var query = 'SELECT c.column_name as "Field", c.column_default as "Default", c.is_nullable as "Null", c.data_type as "Type", (SELECT array_agg(e.enumlabel) FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid=e.enumtypid WHERE t.typname=c.udt_name) AS "special" FROM information_schema.columns c WHERE table_name = <%= table %>;'
return Utils._.template(query)({ return Utils._.template(query)({
table: this.escape(tableName) table: this.escape(tableName)
}) })
......
...@@ -6,7 +6,7 @@ buster.spec.expose() ...@@ -6,7 +6,7 @@ buster.spec.expose()
buster.testRunner.timeout = 2000 buster.testRunner.timeout = 2000
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
describe('[POSTGRES] associations', function() { describe('[POSTGRES Specific] associations', function() {
var sequelize = Helpers.createSequelizeInstance({dialect: dialect}) var sequelize = Helpers.createSequelizeInstance({dialect: dialect})
before(function(done) { before(function(done) {
......
...@@ -7,7 +7,7 @@ buster.spec.expose() ...@@ -7,7 +7,7 @@ buster.spec.expose()
buster.testRunner.timeout = 1000 buster.testRunner.timeout = 1000
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
describe('[POSTGRES] DAO', function() { describe('[POSTGRES Specific] DAO', function() {
var sequelize = Helpers.createSequelizeInstance({dialect: dialect}) var sequelize = Helpers.createSequelizeInstance({dialect: dialect})
before(function(done) { before(function(done) {
......
...@@ -6,7 +6,7 @@ buster.spec.expose() ...@@ -6,7 +6,7 @@ buster.spec.expose()
buster.testRunner.timeout = 1000 buster.testRunner.timeout = 1000
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
describe('[POSTGRES] hstore', function() { describe('[POSTGRES Specific] hstore', function() {
var hstore = require('../../lib/dialects/postgres/hstore') var hstore = require('../../lib/dialects/postgres/hstore')
describe('stringifyPart', function() { describe('stringifyPart', function() {
......
...@@ -10,7 +10,7 @@ buster.spec.expose() ...@@ -10,7 +10,7 @@ buster.spec.expose()
buster.testRunner.timeout = 1000 buster.testRunner.timeout = 1000
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
describe('[POSTGRES] QueryGenerator', function() { describe('[POSTGRES Specific] QueryGenerator', function() {
var sequelize = Helpers.createSequelizeInstance({dialect: dialect}) var sequelize = Helpers.createSequelizeInstance({dialect: dialect})
before(function(done) { before(function(done) {
var self = this var self = this
......
...@@ -11,7 +11,7 @@ describe(Helpers.getTestDialectTeaser("QueryInterface"), function() { ...@@ -11,7 +11,7 @@ describe(Helpers.getTestDialectTeaser("QueryInterface"), function() {
before(function(done) { before(function(done) {
this.sequelize = sequelize this.sequelize = sequelize
this.interface = this.sequelize.getQueryInterface() this.interface = this.sequelize.getQueryInterface()
done() Helpers.clearDatabase(this.sequelize, done)
}) })
describe('dropAllTables', function() { describe('dropAllTables', function() {
...@@ -86,11 +86,13 @@ describe(Helpers.getTestDialectTeaser("QueryInterface"), function() { ...@@ -86,11 +86,13 @@ describe(Helpers.getTestDialectTeaser("QueryInterface"), function() {
describe('describeTable', function() { describe('describeTable', function() {
it('reads the metadata of the table', function(done) { it('reads the metadata of the table', function(done) {
var self = this var self = this
this.interface.createTable('User', { var Users = self.sequelize.define('User', {
username: Helpers.Sequelize.STRING, username: Helpers.Sequelize.STRING,
isAdmin: Helpers.Sequelize.BOOLEAN, isAdmin: Helpers.Sequelize.BOOLEAN,
enumVals: Helpers.Sequelize.ENUM('hello', 'world') enumVals: Helpers.Sequelize.ENUM('hello', 'world')
}).success(function() { }, { freezeTableName: true })
Users.sync({ force: true }).success(function() {
self.interface.describeTable('User').complete(function(err, metadata) { self.interface.describeTable('User').complete(function(err, metadata) {
expect(err).toBeNull() expect(err).toBeNull()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!