12 lines
502 B
SQL
12 lines
502 B
SQL
ALTER TABLE devices ADD COLUMN name_custom boolean NOT NULL DEFAULT false;
|
|
|
|
CREATE TABLE login_history (
|
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
device_id uuid NOT NULL REFERENCES devices(id) ON DELETE CASCADE,
|
|
device_name text NOT NULL,
|
|
platform text NOT NULL CHECK (platform IN ('web','windows')),
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX login_history_user ON login_history(user_id,id DESC);
|