-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
sync_schema ignores the addition of foreign keys, and incorrect insert statement #790
Comments
Hi. Thank you for using this lib and saying such nice words about it.
storage.insert_into<C>(columns(&C::getAId, &C::getBId), values(5, 10)); I'll add raw insert into TODO list right now. BTW can you share a project you use this lib for? I collect a list of projects to publish it inside this repo. Thanks |
Hey. I've added raw insert in TODO list a moment age |
Thanks for the quick reply.
For the project, sure! I'm doing some testing on my own, but if everything goes well, we'd love to use it here. |
Not sure how things work out, but like I said, if I don't find any major missing features, I definitely want to use the library for our project. C/C++ ORM is hard to come by. Requirements aside, I love projects like these and I want to see them get more traction. Every bit of exposure helps bring people in and contribute to make them even better. |
Oh that is cool. Please report every missing feature. It is very important. The goal if this lib is replacing raw string queries with strong typed and typos free with C++ |
Hi, after a bit of googling, it seems that you can just use a pragma. Using Result on the same database from the original post. From there, the handling should be similar to your from -> table.to |
Thank you. I'll make an improvement of |
@khgreav how do you expect to alter table and add foreign key? Is there a query type for this? Cause I don't know how to do this |
looks like there is no way of doing this out of box. Prove. So the feature will work like this:
|
I can have a look and let ya know if I figure something fancy out, the standard procedure for sqlite is to rename the old table, create a new table with the original name and then copy the data over and delete the old table. |
Hi, first and foremost, thanks for the library as I haven't seen too many usable ones around.
Now to get my issue, I've been playing with the library and testing it for a bit on and off. Yesterday, I came across 2 issues.
To illustrate, I've put together a small example below.
I tend to use class-based entities, but that shouldn't be an issue, at least I never found one up until now.
It seems that
sync_schema()
ignores addition of foreign keys once a table has been created previously. When I first created entity and tableC
, the foreign keys were not included, after adding foreign keys and callingsync_schema()
, the return value reports all tables asalready_in_sync
. Removing the database file and letting it be created again from scratch results in the desired composite and foreign keys.Table
C
exists to match records fromA
andB
, however, the insert statement fails. After debugging the code, I found out that the serialized statement to be executed is this:"INSERT INTO 'C' DEFAULT VALUES "
.Am I doing this wrong? Thanks for the help in advance.
The text was updated successfully, but these errors were encountered: