SQLite, issues creating a db with a tool

Hello all,

I want to create a SQLite database for a project. I used DBBrowser for that purpose, version 3.12.2. I just can’t add a foreign key using the interface. Here is an example:
image

I want to add field named fk_Util that will be a foreign key to Table Utilisateur field pk_Util. I add the field as an Integer. This is what it looks like now:
image

All is fine at this time. Then I want to add a Foreign Key Constraint, so I switch to the Constraint Tab:

image

This is where the issues lies: I can’ add the Table and Field names this field is related to either in the column called SQL nor in the script at the bottom that is graciously created for me.

If I click OK then I get an error message:
image

Hum, I figured out myself :roll_eyes:.

Is there something I am doing wrong ?

Thanks

resize the window where you see fields and click at foreignkey column/cells.
(scroll right in your first screenshot)

Right on the target !

Thanks

Next time, you will write the code without the tool ?

Nope

Care to explain why using a tool to get the code ?

the database management tool just generate the sql to modify the database and show it as preview too.
if you not input all the sql is incomplete.

I do not use any (so this may explain why I do not understand).

But with the provided examples in the LR, I do it manually.

Unfortunately, the API2 examples are less useful than the previous one (imho, bugt I can be wrong).

The important thing was for to be able to read what I wrote in the db file (and here with a dedicated / All purpose tool). Fortunately API1 LR provided the basic code examples to do one that fit my needs (report the TABLE schemas, the TABLEs contents, export data base structure as text, export visual db schema.

People already shared examples of what they’ve done… (very nice and pro images).

Exactly. I don’t want to learn the specifics of creating or modifying tables - don’t forget that each database engine has it’s own specificities. Creating the database is one small part of a project and I want to spend the least time doing that.

Having a way to look at the contents of the database is very useful to debug your code. On top of that I may modify existing records to create errors and see how the code process these errors.

These tools are very useful.

2 Likes