Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Use of timestamp type instead of datetime #59

Open
Nosfistis opened this issue Sep 27, 2017 · 4 comments
Open

Use of timestamp type instead of datetime #59

Nosfistis opened this issue Sep 27, 2017 · 4 comments

Comments

@Nosfistis
Copy link

I believe having timestamps in the database for row metadata is better than having datetime. Is there any plan to make this an option?

@clarkbw
Copy link
Owner

clarkbw commented Sep 27, 2017

I don't have any plans for that, but I'd be happy to take a PR with an option like that.

@Nosfistis
Copy link
Author

I don't mind trying to add an option, but I have not delved into creating mixins yet. I will take a try.

@clarkbw
Copy link
Owner

clarkbw commented Oct 9, 2017

Ok! Lemme try to get you started.

Change the type which is declared here:

(and here)

To be an option in the options. Also adding that option to this list:

const options = Object.assign({
createdAt: 'createdAt',
updatedAt: 'updatedAt',
required: true,
validateUpsert: false, // default to turning validation off
silenceWarnings: false,
}, bootOptions);

Default this new option to the current value of Date.

Watch out for the defaultFn just in case it does something strange with a timestamp.

Take a look at the current tests and add some when the option changes.

@Nosfistis
Copy link
Author

Ok! Thanks for the tips. I'll notify when I have a PR.

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

No branches or pull requests

2 participants