File tree 2 files changed +47
-1
lines changed
2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ var PgDriver = Base.extend({
340
340
341
341
if ( spec . primaryKey ) {
342
342
if ( spec . autoIncrement ) {
343
- constraint . push ( 'SERIAL' ) ;
343
+ constraint . push ( spec . type === this . type . BIGINT ? 'BIGSERIAL' : 'SERIAL' ) ;
344
344
}
345
345
346
346
if ( options . emitPrimaryKey ) {
Original file line number Diff line number Diff line change @@ -243,6 +243,52 @@ vows
243
243
}
244
244
}
245
245
} )
246
+ . addBatch ( {
247
+ autoIncrement : {
248
+ topic : function ( ) {
249
+ db . createTable (
250
+ 'event' ,
251
+ {
252
+ id : {
253
+ type : dataType . BIG_INTEGER ,
254
+ primaryKey : true ,
255
+ autoIncrement : true
256
+ }
257
+ } ,
258
+ this . callback . bind ( this )
259
+ ) ;
260
+ } ,
261
+
262
+ 'has column metadata' : {
263
+ topic : function ( ) {
264
+ dbmeta (
265
+ 'pg' ,
266
+ { connection : db . connection } ,
267
+ function ( err , meta ) {
268
+ if ( err ) {
269
+ return this . callback ( err ) ;
270
+ }
271
+ meta . getColumns ( 'event' , this . callback ) ;
272
+ } . bind ( this )
273
+ ) ;
274
+ } ,
275
+
276
+ 'with auto increment column' : function ( err , columns ) {
277
+ assert . isNull ( err ) ;
278
+ var column = findByName ( columns , 'id' ) ;
279
+ assert . strictEqual ( column . getDataType ( ) , 'BIGINT' ) ;
280
+ assert . strictEqual ( column . getDefaultValue ( ) , "nextval('event_id_seq'::regclass)" )
281
+ assert . strictEqual ( column . isPrimaryKey ( ) , true ) ;
282
+ assert . strictEqual ( column . isNullable ( ) , false ) ;
283
+ assert . strictEqual ( column . isAutoIncrementing ( ) , true ) ;
284
+ }
285
+ } ,
286
+
287
+ teardown : function ( ) {
288
+ db . dropTable ( 'event' , this . callback ) ;
289
+ }
290
+ }
291
+ } )
246
292
. addBatch ( {
247
293
dropTable : {
248
294
topic : function ( ) {
You can’t perform that action at this time.
0 commit comments