Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table.timestamps() creates unusable column names with sailsjs #754

Closed
itsthatguy opened this issue Mar 27, 2015 · 8 comments
Closed

table.timestamps() creates unusable column names with sailsjs #754

itsthatguy opened this issue Mar 27, 2015 · 8 comments

Comments

@itsthatguy
Copy link

Issue

table.timestamps() creates created_at and updated_at while sailsjs is expecting createdAt and updatedAt

More information: BlueHotDog/sails-migrations#59

@tgriesser
Copy link
Member

IMO sql column names shouldn't be camel cased, but if you insist, just use timestamp rather than timestamps. It's one extra line:

table.timestamp('createdAt')
table.timestamp('updatedAt')

@tgriesser
Copy link
Member

Also, I'll probably make this configurable at some point but right now I'm refactoring a ton of stuff internally so it's not something I'm going to fix just yet.

@tkrotoff
Copy link
Contributor

@tgriesser Even if you are postponing this, it is best to keep the issue open (and tag it 'backlog', 'future', whatever) - otherwise how will you remember?

@tgriesser
Copy link
Member

Eh I'll just leave it open.

@tgriesser tgriesser reopened this Jun 24, 2015
@tkrotoff
Copy link
Contributor

Thx :)

@KieranHolroyd
Copy link

@tgriesser is this something that could be fixed now, i'm running into similar issues, it just seems like it should have an options object with columnName as an optional attribute or something?

@kibertoad
Copy link
Collaborator

@KieranHolroyd This will be fixed in 1.0.0 which should be released this week. There is a new option for that.

@OlivierCavadenti
Copy link
Collaborator

Yes, this function have now useCamelCase option:

timestamps — table.timestamps([useTimestamps], [defaultToNow], [useCamelCase])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants