feat: extends database schema with sync and creation timestamps
This commit is contained in:
parent
13ba132159
commit
5eab19c70e
3 changed files with 9 additions and 4 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
package database
|
package database
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
type FeedType string
|
type FeedType string
|
||||||
|
|
||||||
type Feed struct {
|
type Feed struct {
|
||||||
Name string
|
Name string
|
||||||
Url string
|
Url string
|
||||||
|
AddedAt *time.Time
|
||||||
|
LastSyncedAt *time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f Feed) Insert() (int64, error) {
|
func (f Feed) Insert() (int64, error) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ CREATE table feed (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
name text NOT NULL,
|
name text NOT NULL,
|
||||||
url text NOT NULL UNIQUE,
|
url text NOT NULL UNIQUE,
|
||||||
addedAt DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL
|
createdAt DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
|
lastSyncedAt DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
-- +migrate Down
|
-- +migrate Down
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ CREATE table article (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
name text NOT NULL,
|
name text NOT NULL,
|
||||||
url text NOT NULL UNIQUE,
|
url text NOT NULL UNIQUE,
|
||||||
readAt text,
|
readAt DATETIME,
|
||||||
feedId INTEGER,
|
feedId INTEGER,
|
||||||
FOREIGN KEY (feedId) REFERENCES feed(id)
|
FOREIGN KEY (feedId) REFERENCES feed(id)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue