Skip to content

Console: Add increment primary key in an existing Hasura table #8785

Open
@DesmondSol

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions