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

Timestamp field with default value on creation #90

Open
mcasto opened this issue Jan 15, 2022 · 3 comments
Open

Timestamp field with default value on creation #90

mcasto opened this issue Jan 15, 2022 · 3 comments

Comments

@mcasto
Copy link

mcasto commented Jan 15, 2022

I'm trying to create a timestamp field that defaults to the current timestamp (a "created_at" field).

I've tried ->defaultValue('CURRENT_TIMESTAMP') and ->defaultValue('NOW()') ... both return errors saying it's an invalid default value.

I can't find anything about this situation in the documentation, but it seems like a common enough task that it should be pretty simple ... and I suspect I'm missing something obvious.

Thanks in advance.

@debuss
Copy link

debuss commented Sep 7, 2022

Stuck with the same issue, did you find a solution ?

@mcasto
Copy link
Author

mcasto commented Sep 8, 2022

No. I wound up going into the DB directly and creating the table with SQL. A slight inconvenience, but easy enough. It does seem like this should be something Opis is set up for.

@debuss
Copy link

debuss commented Sep 8, 2022

I ended up doing the same, thanks for the feedback ;)

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

No branches or pull requests

2 participants