Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by weiznich for Is it possible to use a table without primary key in diesel? Rust

Tables without primary key are not supported by diesel, because they are bad practice from a database point of view. In almost all cases there is some combination of columns that form a natural primary key, otherwise adding a artificial one is preferred. If you have a table that consists only of foreign key columns the natural foreign key would be constructed out of all those columns.

That said: It is possible to use diesel with tables without primary key column by just telling diesel that a specific (combination) of columns should be treated as primary key. In this case you need to write your table! definition for those tables manually.


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>