Add check constraints to ensure names aren't empty

This commit is contained in:
Tim Van Baak 2025-02-20 16:07:06 -08:00
parent c8bdf0f4b2
commit c22ab7b5b4

View File

@ -2,21 +2,24 @@ create table sources(
name text not null, name text not null,
state blob, state blob,
lastUpdated int not null, lastUpdated int not null,
primary key (name) primary key (name),
check (name <> '')
) strict; ) strict;
create table actions( create table actions(
source text not null, source text not null,
name text not null, name text not null,
argv blob not null, argv blob not null,
unique (source, name) on conflict replace, unique (source, name) on conflict replace,
foreign key (source) references sources (name) on delete cascade foreign key (source) references sources (name) on delete cascade,
check (name <> '')
) strict; ) strict;
create table envs( create table envs(
source text not null, source text not null,
name text not null, name text not null,
value text not null, value text not null,
unique (source, name) on conflict replace, unique (source, name) on conflict replace,
foreign key (source) references sources (name) on delete cascade foreign key (source) references sources (name) on delete cascade,
check (name <> '')
) strict; ) strict;
create table items( create table items(
source text not null, source text not null,
@ -33,13 +36,15 @@ create table items(
tts int, tts int,
action blob, action blob,
primary key (source, id), primary key (source, id),
foreign key (source) references sources (name) on delete cascade foreign key (source) references sources (name) on delete cascade,
check (id <> '')
) strict; ) strict;
create table channels( create table channels(
name text not null, name text not null,
source text not null, source text not null,
unique (name, source) on conflict replace unique (name, source) on conflict replace
foreign key (source) references sources (name) on delete cascade foreign key (source) references sources (name) on delete cascade,
check (name <> '')
) strict; ) strict;
create table password( create table password(
id int not null, id int not null,