Skip to content
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

exportToJson generate unusable export for table created with separate UNIQUE syntax. #561

Closed
twnaing opened this issue May 24, 2024 · 2 comments

Comments

@twnaing
Copy link

twnaing commented May 24, 2024

Describe the bug
exportToJson('full') create strange syntax when sqlite table is create with UNIQUE in CREATE TABLE

CREATE TABLE table1(
...
UNIQUE(column1, column2)
);

resulting json

        {
          "column": "UNIQUE(column1§",
          "value": "column2)"
        }

To Reproduce

  1. create migration with the UNIQUE syntax
  2. call exportToJson
  3. See error

Expected behavior
A synxtax that is valid for import.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: chromium
  • Version: 125.0.6422.60

Additional context

relevant part of package.json

    "@capacitor-community/sqlite": "^5.7.2",
    "jeep-sqlite": "^2.7.1",

Work around

Use CREATE UNIQUE INDEX table1_unique_index ON table1(column1, column2) syntax instead

EDIT: add UNIQUE to create index

@jepiqueau
Copy link
Collaborator

@twnaing the way to do it till i made the fix is "CONSTRAINT CUN_column1_column2 UNIQUE (column1, column2)"

@jepiqueau
Copy link
Collaborator

@twnaing has been fixed in v5.7.3

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants