这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rakeshkky
Copy link
Member

Description

What component does this PR affect?

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Requires changes from other components? If yes, please mark the components:

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Related Issue

close #79

Solution and Design

GraphQL Engine allows renaming tables and columns through run_sql query
Ex:-

POST /v1/query
{
  "type": "run_sql",
  "args": {
    "sql": "alter table articles rename to article;\nalter table article rename column article_id to id;\n"
  }
}

Support renaming relationship via rename_relationship query type
Ex:-

POST /v1/query
{
	"type": "rename_relationship",
	"args": {
		"table": "article",
		"name": "author",
		"new_name": "author_obj"
	}
}

Server updates all related metadata whenever any rename occurs

Internal code changes

  • All types present in ..DDL/Relationship.hs are moved to ..DDL/Relationship/Types.hs
  • Renaming related codebase is written in ..DDL/Schema/Rename.hs
  • Codebase related to migration are moved from Ops.hs to Migrate.hs

Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs update
  • Community content

Checklist:

  • I have read the contributing guide and my code conforms to the guidelines.
  • This change requires a change in the documentation.
  • I have updated the documentation accordingly.
  • I have added required tests.

rakeshkky and others added 30 commits July 1, 2018 23:42
…o rename-tab-col

Resolved Conflicts:
	server/src-lib/Hasura/RQL/DDL/Schema/Table.hs
	server/src-lib/Hasura/RQL/DDL/Schema/Table/Internal.hs
Resolved Conflicts:
	server/src-lib/Hasura/GraphQL/Schema.hs
Resolve Conflicts:
	server/src-lib/Hasura/RQL/DDL/Schema/Diff.hs
	server/src-lib/Hasura/RQL/DDL/Schema/Table.hs
Resolve Conflicts:
	server/graphql-engine.cabal
	server/src-exec/Ops.hs
	server/src-lib/Hasura/GraphQL/Schema.hs
	server/src-lib/Hasura/RQL/DDL/Metadata.hs
	server/src-lib/Hasura/RQL/DDL/Permission.hs
	server/src-lib/Hasura/RQL/DDL/Schema/Diff.hs
	server/src-lib/Hasura/RQL/DDL/Schema/Table.hs
	server/src-lib/Hasura/RQL/DDL/Utils.hs
	server/src-lib/Hasura/RQL/Types/SchemaCache.hs
	server/src-lib/Hasura/Server/App.hs
	server/src-lib/Hasura/Server/Init.hs
	server/src-lib/Hasura/Server/Version.hs
	server/src-rsr/init_views.sql
	server/test/Spec.hs
Resolve Conflicts:
	server/src-exec/Ops.hs
	server/src-rsr/migrate_from_8_to_9.sql
-> Internal refactor
TODO:-
  -> add tests
-> Tests for rename column, table and relationship
@hasura-bot
Copy link
Contributor

Review app for commit ede67cc deployed to Heroku: https://hge-ci-pull-1542.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1542-ede67cc

@hasura-bot
Copy link
Contributor

Review app for commit 0078307 deployed to Heroku: https://hge-ci-pull-1542.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1542-0078307

@rakeshkky rakeshkky removed the s/do-not-merge Do not merge this pull request to master label Feb 4, 2019
Resolve Conflicts:
	server/src-lib/Hasura/RQL/DDL/Schema/Table.hs
@hasura-bot
Copy link
Contributor

Review app for commit 7de6809 deployed to Heroku: https://hge-ci-pull-1542.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1542-7de6809

rakeshkky and others added 6 commits February 28, 2019 17:39
…79-renaming

Resolve Conflicts:
	console/src/components/Services/Data/TableModify/Modify.scss
	console/src/components/Services/Data/TableModify/ModifyTable.js
	console/src/components/Services/Data/TableModify/ModifyView.js
	console/src/components/Services/Data/TableRelationships/Relationships.js
	console/src/components/Services/Data/TableRelationships/RelationshipsView.js
	console/src/helpers/semver.js
	server/src-exec/Ops.hs
@hasura-bot
Copy link
Contributor

Review app for commit 0413380 deployed to Heroku: https://hge-ci-pull-1542.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1542-0413380

0x777
0x777 previously approved these changes Mar 1, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 8986e18 deployed to Heroku: https://hge-ci-pull-1542.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1542-8986e18

@0x777 0x777 merged commit 6c20ca8 into hasura:master Mar 1, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-1542.herokuapp.com is deleted

hasura-bot pushed a commit that referenced this pull request Jan 20, 2025
### What

This PR rewrites how argument and field presets are handled to address
two final bugs:

* If you define field presets on TypePermissions and that type is used
nested inside an argument's type somewhere, but as an array of the
object type, the field presets will not be applied
* If you define field presets on TypePermissions and your types are
recursive, field presets will only be applied to the first layer and not
past the point where the types recur

These bugs are caused by the argument presets being precalculated during
metadata resolve into field_paths that are used to poke the preset
values onto the arguments. However, this approach fundamentally doesn't
work, since recursive types make any field path infinitely long.

The only way to handle this correctly is to walk the types at query
time, along with the argument values provided by the user, and apply the
field presets. This allows you to walk the types recursively, and is not
infinite, since the recursion is bounded by the value provided by the
user. Walking the types also allows correct navigation of arrays (which
field paths didn't), so the presetting can descend into arrays and apply
presets to the objects inside.

### How

The argument_presets stage has been delete from metadata_resolve.
Instead, argument and field presetting is performed at query time in the
plan stage. This required access to metadata to perform, so metadata
types have been plumbed down into the GraphQL IR processing stage and
then into the argument planning code.

Please look at the comments I've submitted below for further commentary.

---------

Co-authored-by: Daniel Harvey <danieljamesharvey@gmail.com>
V3_GIT_ORIGIN_REV_ID: 362a1d5c2943c2a3837424c327b3e4defb0d600c
hasura-bot pushed a commit that referenced this pull request Jan 21, 2025
### What
Moves the changelog entries from #1542 into unreleased.

V3_GIT_ORIGIN_REV_ID: 10189534a4e68f91f88c928155b2308f9689540f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/console Related to console c/server Related to server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support renaming tables, columns and relationships

5 participants