Skip to content

Commit

Permalink
Added SQL Entries
Browse files Browse the repository at this point in the history
  • Loading branch information
loicortola committed Jan 9, 2015
1 parent 98c5c5d commit f3981ca
Show file tree
Hide file tree
Showing 3 changed files with 650 additions and 0 deletions.
24 changes: 24 additions & 0 deletions config/db/1-SCHEMA.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
drop schema if exists `computer-database-db`;
create schema if not exists `computer-database-db`;
use `computer-database-db`;

drop table if exists computer;
drop table if exists company;

create table company (
id bigint not null auto_increment,
name varchar(255),
constraint pk_company primary key (id))
;

create table computer (
id bigint not null auto_increment,
name varchar(255),
introduced timestamp NULL,
discontinued timestamp NULL,
company_id bigint default NULL,
constraint pk_computer primary key (id))
;

alter table computer add constraint fk_computer_company_1 foreign key (company_id) references company (id) on delete restrict on update restrict;
create index ix_computer_company_1 on computer (company_id);
9 changes: 9 additions & 0 deletions config/db/2-PRIVILEGES.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#-----------------------------------
#USER RIGHTS MANAGEMENT
#-----------------------------------
CREATE USER 'admincdb'@'localhost' IDENTIFIED BY 'qwerty1234';

GRANT ALL PRIVILEGES ON `computer-database-db`.* TO 'admincdb'@'localhost' WITH GRANT OPTION;


FLUSH PRIVILEGES;
Loading

0 comments on commit f3981ca

Please sign in to comment.