Skip to content

Commit

Permalink
Add timezone to timestamps for postgres to correct for 1-2 hour off m…
Browse files Browse the repository at this point in the history
…od_time.

Add schema update 4/70 to postgres.
  • Loading branch information
NodudeWasTaken committed Nov 21, 2024
1 parent 0a7a340 commit cedcd28
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
52 changes: 26 additions & 26 deletions pkg/sqlite/migrationsPostgres/1_initial.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ CREATE TABLE blobs (
CREATE TABLE tags (
id serial not null primary key,
name text,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
ignore_auto_tag boolean not null default FALSE,
description text,
image_blob varchar(255) REFERENCES blobs(checksum),
Expand All @@ -18,9 +18,9 @@ CREATE TABLE folders (
id serial not null primary key,
path text NOT NULL,
parent_folder_id integer,
mod_time timestamp not null,
created_at timestamp not null,
updated_at timestamp not null,
mod_time TIMESTAMP WITH TIME ZONE not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
foreign key(parent_folder_id) references folders(id) on delete SET NULL
);
CREATE TABLE files (
Expand All @@ -29,9 +29,9 @@ CREATE TABLE files (
zip_file_id integer,
parent_folder_id integer not null,
size bigint NOT NULL,
mod_time timestamp not null,
created_at timestamp not null,
updated_at timestamp not null,
mod_time TIMESTAMP WITH TIME ZONE not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
foreign key(zip_file_id) references files(id),
foreign key(parent_folder_id) references folders(id),
CHECK (basename != '')
Expand All @@ -53,8 +53,8 @@ CREATE TABLE IF NOT EXISTS performers (
tattoos text,
piercings text,
favorite boolean not null default FALSE,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
details text,
death_date date,
hair_color text,
Expand All @@ -70,8 +70,8 @@ CREATE TABLE IF NOT EXISTS studios (
name text NOT NULL,
url VARCHAR(2048),
parent_id INTEGER DEFAULT NULL REFERENCES studios(id) ON DELETE SET NULL,
created_at timestamp NOT NULL,
updated_at timestamp NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
details TEXT,
rating smallint,
ignore_auto_tag BOOLEAN NOT NULL DEFAULT FALSE,
Expand All @@ -94,8 +94,8 @@ CREATE TABLE IF NOT EXISTS images (
studio_id integer,
o_counter smallint not null default 0,
organized boolean not null default FALSE,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
date date,
code text,
photographer text,
Expand All @@ -118,8 +118,8 @@ CREATE TABLE IF NOT EXISTS galleries (
studio_id integer,
rating smallint,
organized boolean not null default FALSE,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
code text,
photographer text,
foreign key(studio_id) references studios(id) on delete SET NULL,
Expand All @@ -140,8 +140,8 @@ CREATE TABLE IF NOT EXISTS scenes (
rating smallint,
studio_id integer,
organized boolean not null default FALSE,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
code text,
director text,
resume_time float not null default 0,
Expand All @@ -159,8 +159,8 @@ CREATE TABLE IF NOT EXISTS groups (
studio_id integer REFERENCES studios(id) ON DELETE SET NULL,
director text,
"description" text,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
front_image_blob varchar(255) REFERENCES blobs(checksum),
back_image_blob varchar(255) REFERENCES blobs(checksum)
);
Expand Down Expand Up @@ -194,12 +194,12 @@ CREATE TABLE studios_tags (
);
CREATE TABLE IF NOT EXISTS scenes_view_dates (
scene_id integer not null,
view_date timestamp not null,
view_date TIMESTAMP WITH TIME ZONE not null,
foreign key(scene_id) references scenes(id) on delete CASCADE
);
CREATE TABLE IF NOT EXISTS scenes_o_dates (
scene_id integer not null,
o_date timestamp not null,
o_date TIMESTAMP WITH TIME ZONE not null,
foreign key(scene_id) references scenes(id) on delete CASCADE
);
CREATE TABLE performer_stash_ids (
Expand Down Expand Up @@ -294,8 +294,8 @@ CREATE TABLE IF NOT EXISTS scene_markers (
seconds FLOAT NOT NULL,
primary_tag_id INTEGER NOT NULL,
scene_id INTEGER NOT NULL,
created_at timestamp NOT NULL,
updated_at timestamp NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
FOREIGN KEY(primary_tag_id) REFERENCES tags(id),
FOREIGN KEY(scene_id) REFERENCES scenes(id)
);
Expand Down Expand Up @@ -401,8 +401,8 @@ CREATE TABLE galleries_chapters (
title text not null,
image_index integer not null,
gallery_id integer not null,
created_at timestamp not null,
updated_at timestamp not null,
created_at TIMESTAMP WITH TIME ZONE not null,
updated_at TIMESTAMP WITH TIME ZONE not null,
foreign key(gallery_id) references galleries(id) on delete CASCADE
);
CREATE TABLE scene_urls (
Expand Down
1 change: 1 addition & 0 deletions pkg/sqlite/migrationsPostgres/4_markers_end.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE scene_markers ADD COLUMN end_seconds FLOAT;

0 comments on commit cedcd28

Please sign in to comment.