diff --git a/pkg/database/migrations/001_inital_database.sql b/pkg/database/migrations/001_inital_database.sql index 66770a1..c78c150 100644 --- a/pkg/database/migrations/001_inital_database.sql +++ b/pkg/database/migrations/001_inital_database.sql @@ -27,9 +27,9 @@ CREATE TABLE "Post" CREATE TABLE "Source" ( id CHAR(25) UNIQUE PRIMARY KEY, - display_name TEXT NULL, - icon TEXT NULL, - domain TEXT NOT NULL UNIQUE, + display_name TEXT NULL, + icon TEXT NULL, + domain TEXT NOT NULL UNIQUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, deleted_at TIMESTAMP NULL @@ -54,10 +54,13 @@ CREATE TABLE "User" CREATE TABLE "PostReference" ( - post_id TEXT REFERENCES "Post" (id), - source_id TEXT REFERENCES "Source" (id), - url TEXT NOT NULL UNIQUE, - source_post_id TEXT, + post_id TEXT REFERENCES "Post" (id), + source_id TEXT REFERENCES "Source" (id), + url TEXT NOT NULL UNIQUE, + full_file_url TEXT, + preview_file_url TEXT, + sample_file_url TEXT, + source_post_id TEXT, PRIMARY KEY (post_id, source_id) ); @@ -77,8 +80,8 @@ CREATE TABLE "TagGroup" CREATE TABLE "UserFavorites" ( - user_id TEXT UNIQUE REFERENCES "User" (id), - post_id TEXT UNIQUE REFERENCES "Post" (id), + user_id TEXT UNIQUE REFERENCES "User" (id), + post_id TEXT UNIQUE REFERENCES "Post" (id), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (user_id, post_id) ); diff --git a/pkg/models/pgModels/postReference.go b/pkg/models/pgModels/postReference.go index ae4574c..1163731 100644 --- a/pkg/models/pgModels/postReference.go +++ b/pkg/models/pgModels/postReference.go @@ -1,8 +1,11 @@ package pgModels type PostReference struct { - PostID string `gorm:"primaryKey"` - SourceID string `gorm:"primaryKey"` - URL string `gorm:"not null;unique"` - SourcePostID string + PostID string `gorm:"primaryKey"` + SourceID string `gorm:"primaryKey"` + URL string `gorm:"not null;unique"` + SourcePostID string + FullFileURL string + PreviewFileURL string + SampleFileURL string }