8000 Convert column `FOREIGN KEY`s in `CREATE TABLE` by andrew-farries · Pull Request #554 · xataio/pgroll · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Convert column FOREIGN KEYs in CREATE TABLE #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

andrew-farries
Copy link
Collaborator

Convert inline FOREIGN KEY constraints in CREATE TABLE statements like this:

CREATE TABLE foo(a int REFERENCES bar(b))

into OpCreateTable operations like this:

[
  {
    "create_table": {
      "columns": [
        {
          "name": "a",
          "nullable": true,
          "references": {
            "column": "b",
            "name": "foo_a_fkey",
            "on_delete": "NO ACTION",
            "table": "bar"
          },
          "type": "int"
        }
      ],
      "name": "foo"
    }
  }
]

@andrew-farries andrew-farries marked this pull request as ready for review December 19, 2024 12:13
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-default branch from a0d708e to de07051 Compare December 19, 2024 12:57
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-fk branch from ca17cca to ae898a3 Compare December 19, 2024 12:57
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-default branch from de07051 to 042257a Compare December 19, 2024 13:12
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-fk branch from ae898a3 to 68ef5c4 Compare December 19, 2024 13:12
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-default branch from 042257a to facf39f Compare December 19, 2024 13:17
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-fk branch from 68ef5c4 to e15a153 Compare December 19, 2024 13:17
Base automatically changed from convert-create-table-inline-default to main December 19, 2024 13:19
Convert inline `FOREIGN KEY` values in `CREATE TABLE` statements like this:

```sql
CREATE TABLE foo(a int REFERENCES bar(b))
```

into `OpCreateTable` operations like this:

```json
[
  {
    "create_table": {
      "columns": [
        {
          "name": "a",
          "nullable": true,
          "references": {
            "column": "b",
            "name": "foo_a_fkey",
            "on_delete": "NO ACTION",
            "table": "bar"
          },
          "type": "int"
        }
      ],
      "name": "foo"
    }
  }
]
```
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-fk branch from e15a153 to f02565f Compare December 19, 2024 13:20
@andrew-farries andrew-farries merged commit b65d850 into main Dec 19, 2024
28 checks passed
@andrew-farries andrew-farries deleted the convert-create-table-inline-fk branch December 19, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0