8000 `sql2pgroll`: Ignore `IF NOT EXISTS` in `CREATE INDEX` statement conversion by andrew-farries · Pull Request #759 · xataio/pgroll · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

sql2pgroll: Ignore IF NOT EXISTS in CREATE INDEX statement conversion #759

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
Mar 28, 2025

Conversation

andrew-farries
Copy link
Collaborator
@andrew-farries andrew-farries commented Mar 27, 2025

Convert CREATE INDEX IF NOT EXISTS statements to create_index operations as though the IF NOT EXISTS clause was not present.

A CREATE INDEX statement like this:

CREATE INDEX IF NOT EXISTS "name" ON "dogs" USING btree ("name");

is now converted to:

{
  "operations": [
    {
      "create_index": {
        "columns": {
          "name": {}
        },
        "method": "btree",
        "name": "name",
        "table": "dogs"
      }
    }
  ]
}

rather than a raw SQL migration.

See the discussion on #719 for the rationale behind this change.

Fixes #719 and #720

Convert `CREATE INDEX IF NOT EXISTS` statements to `create_index`
operations as though the `IF NOT EXISTS` clause was not present.

A `CREATE INDEX` statement like this:

```sql
CREATE INDEX IF NOT EXISTS "name" ON "dogs" USING btree ("name");
```

is now converted to:

```json
{
  "operations": [
    {
      "create_index": {
        "columns": {
          "name": {}
        },
        "method": "btree",
        "name": "name",
        "table": "dogs"
      }
    }
 
8000
 ]
}
```

rather than a raw SQL migration.

See the discussion on #719 for
the rationale behind this change.
@github-actions github-actions bot temporarily deployed to Docs Preview March 27, 2025 09:25 Inactive
@andrew-farries andrew-farries marked this pull request as ready for review March 27, 2025 09:38
@andrew-farries andrew-farries requested a review from kvch March 27, 2025 09:38
@andrew-farries andrew-farries merged commit 6936a85 into main Mar 28, 2025
30 checks passed
@andrew-farries andrew-farries deleted the convert-create-index-if-not-exists branch March 28, 2025 06:56
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.

pgroll convert generates invalid pgroll migration if comments in SQL
2 participants
0