This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
If I use "Update database" to create a SQLite database from within the designer, the columns that are related are not created in the database.
for example: An orders table has a column named CustomerID which relates to table customer. After creation, the Orders table does not contain the CustomerID column. |
|
|
Do you mean: (1) If you create an entity property named CustomerID, we fail to create a CustomerID column? If so this is indeed a bug -- let me know if this is the case and I will investigate. (2) If you create an association from Order to Customer (called Customer), we fail to create a CustomerID column? If so this is a SQLite issue, because SQLite does not allow us to add foreign keys to an existing table (and we don't want to create a CustomerId column without a foreign key): you will need to create the column and foreign key by hand using a SQLite tool (which may mean deleting and recreating the table). In this case you should be getting a message telling you that the operation couldn't be carried out. Unfortunately SQLite has a number of limitations of this type: see http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=1270&PostID=1982 for details. Hope this clarifies things -- let me know if not, or if neither of these is the problem you're seeing. |
|
|
(1) Using the table definition below, perhaps I can clearly illustrate my problem.
CREATE TABLE CustomerOrder( [ID] [int] IDENTITY(1,1) NOT NULL, [CustomerName] [nvarchar](20) NULL, [CustomerID] [int] NOT NULL -- Where this column links to the primary key in Table Customer ) problem is If I use the designer, to create a SQLite Database using the schema generated by the designer I get the following table definitiion in SQLite CREATE TABLE CustomerOrder( [ID] [int] IDENTITY(1,1) NOT NULL, [CustomerName] [nvarchar](20) NULL ) problem is: There is a missing column..... I am aware that there are no relations in SQLite, but without this column it is not possible to relate my data, and requires manual work to add these columns. Surely the designer should create these fields for me even though the relation cant be gegenated, it is after all a valid column in the table.? |
|
|
Okay, thanks for clarifying this. You would prefer that, if you create a Customer association on the Order entity, we should create a CustomerId column on the Orders table, even though we can't create the foreign key relation. The current behaviour is by design: the designer relies on foreign keys to identify associations, so if we created a CustomerId column but no foreign key, the designer wouldn't recognise that as representing the association, so would attempt to create the association again when you did another Update Database. We are however conscious that databases differ in their level of support for integrity constraints so I will take another look at this and see if we can improve the way we identify associations, so that we can get rid of the limitation you have identified. Thanks as always for the feedback! |
|
|
Thanks once again for great support, its a real pleasure being a mindscape customer! Anthony |
|