Remove tabs

This commit is contained in:
Evan Reichard 2021-01-04 01:55:41 -05:00
parent e8003f15d7
commit 5b068f607c
3 changed files with 39 additions and 39 deletions

View File

@ -1,53 +1,53 @@
CREATE TABLE IF NOT EXISTS [ServerSettings] ( CREATE TABLE IF NOT EXISTS [ServerSettings] (
[settingID] INTEGER PRIMARY KEY, [settingID] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL, [name] TEXT NOT NULL,
[description] TEXT NOT NULL, [description] TEXT NOT NULL,
[value] TEXT NOT NULL [value] TEXT NOT NULL
); );
CREATE TABLE IF NOT EXISTS [Users] ( CREATE TABLE IF NOT EXISTS [Users] (
[userID] INTEGER PRIMARY KEY, [userID] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL, [name] TEXT NOT NULL,
[email] TEXT, [email] TEXT,
[authType] TEXT NOT NULL, [authType] TEXT NOT NULL,
[salt] TEXT, [salt] TEXT,
[hashedPWSalt] TEXT [hashedPWSalt] TEXT
); );
CREATE TABLE IF NOT EXISTS [MediaItems] ( CREATE TABLE IF NOT EXISTS [MediaItems] (
[mediaID] INTEGER PRIMARY KEY, [mediaID] INTEGER PRIMARY KEY,
[userID] INTEGER NOT NULL, [userID] INTEGER NOT NULL,
[EXIFDate] TEXT NOT NULL, [EXIFDate] TEXT NOT NULL,
[uploadDate] TEXT NOT NULL, [uploadDate] TEXT NOT NULL,
[latitude] TEXT, [latitude] TEXT,
[longitude] TEXT, [longitude] TEXT,
[mediaType] INTEGER, /* 0 = Photo, 1 = Video */ [mediaType] INTEGER, /* 0 = Photo, 1 = Video */
[relPath] TEXT NOT NULL, [relPath] TEXT NOT NULL,
FOREIGN KEY (userID) REFERENCES Users(userID) FOREIGN KEY (userID) REFERENCES Users(userID)
); );
CREATE TABLE IF NOT EXISTS [Tags] ( CREATE TABLE IF NOT EXISTS [Tags] (
[tagID] INTEGER PRIMARY KEY, [tagID] INTEGER PRIMARY KEY,
[name] TEXT NOT NULL [name] TEXT NOT NULL
); );
CREATE TABLE IF NOT EXISTS [MediaTags] ( CREATE TABLE IF NOT EXISTS [MediaTags] (
[mediaID] INTEGER NOT NULL, [mediaID] INTEGER NOT NULL,
[tagID] INTEGER NOT NULL, [tagID] INTEGER NOT NULL,
FOREIGN KEY (mediaID) REFERENCES MediaItems(mediaID) FOREIGN KEY (mediaID) REFERENCES MediaItems(mediaID)
FOREIGN KEY (tagID) REFERENCES Tags(tagID) FOREIGN KEY (tagID) REFERENCES Tags(tagID)
); );
CREATE TABLE IF NOT EXISTS [Albums] ( CREATE TABLE IF NOT EXISTS [Albums] (
[albumID] INTEGER PRIMARY KEY, [albumID] INTEGER PRIMARY KEY,
[userID] INTEGER NOT NULL, [userID] INTEGER NOT NULL,
[name] TEXT NOT NULL, [name] TEXT NOT NULL,
FOREIGN KEY (userID) REFERENCES Users(userID) FOREIGN KEY (userID) REFERENCES Users(userID)
); );
CREATE TABLE IF NOT EXISTS [MediaAlbums] ( CREATE TABLE IF NOT EXISTS [MediaAlbums] (
[mediaID] INTEGER NOT NULL, [mediaID] INTEGER NOT NULL,
[albumID] INTEGER NOT NULL, [albumID] INTEGER NOT NULL,
FOREIGN KEY (mediaID) REFERENCES MediaItems(mediaID) FOREIGN KEY (mediaID) REFERENCES MediaItems(mediaID)
FOREIGN KEY (albumID) REFERENCES Albums(albumID) FOREIGN KEY (albumID) REFERENCES Albums(albumID)
); );

View File

@ -8,14 +8,14 @@ import (
) )
type MediaItem struct { type MediaItem struct {
mediaID int mediaID int
userID int userID int
EXIFDate string EXIFDate string
uploadDate string uploadDate string
latitude string latitude string
longitude string longitude string
mediaType int mediaType int
relPath string relPath string
} }
func init() { func init() {
@ -23,8 +23,8 @@ func init() {
} }
func ItemsFromAlbum(userID int, albumID int) []MediaItem { func ItemsFromAlbum(userID int, albumID int) []MediaItem {
database, _ := sql.Open("sqlite3", "./db/imagini.db") database, _ := sql.Open("sqlite3", "./db/imagini.db")
rows, _ := database.Query(` rows, _ := database.Query(`
SELECT SELECT
MediaItems.* MediaItems.*
FROM FROM
@ -46,8 +46,8 @@ func ItemsFromAlbum(userID int, albumID int) []MediaItem {
} }
func ItemsFromTags(userID int, tagID int) []MediaItem { func ItemsFromTags(userID int, tagID int) []MediaItem {
database, _ := sql.Open("sqlite3", "./db/imagini.db") database, _ := sql.Open("sqlite3", "./db/imagini.db")
rows, _ := database.Query(` rows, _ := database.Query(`
SELECT SELECT
MediaItems.* MediaItems.*
FROM FROM
@ -69,7 +69,7 @@ func ItemsFromTags(userID int, tagID int) []MediaItem {
} }
func IndexMediaItems(newItems []MediaItem) { func IndexMediaItems(newItems []MediaItem) {
database, _ := sql.Open("sqlite3", "./db/imagini.db") database, _ := sql.Open("sqlite3", "./db/imagini.db")
statement, _ := database.Prepare(` statement, _ := database.Prepare(`
INSERT INTO MediaItems ( INSERT INTO MediaItems (
userID, userID,

View File

@ -1,8 +1,8 @@
package main package main
import ( import (
"os" "os"
"log" "log"
"reichard.io/imagini/cmd" "reichard.io/imagini/cmd"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )