hasura / hasura/graphql-engine

CLI: updating table name casing results in invalid metadata files:

Open
#7,866 0 comments 0 reactions 0 assignees View on GitHub
c/cli k/bug t/product-platform
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.0.10
CLI Version (for CLI related issue): 2.0.10

### Environment

Tested on OSS. The problem is most likely unique to windows.

### What is the expected behaviour?

Tables can be renamed from the hasura console.
When this happens, a new table metadata file will be created with the scheme `_.yaml`, and the entry in `tables.yaml` will be updated too.

### Keywords

metadata casing update invalid metadata

### What is the current behaviour?

When a table is renamed, and the change is only a change in casing, for example from `User` to `user`, a new file won't be created.
Instead, the same file will be used. This is not a problem on windows filesystems since they are not case sensitive.
However, if those migration files are transferred to a unix filesystem, we start runing into issues, because the entry in the `tables.yaml` file will contain the new name, but the file will still be using the old name.

The error messages are unhelpful.

### How to reproduce the issue?

1. Use a Windows OS
2. From the cli console, create a table `User` in the public schema.
3. A metadata file will be created with the name `public_User.yaml`, and an entry for this table will be created in the `tables.yaml` file
4. From the cli console, rename the table to `user`
5. The `tables.yaml` file will be updated correctly, but the `public_User.yaml` file will still be used.

### Any possible solutions?

This is currently fixable by manually renaming the files.
The table files should have named matching the corresponding entry in the `tables.yaml` file.

Related issue: #7856

Contributor guide

Open the contributing guide

Research direction

Reproduce the rename through the CLI console on Windows, starting with the generated tables.yaml entry and the public_User.yaml metadata file. Trace the casing-only rename handling and verify that the metadata filename matches the updated tables.yaml entry when moved to a case-sensitive filesystem.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, yaml
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.