Support smallserial and bigserial data type.
- Dominant language
- JavaScript
- Stars
- 68
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
Unlike mysql's `auto_increment` constraint, postgresql has 3 different types for autoincrement field `smallserial`, `serial`, `bigserial`.
For example,
```
db.createTable('user', {
id: { type: type.BIG_INTEGER, primaryKey: true, notNull: true, autoIncrement: true }
})
```
I tried this code but it creates `serial` type which is unexpected behavior. From quick look of source code, I think it would be same for `smallserial` type as well. It could be easily fixed like below.
``` js
createColumnConstraint: function(spec, options, tableName, columnName) {
var constraint = [],
cb;
if (spec.primaryKey && options.emitPrimaryKey) {
if (spec.autoIncrement) {
switch (spec.type) {
case type.SMALL_INTEGER: constraint.push('SMALLSERIAL');
case type.BIG_INTEGER: constraint.push('BIGSERIAL');
default: constraint.push('SERIAL');
}
}
constraint.push('PRIMARY KEY');
}
...
```
##
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29863459-support-smallserial-and-bigserial-data-type?utm_campaign=plugin&utm_content=tracker%2F14258523&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F14258523&utm_medium=issues&utm_source=github).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.