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

Support for CockroachDB row-level TTL #13982

Open
Tracked by #16311
aydrian opened this issue Jun 23, 2022 · 1 comment
Open
Tracked by #16311

Support for CockroachDB row-level TTL #13982

aydrian opened this issue Jun 23, 2022 · 1 comment
Labels
kind/feature A request for a new feature. status/has-stopgap A stopgap for this functionality has been implemented. team/psl-wg team/schema Issue for team Schema. topic: cockroachdb topic: database-functionality

Comments

@aydrian
Copy link

aydrian commented Jun 23, 2022

Problem

The release of CockroachDB 22.1 included a preview of row-level TTL. Adding row-level TTL to a table involves setting storage parameters either on CREATE or after using an ALTER TABLE. There be a hidden column (crdb_internal_expiration) that holds the date which will need to be accessible using the Prisma Client for queries. Is there anything that can be done to better expose this feature using Prisma?

Suggested solution

It would be nice to have a way to set storage parameters using an @@ command on the model similar to @@map.

Alternatives

I think currently we would have to apply the row-level TTL after running the migration manually or attempt to edit the generated SQL. We would also need to figure out how Prisma would handle the hidden column. Do we manually add the column to the model? Would it be able to see it which selecting? This is similar to the region column.

Additional context

This is an interesting feature that you usually only see in Document or NoSQL databases.

This feature will be GA until 22.2.

@janpio
Copy link
Member

janpio commented Mar 25, 2023

MongoDB implements something similar via an index (!?): #5430

@janpio janpio added the status/has-stopgap A stopgap for this functionality has been implemented. label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. status/has-stopgap A stopgap for this functionality has been implemented. team/psl-wg team/schema Issue for team Schema. topic: cockroachdb topic: database-functionality
Projects
None yet
Development

No branches or pull requests

2 participants