-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
multiple primary keys #175
Comments
This breaks the AutoIncrement attribute. Any solution? |
Found a solution. Modify the if block in your first piece of code to pk number greater than 1: if (pks.Count > 1)
{
//, PRIMARY KEY (A_ID, B_ID)
sbQuery.Append("primary key (");
pks.Aggregate(sbQuery, (sb, c) => sb.Append(c.Name).Append(','));
sbQuery.Remove(sbQuery.Length - 1, 1).Append(')');
} For the SqlSecl method join the 2 first "if" like this: if (p.IsPK && p.IsAutoInc)
{
decl += "primary key autoincrement ";
} |
This should not work as autoincrement can be set on any columns. Instead try adding a space in the Append on the first line, and change 3 into 2 on the last line.
|
Btw:
|
Great! Thanks for your solution :) I noticed the impossibility of using with multiple autoincrement but i was wondering if someone would do that... that's why I was lazy. |
Any plans to merge this? |
I've modified a bit further the library so it supports new c# types like XElement, but i need 2-4 hours of brain to understand the github concept and tools, without breaking my TFS. My hourly rate is 130$, so i'll try when i have free brain. |
Btw, you should look at https://github.com/oysteinkrog/sqlite-net/ fork. |
I'm getting error: "near autoincrement syntax error"? Isn't it because sqlite does not support just "autoincrement" attribute? Autoincrement can be set on any columns, but there are restrictions with primary key: https://code.google.com/p/wwwsqldesigner/issues/detail?id=90 |
What is the latest state of affairs on this? Does anyone have code known to work with the latest https://github.com/oysteinkrog/SQLite.Net-PCL fork? Øystein et al has done some nice work but lacking support for compound natural primary keys really cripples a relational database. The workarounds are so ugly and allows for errors. |
Look at my fork, it is fixed in it. Works perfectly. |
how can I get this version from nuget??? |
Working on this in #280 |
In CreateTable, replace the code creating the string given to the Execute method by
And in the SqlDecl method, remove the line
Also in MigrateTable add a not supported exception:
The text was updated successfully, but these errors were encountered: