Ready to implement photos management

This commit is contained in:
2023-08-05 19:15:52 +02:00
parent 4cd7519890
commit 02da973dd8
11 changed files with 195 additions and 20 deletions

View File

@ -2,6 +2,7 @@
DROP view if EXISTS families_memberships ;
DROP table IF EXISTS couples;
DROP table IF EXISTS members;
DROP table IF EXISTS photos;
DROP table IF EXISTS memberships ;
DROP table IF EXISTS families;
DROP table IF EXISTS users;

View File

@ -30,13 +30,22 @@ CREATE TABLE memberships (
PRIMARY KEY(user_id, family_id)
);
CREATE TABLE photos (
id SERIAL PRIMARY KEY,
time_create VARCHAR(130) NOT NULL,
mime_type VARCHAR(150) NOT NULL,
sha512 VARCHAR(130) NOT NULL,
file_size INTEGER NOT NULL,
thumb_sha512 VARCHAR(130) NOT NULL
);
CREATE TABLE members (
id SERIAL PRIMARY KEY,
family_id integer NOT NULL REFERENCES families,
first_name VARCHAR(30) NULL,
last_name VARCHAR(30) NULL,
birth_last_name VARCHAR(30) NULL,
photo_id VARCHAR(255) NULL,
photo_id INTEGER NULL REFERENCES photos ON DELETE SET NULL,
email VARCHAR(255) NULL,
phone VARCHAR(30) NULL,
address VARCHAR (155) NULL,
@ -60,7 +69,7 @@ CREATE TABLE members (
CREATE TABLE couples (
wife integer NOT NULL REFERENCES members,
husband integer NOT NULL REFERENCES members,
photo_id VARCHAR(255) NULL,
photo_id INTEGER NULL REFERENCES photos ON DELETE SET NULL,
wedding_year smallint NULL,
wedding_month smallint NULL,
wedding_day smallint NULL,