Skip to content

Instantly share code, notes, and snippets.

@tonussi
Created May 10, 2014 13:41
Show Gist options
  • Save tonussi/68bedb8e48cdbc932b24 to your computer and use it in GitHub Desktop.
Save tonussi/68bedb8e48cdbc932b24 to your computer and use it in GitHub Desktop.
agenda.sql
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