This is an automated email from the ASF dual-hosted git repository.

guangning pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ccf6d9  Fixed DB initialization for Docker (#263)
2ccf6d9 is described below

commit 2ccf6d98a6a38bc1bc5c223d167c20a5b96a64af
Author: Sébastien de Melo <[email protected]>
AuthorDate: Thu Feb 13 02:11:41 2020 +0100

    Fixed DB initialization for Docker (#263)
    
    ### Motivation
    
    The database structure has changed.  I have updated the initialization 
script for Docker accordingly.
    
    ### Modifications
    
    Added new tables with proper types and constraints
---
 docker/init_db.sql | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/docker/init_db.sql b/docker/init_db.sql
index 9f3459b..42314d7 100644
--- a/docker/init_db.sql
+++ b/docker/init_db.sql
@@ -11,7 +11,8 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
-alter user pulsar with password 'pulsar';
+
+ALTER USER pulsar WITH PASSWORD 'pulsar';
 CREATE DATABASE pulsar_manager OWNER pulsar;
 GRANT ALL PRIVILEGES ON DATABASE pulsar_manager to pulsar;
 
@@ -123,4 +124,55 @@ CREATE TABLE IF NOT EXISTS tokens (
   description varchar(128),
   token varchar(1024) NOT NUll,
   UNIQUE (role)
-);
\ No newline at end of file
+);
+
+CREATE TABLE IF NOT EXISTS users (
+  user_id BIGSERIAL PRIMARY KEY,
+  access_token varchar(256),
+  name varchar(256) NOT NULL,
+  description varchar(128),
+  email varchar(256),
+  phone_number varchar(48),
+  location varchar(256),
+  company varchar(256),
+  expire BIGINT,
+  password varchar(256),
+  UNIQUE (name)
+);
+
+CREATE TABLE IF NOT EXISTS roles (
+  role_id BIGSERIAL PRIMARY KEY,
+  role_name varchar(256) NOT NULL,
+  role_source varchar(256) NOT NULL,
+  description varchar(128),
+  resource_id BIGINT NOT NULL,
+  resource_type varchar(48) NOT NULL,
+  resource_name varchar(48) NOT NULL,
+  resource_verbs varchar(256) NOT NULL,
+  flag INT NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS tenants (
+  tenant_id BIGSERIAL PRIMARY KEY,
+  tenant varchar(255) NOT NULL,
+  admin_roles varchar(255),
+  allowed_clusters varchar(255),
+  environment_name varchar(255),
+  UNIQUE(tenant)
+);
+
+CREATE TABLE IF NOT EXISTS namespaces (
+  namespace_id BIGSERIAL PRIMARY KEY,
+  tenant varchar(255) NOT NULL,
+  namespace varchar(255) NOT NULL,
+  UNIQUE(tenant, namespace)
+);
+
+CREATE TABLE IF NOT EXISTS role_binding(
+  role_binding_id BIGSERIAL PRIMARY KEY,
+  name varchar(256) NOT NULL,
+  description varchar(256),
+  role_id BIGINT NOT NULL,
+  user_id BIGINT NOT NULL
+);
+

Reply via email to