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

Feature: RENAME statement for fields, databases and events #1615

Open
2 tasks done
itsezc opened this issue Jan 24, 2023 · 3 comments
Open
2 tasks done

Feature: RENAME statement for fields, databases and events #1615

itsezc opened this issue Jan 24, 2023 · 3 comments
Labels
feature New feature or request topic:schema This is related to schema definition and enforcement topic:surrealql This is related to the SurrealQL query language

Comments

@itsezc
Copy link
Contributor

itsezc commented Jan 24, 2023

Is your feature request related to a problem?

For the purposes of database migrations in production, it is necessary that fields, events, and even databases among other entities (i.e. namespaces), would need to be renamed.

Describe the solution

Provide RENAME as a Surreal SQL statement

Alternative methods

Copying data across fields / tables to rename them, which feels very much like an anti-pattern

SurrealDB version

surreal 1.0.0-beta.8 for linux on x86_64

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@itsezc itsezc added feature New feature or request triage This issue is new labels Jan 24, 2023
@tobiemh tobiemh removed the triage This issue is new label Feb 4, 2023
@tobiemh tobiemh added the topic:surrealql This is related to the SurrealQL query language label Mar 26, 2023
@cameronbraid
Copy link

cameronbraid commented Aug 21, 2023

Consider an alternative which may be suitable for a number of use cases which would avoid surreal having to do any data updates when certain 'renames' are needed

Allow aliases to be defined for namespace, database and tables - using tables as an example :

alias table page_views to page_views_x

then whenever interacting with the storage layer resolve the alias page_views into page_views_x

so select * from page_views would end up as select * from page_views_x

then when the alias is changed

alias table page_views to page_views_y

then select * from page_views would end up as select * from page_views_y

A use case for this is when doing CDC import from another database. Say I wanted to restart the CDC connector for table 'page_views' (which already has some corrupted data in it) I would point the new connector to table 'page_views_x' then when the snapshot has completed, I can switch over queries to run from this new table with the alias command.

@kearfy kearfy added the topic:schema This is related to schema definition and enforcement label Jan 18, 2024
@itsezc
Copy link
Contributor Author

itsezc commented Aug 7, 2024

Fixed by: #4465 @kearfy

@itsezc itsezc closed this as completed Aug 7, 2024
@kearfy kearfy reopened this Aug 7, 2024
@kearfy
Copy link
Member

kearfy commented Aug 7, 2024

Renaming resources is not actually aolved yet, leaving it open 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request topic:schema This is related to schema definition and enforcement topic:surrealql This is related to the SurrealQL query language
Projects
None yet
Development

No branches or pull requests

4 participants