Skip to content
Snippets Groups Projects
Select Git revision
  • f7a9078691a2f08a6721021b4819ddae506a5180
  • master default protected
2 results

schema.sql

Blame
  • user avatar
    Tamas Bunth authored
    f7a90786
    History
    schema.sql 1.08 KiB
    drop table if exists "user" cascade;
    drop table if exists mobil_data cascade;
    drop table if exists process cascade;
    
    drop sequence if exists hibernate_sequence;
    create sequence hibernate_sequence start 1 increment 1;
    
    create table "user" (
      id int8 not null,
      email varchar(255),
      password varchar(255),
      token varchar(255),
      android_version INTEGER,
      birth_date TIMESTAMP,
      device_type VARCHAR(255),
      primary key (id)
    );
    
    create table process (
      id int8 not null,
      user_id int8 not null,
      process VARCHAR(255)
    );
    
    create table mobil_data (
      id int8 not null,
      user_id int8 not null,
      location_lat DOUBLE PRECISION,
      location_long DOUBLE PRECISION,
      battery INTEGER,
      brightness INTEGER,
      wifi_on BOOLEAN,
      mobil_data_on BOOLEAN,
      bluetooth_on BOOLEAN,
      nfc_on BOOLEAN,
      sleep_time INTEGER,
      battery_temp DOUBLE PRECISION,
      mobile_data_usage INTEGER,
      wifi_data_usage INTEGER,
      actual_time TIMESTAMP not null,
      is_charging BOOLEAN
    );
    
    alter table mobil_data
        add CONSTRAINT user_id_foreign_key
        FOREIGN KEY ("user_id")
        REFERENCES "user"
    
    -- TODO process foreign key