graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

[Feature Request] Move table from a schema to another

Open mnlbox opened this issue 6 years ago • 6 comments
trafficstars

Hi guys, I created some table in public schema and now I want to move that table to a new schema. I think this is a very useful feature that we can move table from one schema to another in console.
Please vote up this if you agree with this. :wink:

mnlbox avatar Aug 26 '19 12:08 mnlbox

I love this! I know it can be done with SQL, but if Hasura could migrate it, it could update relationships and the meta tables (hdb_*) automatically.

mrcampbell avatar Sep 04 '19 22:09 mrcampbell

@mnlbox @Mrcampbell You can run the ALTER TABLE .. query in the Run SQL section of the console and move the table from one schema to another schema. The server will take care of migrating relationship/permission definition in the metadata tables (hdb_*) :slightly_smiling_face:

Example:-

-- move table "foo" from public to test schema
alter table foo set schema test;

However, altering multiple tables' schema (in the same query) may result in an error if tables have relationships defined on each other. See https://github.com/hasura/graphql-engine/issues/3059

The console should support moving tables across schemas under the Modify section in UI.

rakeshkky avatar Oct 14 '19 09:10 rakeshkky

@rakeshkky Any plan for this in roadmap?

mnlbox avatar Dec 09 '19 06:12 mnlbox

@mnlbox We'll add support to console in upcoming weeks. Till then you can try manually moving a table from one schema to another using ALTER .. statement in SQL section of console UI (DATA -> SQL)

rakeshkky avatar Dec 09 '19 07:12 rakeshkky

@rakeshkky Any update on this feature?

mnlbox avatar Sep 23 '20 13:09 mnlbox

@rakeshkky This feature would be very helpful.

mikiastilahun avatar Aug 13 '24 15:08 mikiastilahun