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

fix(migrations): CockroachDB compatibility & separate permission tables #204

Merged
merged 9 commits into from
Jul 22, 2024

Conversation

bouassaba
Copy link
Member

@bouassaba bouassaba commented Jul 22, 2024

  • fix(migrations): some fields were missing
  • fix(migrations): some fields had wrong data type
  • fix(migrations): some unique indexes were missing
  • fix(api): update Go code to always set create_time

@bouassaba bouassaba requested a review from dsonck92 July 22, 2024 17:33
@bouassaba bouassaba changed the title fix(migrations): remove Keyword::CurrentTimestamp to stay compatible with CockroachDB fix(migrations): fix CockroachDB compatibility & separate permission tables from file Jul 22, 2024
@bouassaba bouassaba changed the title fix(migrations): fix CockroachDB compatibility & separate permission tables from file fix(migrations): fix CockroachDB compatibility & separate permission tables Jul 22, 2024
@bouassaba bouassaba changed the title fix(migrations): fix CockroachDB compatibility & separate permission tables fix(migrations): CockroachDB compatibility & separate permission tables Jul 22, 2024
loboda4450
loboda4450 previously approved these changes Jul 22, 2024
@bouassaba bouassaba changed the title fix(migrations): CockroachDB compatibility & separate permission tables fix(migrations): remove Keyword::CurrentTimestamp to stay compatible with CockroachDB Jul 22, 2024
@bouassaba bouassaba changed the title fix(migrations): remove Keyword::CurrentTimestamp to stay compatible with CockroachDB fix(migrations): remove Keyword::CurrentTimestamp to stay compatible with CockroachDB Jul 22, 2024
@bouassaba bouassaba changed the title fix(migrations): remove Keyword::CurrentTimestamp to stay compatible with CockroachDB fix(migrations): CockroachDB compatibility & separate permission tables Jul 22, 2024
@bouassaba bouassaba marked this pull request as draft July 22, 2024 19:07
dsonck92
dsonck92 previously approved these changes Jul 22, 2024
@bouassaba
Copy link
Member Author

I found some issues in the data model when testing, I will need to fix them and ask for review again.

loboda4450
loboda4450 previously approved these changes Jul 22, 2024
@bouassaba bouassaba dismissed stale reviews from loboda4450 and dsonck92 via f938b29 July 22, 2024 20:25
@bouassaba bouassaba marked this pull request as ready for review July 22, 2024 20:33
@bouassaba
Copy link
Member Author

We get the following error when running the migrations in CockroachDB:

error returned from database: unknown signature: current_timestamp() (returning <string>)

Here is the explanation of the why from ChatGPT:

The error “unknown signature: current_timestamp() (returning )” during migration with Sea ORM when using CockroachDB is likely due to the way current_timestamp() is being interpreted. CockroachDB has specific functions and expected return types for date and time operations which can cause compatibility issues if not used correctly.

In Sea ORM, you typically define default values for timestamp columns using functions like current_timestamp(). However, CockroachDB has distinct variants of current_timestamp() that return different types, such as timestamp or timestamptz (timestamp with time zone). If the function call is not recognized with the correct return type, it results in the mentioned error.

@bouassaba bouassaba merged commit ad5cb13 into main Jul 22, 2024
2 checks passed
@bouassaba bouassaba deleted the fix/cockroach-compatibility branch July 22, 2024 21:13
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

Successfully merging this pull request may close these issues.

3 participants