hasura / hasura/graphql-engine

Console: Add increment primary key in an existing Hasura table

Open
#8,785 0 comments 0 reactions 0 assignees View on GitHub
c/console estimate/M k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version:
v2.10.0-cloud.1
### Environment

v2.10.0-cloud.1

### What is the current behaviour?

when creating my tables in the hasura console i forgot to make the id auto incremental for all the tables i used and after that when i tried to change them all to that there wasn't any easy way available i could find so i had to create alter statements for all the tables on the raw sql to do my tasks but since that is a lot of work can i ask if there is a better way already made.

### What is the expected behaviour?

finding an auto increment feature in the drop down section

### How to reproduce the issue?

1. create a table and a column with out setting auto increment
2.try to add auto increment for that column

### Please provide any traces or logs that could help here.

### Any possible solutions?

i used this raw sql code to solve this problem for all 25 tables

```
CREATE SEQUENCE winning_bids_details_id_seq OWNED BY winning_bids_details.id;

ALTER TABLE winning_bids_details ALTER COLUMN id SET DEFAULT nextval('winning_bids_details_id_seq');

UPDATE
winning_bids_details
SET
id = nextval('winning_bids_details_id_seq');
```

### Can you identify the location in the source code where the problem exists?

no

### If the bug is confirmed, would you be willing to submit a PR?

yes

### Keywords

ow to add increment primary key in an existing PostgreSQL table, how to add increment primary key in an existing PostgreSQL table

Contributor guide

Open the contributing guide

Research direction

Start by locating the Console table and column editing flow, then trace how PostgreSQL column defaults and sequences are handled. Done means an existing table column exposes an increment or auto-increment option and the resulting change works for the reported PostgreSQL case, including the existing data scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
database, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.