cleaner foreign keys

This commit is contained in:
Jack Robison 2018-02-12 15:10:06 -05:00
parent b7d0191e5d
commit 9e11c075c6
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -118,21 +118,18 @@ class SQLiteStorage(object):
create table if not exists stream ( create table if not exists stream (
stream_hash char(96) not null primary key, stream_hash char(96) not null primary key,
sd_hash char(96) not null, sd_hash char(96) not null references blob,
stream_key text not null, stream_key text not null,
stream_name text not null, stream_name text not null,
suggested_filename text not null, suggested_filename text not null
foreign key(sd_hash) references blob(blob_hash)
); );
create table if not exists stream_blob ( create table if not exists stream_blob (
stream_hash char(96) not null, stream_hash char(96) not null references stream,
blob_hash char(96), blob_hash char(96) references blob,
position integer not null, position integer not null,
iv char(32) not null, iv char(32) not null,
primary key (stream_hash, blob_hash), primary key (stream_hash, blob_hash)
foreign key(stream_hash) references stream(stream_hash),
foreign key (blob_hash) references blob(blob_hash)
); );
create table if not exists claim ( create table if not exists claim (
@ -148,20 +145,17 @@ class SQLiteStorage(object):
); );
create table if not exists file ( create table if not exists file (
stream_hash text primary key not null, stream_hash text primary key not null references stream,
file_name text not null, file_name text not null,
download_directory text not null, download_directory text not null,
blob_data_rate real not null, blob_data_rate real not null,
status text not null, status text not null
foreign key(stream_hash) references stream(stream_hash)
); );
create table if not exists content_claim ( create table if not exists content_claim (
stream_hash text unique not null, stream_hash text unique not null references file,
claim_outpoint text not null, claim_outpoint text not null references claim,
primary key (stream_hash, claim_outpoint), primary key (stream_hash, claim_outpoint)
foreign key (claim_outpoint) references claim(claim_outpoint),
foreign key(stream_hash) references file(stream_hash)
); );
create table if not exists support ( create table if not exists support (