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
feat: implements Sqlite 'WITHOUT ROWID' table modifier #4688
Conversation
This new feature adds a 'withoutRowid' option to EntityOptions in order to enable Sqlite 'WITHOUT ROWID' modifier to the 'CREATE TABLE' statement. See https://www.sqlite.org/withoutrowid.html Closes: typeorm#3330
adding semicolons and spaces complained by linter
Thanks for contribution! Looks like you don't track changes of |
Hello Umed, thank you for reviewing. Can you point me to some code that does that tracking so I can have that as a guide in my implementation? |
its in the same sqlite query runner file, you need to figure solution for your feature. |
Changing the The current implementation of AbstractSqliteQueryRunner.ts does nothing when there is an update in the primary keys, see:
The reason for the "do nothing" implementation is probably because SQlite does not support an "alter table" command that would change the primary keys after the table is created. Given that I believe it does not make sense to track for changes for that property. Agree? |
Right, sqlite doesn't support alter table command, that's why we always re-create table (and backup and restore all the data) after anything changed in your schema. Example:
same process with just everything to make sure your code in the entity always match your database representation. Same you need to do - read information about |
But the problem with the withoutRowid option is it is an invisible change in the schema, that option defines the creation of the rowid column that is not declared in your Entity class. This method from RdbmsSchemaBuilder.ts will never be able to detect that there should be a modification in the table schema since there is no column added or removed:
That last line Am I mistaken? do you have any ideas? |
And I don't understand why are you asking to implement that right now if the current implementation of updatePrimaryKeys in AbstractSqliteQueryRunner.ts does nothing:
If the users of typeorm + SQLite were happy with that implementation why do we need to worry now? |
Okay let's merge it, since this feature most likely will be used during first-time table creation its okay for now not to have auto-syncing feature. |
@pleerock Please tell me, is code from this PR lets use |
@olosegres I've opened a PR to add the support you're requesting here: #8432 |
This new feature adds a 'withoutRowid' option to EntityOptions in order to
enable Sqlite 'WITHOUT ROWID' modifier to the 'CREATE TABLE' statement.
See https://www.sqlite.org/withoutrowid.html
Closes: #3330