make date-related columns "text".

This commit is contained in:
Joe Ardent 2024-04-09 17:44:37 -07:00
parent 9179395aee
commit ba1f9119e8
6 changed files with 18 additions and 15 deletions

View file

@ -3,11 +3,11 @@ create table if not exists users (
username text not null unique,
displayname text,
email text,
last_seen datetime,
last_seen text,
pwhash blob not null,
invited_by blob not null,
is_active boolean not null default true,
last_updated datetime not null default CURRENT_TIMESTAMP,
last_updated text not null default CURRENT_TIMESTAMP,
foreign key (invited_by) references users (id)
);
create index if not exists users_username_dex on users (lower(username));
@ -25,9 +25,9 @@ END;
create table if not exists invites (
id blob not null primary key default (julid_new()),
owner blob not null,
expires_at datetime,
expires_at text,
remaining int not null default 1,
last_updated datetime not null default CURRENT_TIMESTAMP,
last_updated text not null default CURRENT_TIMESTAMP,
foreign key (owner) references users (id) on delete cascade on update no action
);
create index if not exists invites_owner_dex on invites (owner);

View file

@ -5,9 +5,9 @@ create table if not exists watches (
title text not null,
metadata_url text, -- possible url for imdb or other metadata-esque site to show the user
length int,
release_date date,
release_date text,
added_by blob not null, -- ID of the user that added it
last_updated datetime not null default CURRENT_TIMESTAMP,
last_updated text not null default CURRENT_TIMESTAMP,
foreign key (added_by) references users (id)
);
create index if not exists watches_title_dex on watches (lower(title));
@ -26,9 +26,9 @@ create table if not exists watch_quests (
priority int, -- 1-5 how much do you want to watch it
public boolean not null default true,
watched boolean not null default false,
when_watched datetime,
created_at datetime not null default CURRENT_TIMESTAMP,
last_updated datetime not null default CURRENT_TIMESTAMP,
when_watched text,
created_at text not null default CURRENT_TIMESTAMP,
last_updated text not null default CURRENT_TIMESTAMP,
foreign key (user) references users (id) on delete cascade on update no action,
foreign key (watch) references watches (id) on delete cascade on update no action,
primary key (user, watch)
@ -50,7 +50,7 @@ create table if not exists watch_notes (
watch blob not null,
note blob,
public boolean not null,
last_updated datetime not null default CURRENT_TIMESTAMP,
last_updated text not null default CURRENT_TIMESTAMP,
foreign key (user) references users (id) on delete cascade on update no action,
foreign key (watch) references watches (id) on delete cascade on update no action
);

View file

@ -2,8 +2,8 @@ create table if not exists stars (
id blob not null primary key default (julid_new()),
name text not null,
metadata_url text,
born date,
died date
born text,
died text
);
create index if not exists stars_name_dex on stars (lower(name));

View file

@ -1,7 +1,7 @@
create table if not exists follows (
follower blob not null,
followee blob not null,
created_at datetime not null default CURRENT_TIMESTAMP,
created_at text not null default CURRENT_TIMESTAMP,
foreign key (follower) references users (id) on delete cascade on update no action,
foreign key (followee) references users (id) on delete cascade on update no action,
unique (follower, followee)

View file

@ -1,2 +1,4 @@
drop view if exists i;
drop view if exists u;
drop view if exists s;
drop view if exists w;

View file

@ -1,3 +1,4 @@
create view if not exists w as select julid_string(id) id, kind, title, metadata_url, length, release_date, last_updated from watches;
create view if not exists s as select julid_string(id) id, name, born, died;
create view if not exists s as select julid_string(id) id, name, born, died from stars;
create view if not exists u as select julid_string(id) id, username, displayname, email, last_seen, last_updated from users;
create view if not exists i as select julid_string(id) id, julid_string(owner) owner, expires_at, remaining, last_updated from invites;