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

fix: sqlite temporary tables now honor withoutRowid #8431

Merged
merged 6 commits into from
Aug 25, 2022

Conversation

pthrasher
Copy link
Contributor

@pthrasher pthrasher commented Dec 5, 2021

Description of change

sqlite requries complete table re-creation for most migration operations. When this happens, there's a new table created named temporary_<old table name> -- This copies all of the table information, but previously failed to grab EntityMetadata for this new temporary table since the name doesn't exists amongst all entity metadatas.

(I also fixed lint errors inside the file I touched)

This PR fixes this problem by checking again if we found no match the first time.

Fixes: #8430

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change N/A
  • Documentation has been updated to reflect this change N/A
  • The new commits follow conventions explained in CONTRIBUTING.md

@pleerock
Copy link
Member

createTableSql creates table based on a given table: Table property provided into function parameters.

The correct way of fixing this issue (as well as fixing original change) is to use table.withoutRowid property.
This property is missing now in the Table class, but it needs to be added.
In order for this property to be set in the Table, it needs to be copied from EntityMetadata on Table object instance creation.
This way all other EntityMetadata -> Table properties are working, and we should seek to this pattern.

@pthrasher
Copy link
Contributor Author

@pleerock Good to know! I will alter my change to work that way.

@AlexMesser AlexMesser merged commit b8d04dc into typeorm:master Aug 25, 2022
@AlexMesser
Copy link
Collaborator

thank you for contribution!

nordinh pushed a commit to nordinh/typeorm that referenced this pull request Aug 29, 2022
* fix: sqlite temporary tables now honor withoutRowid

Closes: typeorm#8430

* merge master

* fixed `withoutRowid` on table recreation;
added test;

Co-authored-by: Thrasher <thrasher@grayshift.com>
Co-authored-by: Alex Messer <dmzt08@gmail.com>
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.

sqlite temporary tables do not honor withoutRowid
3 participants