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
|
Couple of things: In SQLite if I add or remove columns, the designer works great for round-trip. However, if I change an attribute of a column (like max length) it doesn't do anything. Is this a SQLLite limitation? Second, and this is a GUI issue -- if I have an existing Sqlite database and a model, there is now way to import it because the contect menu on the design surface does not have the option "update from database" until there is one entity on the surface. I have to add one, import, and then delete it. Thanks |
|
|
I'm not quite sure whether you're working model-first (changing things in the designer and choosing Update Database) or database-first (changing things in your SQLite tool and choosing Update From Source), so I'll address both cases. If you are working database-first: changing the length of a varchar column should certainly be picked up when you do an Update From Source. (On most non-string column types the max length would be ignored because LightSpeed applies length validations only to strings.) I have given this a quick test and it is working for me. Could you walk me through the steps to reproduce the problem? Thanks! If you are working model-first: changing the length validation of a string property will be picked up when you do an Update Database, but SQLite's DDL interface does not support altering a column type after creation, so you will get an error when you try to apply the change. This is a SQLite limitation. Regarding the GUI issue: if you click on the model background, you can type a SQLite connection string directly into the Connection String box (don't forget to set the Database Provider to SQLite). This gets around the need to drag a "dummy" table on in order to establish the relationship. Note, however, that when you do an Update From Source (database-first), LightSpeed will not offer to import new tables. (This is because many databases contain a large number of tables that users do not want to model using LightSpeed -- system tables, or just stuff that isn't used in their application.) Update From Source only updates existing entities. So if you are doing database-first then you will need to install the SQLite Server Explorer integration and drag the tables. If you are doing model-first then this is not an issue because LightSpeed will create tables for new entities. (In other words, all entities are tables, but not all tables are entities!) Hope this makes sense -- feedback welcome! |
|
|
Ivan, Thanks for the detailed explanation. This helps my mental model. I do have a couple of follow-up questions. If I drop the table in SQL Lite, then do "Update database" it will set the column in the database to "not null" whether I have the attribute "IsNullable" set to true or not. I also have "validate Presence" set to false. Steps:
Second, if I create a table with a identity method of "sequence" why doesn't it create an "autoincrement" column? Neither SQLLite nor SQL Server seem to do this. KeyTables work fine, but sometimes I would like to have a conventional autoincrement column. |
|
|
Are you using LightSpeed 2.2 RTM or the latest nightly build? We did make some fixes around nullability post-RTM, though I believe those were around adding columns rather than in CREATE TABLE... If you are on RTM, could you try upgrading to the latest nightly (you can get it from the store) and see if that helps matters? (Please note the warning about manually uninstalling RTM before installing the nightly.) If you still see this behaviour, could you try logging the generated SQL (choose Log SQL at the Update Database dialog) and post the generated SQL and the .lsmodel file please, so we can look into it? Thanks! Regarding "sequence": first, the Sequence identity method refers specifically to Oracle and PostgreSQL sequences, not to autoincrement/identity columns. To use an autoincrement/identity column, set the identity method to Identity Column. That said, this will only affect runtime behaviour: the designer does not yet generate columns as autoincrement/identity, even if the entity is marked as such. This is a known limitation. The workaround is to mark the column as autoincrement/identity in your database tool of choice; this should be a one-off, as once it is set up the designer won't try to change it back. (I realise it is rather annoying if your methodology is to clear the database and recreate from scratch each time, and that SQLite's limited support for altering tables post-creation does tend to push you down this route.) |
|