···21212222 user_role {
2323 UUID id PK
2424- VARCHAR(255) name
2424+ TEXT name
2525 TEXT description
2626 }
2727···2929 user_account {
3030 UUID id PK
3131 INTEGER role_id FK
3232- VARCHAR(255) email UK
3333- VARCHAR(255) full_name
3232+ TEXT full_name
3433 TEXT password_hash
3535- VARCHAR(255) registration
3636- VARCHAR(255) phone
3434+ TEXT registration
3535+ TEXT phone
3636+ TEXT email UK
3737 BOOLEAN is_active
3838+ TIMESTAMP created_at
3939+ TIMESTAMP updated_at
3840 }
39414040- brigade {
4242+ brigade {
4143 UUID id PK
4242- varchar(255) name
4444+ TEXT name
4345 TEXT description
4446 BOOLEAN is_active
4547 }
···5254 UUID group_id FK
5355 }
54565555- ocurrence_type |o--o{ ocurrence_type : has_parent
5656- ocurrence_type {
5757+ occurrence_type |o--o{ occurrence_type : subtype_of
5858+ occurrence_type {
5759 UUID id PK
5860 UUID parent_type FK
5959- VARCHAR(255) name UK
6161+ TEXT name UK
6062 TEXT description
6163 TIMESTAMP created_at
6464+ TIMESTAMP updated_at
6265 }
63666464- ocurrence }|--|| user_account : submit
6565- ocurrence }|--|| ocurrence_type : is
6666- ocurrence {
6767+ occurrence }|--|| user_account : submit
6868+ occurrence }|--|| occurrence_type : is
6969+ occurrence {
6770 UUID id PK
6871 UUID applicant_id FK
6972 UUID type_id FK
7073 TEXT description
7171- VARCHAR(255) address
7272- VARCHAR(255) reference_point
7474+ POINT location
7575+ TEXT reference_point
7376 NUMERIC(2) loss_percentage
7477 TIMESTAMP created_at
7578 TIMESTAMP updated_at
+1-4
priv/sql/rebuild_database.sql
···8282 subtype_id UUID REFERENCES occurrence_type (id)
8383 ON UPDATE CASCADE ON DELETE SET NULL DEFAULT NULL,
8484 description TEXT,
8585-8686- -- HACK: There might be a better way to store this
8787- address TEXT NOT NULL,
8888-8585+ location POINT NOT NULL,
8986 reference_point TEXT NOT NULL,
9087 loss_percentage NUMERIC(2),
9188 created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,