Created
May 10, 2014 13:41
-
-
Save tonussi/68bedb8e48cdbc932b24 to your computer and use it in GitHub Desktop.
agenda.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP SCHEMA public CASCADE; | |
CREATE SCHEMA public; | |
GRANT ALL ON SCHEMA public TO postgres; | |
COMMENT ON SCHEMA public IS 'standard public schema'; | |
create table secretaria | |
( | |
nome character varying(32), | |
id integer, | |
constraint secretaria_pk primary key (id) | |
); | |
create table cliente | |
( | |
id integer, | |
nome character varying(32), | |
constraint cliente_pk primary key (id) | |
); | |
create table agendamento | |
( | |
id integer, | |
horario_agendado timestamp with time zone, | |
constraint agendamento_pk primary key (horario_agendado) | |
); | |
create table grade | |
( | |
id integer, | |
constraint grade_pk primary key (id) | |
); | |
create table assistente_social | |
( | |
id integer, | |
nome character varying, | |
proficiencia text, | |
situacao boolean, | |
constraint assistente_social_pk primary key (id) | |
); | |
create table horarios | |
( | |
id integer not null, | |
horarios timestamp with time zone, | |
constraint horarios_pk primary key (horarios) | |
); | |
alter table cliente add constraint cliente_fk1 foreign key (id) references agendamento(id); | |
alter table grade add constraint grade_fk1 foreign key (id) references assistente_social(id); | |
alter table assistente_social add constraint assistente_social_fk1 foreign key (id) references agendamento(id); | |
alter table horarios add constraint horarios_fk1 foreign key (id) references assistente_social(id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment