From fadd83e37dc7a2baaf8d5851e1d0813f6ac307d7 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Fri, 28 Nov 2014 17:12:06 +0000
Subject: [PATCH] #396 fix - Changed DB init script to allow only localhost user access and changed DB scheme to make it compatible with MySQL 5.1
---
securis/src/main/resources/db/create_db.sql | 2 --
securis/src/main/resources/db/schema.sql | 30 +++++++++++++++---------------
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/securis/src/main/resources/db/create_db.sql b/securis/src/main/resources/db/create_db.sql
index 5f45075..00aa749 100644
--- a/securis/src/main/resources/db/create_db.sql
+++ b/securis/src/main/resources/db/create_db.sql
@@ -1,7 +1,5 @@
create database securis CHARACTER SET utf8 COLLATE utf8_bin;
-create user securis identified by 'securis';
create user securis@localhost identified by 'securis';
-grant all on securis.* to securis;
grant all on securis.* to securis@localhost;
#Update passwords
flush privileges;
\ No newline at end of file
diff --git a/securis/src/main/resources/db/schema.sql b/securis/src/main/resources/db/schema.sql
index 7c5c6a3..23d01ca 100644
--- a/securis/src/main/resources/db/schema.sql
+++ b/securis/src/main/resources/db/schema.sql
@@ -3,7 +3,7 @@
CREATE TABLE IF NOT EXISTS settings (
`key` VARCHAR(100) NOT NULL ,
value VARCHAR(2000) NULL ,
- modification_timestamp DATETIME NOT NULL default now(),
+ modification_timestamp TIMESTAMP NOT NULL default now(),
PRIMARY KEY (``key``) );
drop table IF EXISTS user;
@@ -13,11 +13,11 @@
roles INT NOT NULL default 0,
first_name VARCHAR(100) NULL ,
last_name VARCHAR(100) NULL ,
- last_login DATETIME NULL ,
+ last_login TIMESTAMP NULL ,
lang VARCHAR(10) NULL ,
email VARCHAR(150) NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
- modification_timestamp DATETIME NULL ,
+ creation_timestamp TIMESTAMP NOT NULL default now(),
+ modification_timestamp TIMESTAMP NULL ,
PRIMARY KEY (username));
drop table IF EXISTS application;
@@ -26,7 +26,7 @@
name VARCHAR(45) NOT NULL ,
license_filename VARCHAR(100) NOT NULL ,
description VARCHAR(500) NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
+ creation_timestamp TIMESTAMP NOT NULL default now(),
PRIMARY KEY (id));
drop table IF EXISTS application_metadata;
@@ -35,7 +35,7 @@
`key` VARCHAR(100) NOT NULL ,
value VARCHAR(200) NULL ,
mandatory BOOLEAN NOT NULL default true,
- creation_timestamp DATETIME NULL default now(),
+ creation_timestamp TIMESTAMP NULL default now(),
PRIMARY KEY (application_id, `key`));
@@ -46,7 +46,7 @@
name VARCHAR(45) NOT NULL ,
description VARCHAR(100) NULL ,
application_id INT NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
+ creation_timestamp TIMESTAMP NOT NULL default now(),
PRIMARY KEY (id));
drop table IF EXISTS licensetype_metadata;
@@ -64,7 +64,7 @@
name VARCHAR(45) NOT NULL ,
description VARCHAR(100) NULL ,
org_parent_id INT NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
+ creation_timestamp TIMESTAMP NOT NULL default now(),
PRIMARY KEY (id));
drop table IF EXISTS user_organization;
@@ -87,7 +87,7 @@
license_preactivation BOOLEAN NOT NULL DEFAULT true,
default_valid_period INT NOT NULL DEFAULT 60,
created_by varchar(45) NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
+ creation_timestamp TIMESTAMP NOT NULL default now(),
PRIMARY KEY (id));
drop table IF EXISTS pack_metadata;
@@ -111,10 +111,10 @@
full_name VARCHAR(150) NULL,
email VARCHAR(100) NOT NULL,
comments VARCHAR(1024) NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
- modification_timestamp DATETIME NULL ,
- last_access_timestamp DATETIME NULL ,
- expiration_date DATETIME NULL ,
+ creation_timestamp TIMESTAMP NOT NULL default now(),
+ modification_timestamp TIMESTAMP NULL ,
+ last_access_timestamp TIMESTAMP NULL ,
+ expiration_date TIMESTAMP NULL ,
cancelled_by varchar(45) NULL ,
created_by varchar(45) NULL ,
status VARCHAR(2) NOT NULL default 'CR',
@@ -126,7 +126,7 @@
id INT NOT NULL auto_increment,
license_id INT NOT NULL,
username VARCHAR(45) NOT NULL,
- creation_timestamp DATETIME NOT NULL default now(),
+ creation_timestamp TIMESTAMP NOT NULL default now(),
action VARCHAR(40) ,
comments VARCHAR(512) ,
PRIMARY KEY (id));
@@ -137,6 +137,6 @@
hash VARCHAR(64) NOT NULL ,
request_data VARCHAR(1024) NULL ,
blocked_by varchar(45) NULL ,
- creation_timestamp DATETIME NOT NULL default now(),
+ creation_timestamp TIMESTAMP NOT NULL default now(),
PRIMARY KEY (hash));
\ No newline at end of file
--
Gitblit v1.3.2