Skip to content

Commit d496312

Browse files
committed
Fix sqlite bigint primary keys
Fixes the following error > AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY by applying the workaround from SeaQL/sea-orm#1832
1 parent 7171896 commit d496312

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

Diff for: server/src/database/entity/cache.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pub type CacheModel = Model;
1414
pub struct Model {
1515
/// Unique numeric ID of the cache.
1616
#[sea_orm(primary_key)]
17+
// https://github.com/SeaQL/sea-orm/issues/1832
18+
#[cfg_attr(feature = "sqlite", sea_orm(column_type = "Integer"))]
1719
pub id: i64,
1820

1921
/// Unique name of the cache.

Diff for: server/src/database/entity/chunk.rs

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ pub enum ChunkState {
4444
pub struct Model {
4545
/// Unique numeric ID of the chunk.
4646
#[sea_orm(primary_key)]
47+
// https://github.com/SeaQL/sea-orm/issues/1832
48+
#[cfg_attr(feature = "sqlite", sea_orm(column_type = "Integer"))]
4749
pub id: i64,
4850

4951
/// The state of the chunk.

Diff for: server/src/database/entity/chunkref.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub type ChunkRefModel = Model;
2121
pub struct Model {
2222
/// Unique numeric ID of the link.
2323
#[sea_orm(primary_key)]
24+
// https://github.com/SeaQL/sea-orm/issues/1832
25+
#[cfg_attr(feature = "sqlite", sea_orm(column_type = "Integer"))]
2426
pub id: i64,
2527

2628
/// ID of the NAR.

Diff for: server/src/database/entity/nar.rs

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ pub enum NarState {
6868
pub struct Model {
6969
/// Unique numeric ID of the NAR.
7070
#[sea_orm(primary_key)]
71+
// https://github.com/SeaQL/sea-orm/issues/1832
72+
#[cfg_attr(feature = "sqlite", sea_orm(column_type = "Integer"))]
7173
pub id: i64,
7274

7375
/// The state of the NAR archive.

Diff for: server/src/database/entity/object.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub type ObjectModel = Model;
2121
pub struct Model {
2222
/// Unique numeric ID of the object.
2323
#[sea_orm(primary_key)]
24+
// https://github.com/SeaQL/sea-orm/issues/1832
25+
#[cfg_attr(feature = "sqlite", sea_orm(column_type = "Integer"))]
2426
pub id: i64,
2527

2628
/// ID of the binary cache the object belongs to.

0 commit comments

Comments
 (0)