Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script added for table 'users' #5722

Merged
merged 4 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);