text: /* ---------------------------------------------------- */
  /*  Generated by Enterprise Architect Version 13.5 		*/
  /*  Created On : 18-feb.-2021 16:33:35 				*/
  /*  DBMS       : PostgreSQL 						*/
  /* ---------------------------------------------------- */
  
  /* Drop Sequences for Autonumber Columns */
  
  DROP SEQUENCE IF EXISTS alumno_id_alumno_seq
  ;
  
  DROP SEQUENCE IF EXISTS clase_id_clase_seq
  ;
  
  DROP SEQUENCE IF EXISTS docente_id_docente_seq
  ;
  
  DROP SEQUENCE IF EXISTS materia_id_materia_seq
  ;
  
  /* Drop Tables */
  
  DROP TABLE IF EXISTS alumno CASCADE
  ;
  
  DROP TABLE IF EXISTS clase CASCADE
  ;
  
  DROP TABLE IF EXISTS docente CASCADE
  ;
  
  DROP TABLE IF EXISTS materia CASCADE
  ;
  
  /* Create Tables */
  
  CREATE TABLE alumno
  (
  	id_alumno bigint NOT NULL   DEFAULT NEXTVAL(('"alumno_id_alumno_seq"'::text)::regclass),
  	nombre_alumno text NULL,
  	celular integer NULL,
  	correo text NULL,
  	fecha timestamp without time zone NULL,
  	estado boolean NULL
  )
  ;
  
  CREATE TABLE clase
  (
  	id_clase bigint NOT NULL   DEFAULT NEXTVAL(('"clase_id_clase_seq"'::text)::regclass),
  	id_alumno bigint NULL,
  	id_docente bigint NULL,
  	id_materia integer NULL,
  	parcial integer NULL,
  	nota numeric(4,2) NULL,
  	fecha_registro timestamp without time zone NULL,
  	estado boolean NULL
  )
  ;
  
  CREATE TABLE docente
  (
  	id_docente bigint NOT NULL   DEFAULT NEXTVAL(('"docente_id_docente_seq"'::text)::regclass),
  	nombre_docente text NULL,
  	celular integer NULL,
  	fecha timestamp without time zone NULL,
  	estado boolean NULL
  )
  ;
  
  CREATE TABLE materia
  (
  	id_materia integer NOT NULL   DEFAULT NEXTVAL(('"materia_id_materia_seq"'::text)::regclass),
  	nombre_materia text NULL,
  	fecha timestamp without time zone NULL,
  	estado boolean NULL
  )
  ;
  
  /* Create Primary Keys, Indexes, Uniques, Checks */
  
  ALTER TABLE alumno ADD CONSTRAINT PK_alumno
  	PRIMARY KEY (id_alumno)
  ;
  
  ALTER TABLE clase ADD CONSTRAINT PK_clase
  	PRIMARY KEY (id_clase)
  ;
  
  CREATE INDEX IXFK_clase_alumno ON clase (id_alumno ASC)
  ;
  
  CREATE INDEX IXFK_clase_docente ON clase (id_docente ASC)
  ;
  
  CREATE INDEX IXFK_clase_materia ON clase (id_materia ASC)
  ;
  
  ALTER TABLE docente ADD CONSTRAINT PK_docente
  	PRIMARY KEY (id_docente)
  ;
  
  ALTER TABLE materia ADD CONSTRAINT PK_materia
  	PRIMARY KEY (id_materia)
  ;
  
  /* Create Foreign Key Constraints */
  
  ALTER TABLE clase ADD CONSTRAINT FK_clase_alumno
  	FOREIGN KEY (id_alumno) REFERENCES alumno (id_alumno) ON DELETE No Action ON UPDATE No Action
  ;
  
  ALTER TABLE clase ADD CONSTRAINT FK_clase_docente
  	FOREIGN KEY (id_docente) REFERENCES docente (id_docente) ON DELETE No Action ON UPDATE No Action
  ;
  
  ALTER TABLE clase ADD CONSTRAINT FK_clase_materia
  	FOREIGN KEY (id_materia) REFERENCES materia (id_materia) ON DELETE No Action ON UPDATE No Action
  ;
  
  /* Create Table Comments, Sequences for Autonumber Columns */
  
  CREATE SEQUENCE alumno_id_alumno_seq INCREMENT 1 START 1
  ;
  
  CREATE SEQUENCE clase_id_clase_seq INCREMENT 1 START 1
  ;
  
  CREATE SEQUENCE docente_id_docente_seq INCREMENT 1 START 1
  ;
  
  CREATE SEQUENCE materia_id_materia_seq INCREMENT 1 START 1
  ;
  