Untitled

 avatar
unknown
pgsql
a year ago
1.3 kB
5
Indexable
CREATE TABLE user (
    id BIGINT NOT NULL PRIMARY KEY,
    fio TEXT NOT NULL,
    type TEXT NOT NULL,
    login TEXT NOT NULL,
    password TEXT NOT NULL
);

CREATE TABLE project (
    id BIGINT not NULL PRIMARY KEY,
    owner_id BIGINT not NULL REFERENCES user (id),
    name text not NULL
);

CREATE TABLE status (
    id BIGINT NOT NULL PRIMARY KEY,
    name TEXT NOT NULL,
    description TEXT NOT NULL
);

CREATE TABLE document (
    id BIGINT NOT NULL PRIMARY KEY,
    status_id BIGINT not NULL REFERENCES status (id),
    project_id BIGINT not NULL REFERENCES project (id),
    name TEXT NOT NULL,
    standart TEXT not NULL,
    created_at timestamptz not NULL,
    updated_at timestamptz not NULL,
    stored_at timestamptz not NULL
);

CREATE TABLE access_right (
    id BIGINT NOT NULL PRIMARY KEY,
    user_id BIGINT NOT NULL REFERENCES user (id),
    doc_id BIGINT NOT NULL REFERENCES document (id),
    description text not NULL,
    role text not NULL
);

CREATE TABLE messsage (
    id BIGINT NOT NULL PRIMARY KEY,
    receiver_id BIGINT NOT NULL REFERENCES user (id),
    sender_id BIGINT NOT NULL REFERENCES user (id),
    doc_id BIGINT NOT NULL REFERENCES document (id),
    sending_date timestamptz not NULL,
    theme TEXT NOT NULL,
    message_text TEXT NOT NULL
);
Editor is loading...
Leave a Comment