Skip to content

Commit

Permalink
Script added for table 'users' (#5722)
Browse files Browse the repository at this point in the history
* Script added for table 'users'

Signed-off-by: root <swale@msystechnologies.com>

* updated down script

Signed-off-by: root <swale@msystechnologies.com>

* updated up script

Signed-off-by: root <swale@msystechnologies.com>

* updated up script

Signed-off-by: root <swale@msystechnologies.com>
  • Loading branch information
sonali523 authored and vinay033 committed Sep 20, 2021
1 parent 9e3ef9f commit df72fbe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- drop column projects in servers table
ALTER TABLE servers DROP COLUMN projects;

-- drop table users
DROP TABLE IF EXISTS users;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- add projects column
ALTER TABLE servers ADD COLUMN projects TEXT[] NOT NULL DEFAULT '{}';

-- create table users
CREATE TABLE IF NOT EXISTS users (
id TEXT PRIMARY KEY,
server_id TEXT NOT NULL references servers(id) ON DELETE RESTRICT,
infra_server_username TEXT NOT NULL DEFAULT '',
credential_id TEXT NOT NULL DEFAULT '',
connector TEXT NOT NULL DEFAULT 'local',
automate_user_id TEXT NOT NULL DEFAULT '',
is_server_admin BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL,
CONSTRAINT infra_server_username_server_id_key
UNIQUE(infra_server_username,server_id)
);
CREATE INDEX IF NOT EXISTS users_automate_user_id_index ON users (automate_user_id);

0 comments on commit df72fbe

Please sign in to comment.