pelican-dev / panel

https://pelican.dev
GNU Affero General Public License v3.0
877 stars 90 forks source link

Missing foreign keys SQLite #477

Closed Boy132 closed 3 months ago

Boy132 commented 3 months ago

The following foreign keys are missing when using SQLite:

Table name Referenced table name Constraint name Colum nname
allocations nodes allocations_node_id_foreign node_id
allocations servers allocations_server_id_foreign server_id
api_keys users api_keys_user_id_foreign user_id
databases database_hosts databases_database_host_id_foreign database_host_id
databases servers databases_server_id_foreign server_id
database_hosts nodes database_hosts_node_id_foreign node_id
eggs eggs eggs_copy_script_from_foreign copy_script_from
eggs eggs eggs_config_from_foreign config_from
egg_mount mounts egg_mount_mount_id_foreign mount_id
egg_mount eggs egg_mount_egg_id_foreign egg_id
egg_variables eggs service_variables_egg_id_foreign egg_id
mount_node nodes mount_node_node_id_foreign node_id
mount_node mounts mount_node_mount_id_foreign mount_id
mount_server servers mount_server_server_id_foreign server_id
mount_server mounts mount_server_mount_id_foreign mount_id
servers users servers_owner_id_foreign owner_id
servers nodes servers_node_id_foreign node_id
servers eggs servers_egg_id_foreign egg_id
servers allocations servers_allocation_id_foreign allocation_id
server_variables egg_variables server_variables_variable_id_foreign variable_id
server_variables servers server_variables_server_id_foreign server_id
subusers users subusers_user_id_foreign user_id
subusers servers subusers_server_id_foreign server_id

This is because you can only alter foreign keys when a table is created. The above foreign keys are created in migrations after the table is created thus they are missing.

RMartinOscar commented 3 months ago

So should we use a schema for sqlite aswell then ?

notAreYouScared commented 3 months ago

So should we use a schema for sqlite aswell then ?

This would require the end user to install the sqlite client packages, somthing were trying to avoid. But might not be an option.

RMartinOscar commented 3 months ago

So should we use a schema for sqlite aswell then ?

This would require the end user to install the sqlite client packages, somthing were trying to avoid. But might not be an option.

You did it anyway for mysql/mariadb why bother with sqlite3 ? If i want to use either of them i must install the client even if the instance is on an other machine.