Skip to content

Commit ae86298

Browse files
committed
update timestamp type to bigint
1 parent 7ca3538 commit ae86298

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

syncstorage-postgres/migrations/2025-10-20-155711_create_schema/up.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CREATE TABLE user_collections (
33
user_id BIGINT NOT NULL,
44
collection_id INTEGER NOT NULL,
5-
modified TIMESTAMP NOT NULL,
5+
modified BIGINT NOT NULL,
66
count BIGINT,
77
total_bytes BIGINT,
88
PRIMARY KEY (user_id, collection_id)
@@ -15,7 +15,7 @@ CREATE TABLE bsos (
1515
bso_id TEXT NOT NULL,
1616
sortindex BIGINT,
1717
payload BYTEA NOT NULL,
18-
modified TIMESTAMP NOT NULL,
18+
modified BIGINT NOT NULL,
1919
expiry TIMESTAMP NOT NULL,
2020
PRIMARY KEY (
2121
user_id,

syncstorage-postgres/src/orm_models.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct Bso {
3434
pub bso_id: String,
3535
pub sortindex: Option<i64>,
3636
pub payload: Vec<u8>,
37-
pub modified: NaiveDateTime,
37+
pub modified: i64,
3838
pub expiry: NaiveDateTime,
3939
}
4040

@@ -51,7 +51,7 @@ pub struct UserCollection {
5151
pub user_id: i64,
5252

5353
pub collection_id: i32,
54-
pub modified: NaiveDateTime,
54+
pub modified: i64,
5555
pub count: Option<i64>,
5656
pub total_bytes: Option<i64>,
5757
}

syncstorage-postgres/src/schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ diesel::table! {
2626
bso_id -> Text,
2727
sortindex -> Nullable<Int8>,
2828
payload -> Bytea,
29-
modified -> Timestamp,
29+
modified -> Bigint,
3030
expiry -> Timestamp,
3131
}
3232
}
@@ -43,7 +43,7 @@ diesel::table! {
4343
user_collections (user_id, collection_id) {
4444
user_id -> Int8,
4545
collection_id -> Int4,
46-
modified -> Timestamp,
46+
modified -> Bigint,
4747
count -> Nullable<Int8>,
4848
total_bytes -> Nullable<Int8>,
4949
}

syncstorage-postgres/syncstorage_postgres_db.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Stores actual records being synced — Basic Storage Objects.
3434
| `bso_id` | `TEXT` | Unique ID within a collection. PK (part 4) |
3535
| `sortindex` | `BIGINT` | Indicates record importance for syncing (optional) |
3636
| `payload` | `BYTEA` | Bytes payload (e.g. JSON blob) |
37-
| `modified` | `TIMESTAMP` | Auto-assigned modification timestamp |
37+
| `modified` | `BIGINT` | Auto-assigned modification timestamp |
3838
| `expiry` | `TIMESTAMP` | TTL as absolute expiration time (optional) |
3939

4040
Indexes
@@ -89,7 +89,7 @@ erDiagram
8989
USER_COLLECTIONS {
9090
BIGINT user_id PK
9191
INTEGER collection_id PK
92-
TIMESTAMP modified
92+
BIGINT modified
9393
BIGINT count
9494
BIGINT total_bytes
9595
}
@@ -105,7 +105,7 @@ erDiagram
105105
TEXT bso_id PK
106106
BIGINT sortindex
107107
BYTEA payload
108-
TIMESTAMP modified
108+
BIGINT modified
109109
TIMESTAMP expiry
110110
}
111111

0 commit comments

Comments
 (0)