From 4ad9a93a62ad9629de45e53270442e2be70049b6 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 26 Feb 2007 22:29:25 +0000 Subject: [PATCH] =?utf8?q?Agregar=20createSQL=20al=20sqlmeta=20de=20las=20?= =?utf8?q?clases=20que=20necesitan=20tablas=20intermedias=20bizarras.=20Ha?= =?utf8?q?y=20clases=20que=20tienen=20relaciones=20ordenadas.=20Esto=20no?= =?utf8?q?=20lo=20permite=20SQLObject=20as=C3=AD=20que=20hay=20que=20manip?= =?utf8?q?ular=20tablas=20a=20m=C3=A1s=20bajo=20nivel,=20lo=20que=20hac?= =?utf8?q?=C3=ADa=20que=20no=20se=20pueda=20usar=20el=20comando=20tg-admin?= =?utf8?q?=20sql=20para=20crear=20tablas=20y=20otras=20tareas=20administra?= =?utf8?q?tivas.=20En=20SQLObject=200.8=20agregan=20un=20atributo=20de=20s?= =?utf8?q?qlmeta=20(createSQL)=20que=20permite=20agregar=20SQL=20arbitrari?= =?utf8?q?o=20al=20crear=20las=20tablas.=20Se=20usa=20esto=20para=20crear?= =?utf8?q?=20las=20tablas=20intermedias=20personalizadas=20que=20van=20por?= =?utf8?q?=20"fuera"=20de=20SQLObeject.=20Resumen:=20Si=20ten=C3=A9s=20SQL?= =?utf8?q?Object=200.8,=20ahora=20pod=C3=A9s=20usar=20tg-admin=20sql=20cre?= =?utf8?q?ate,=20por=20lo=20tanto=20doc/schema/shema.sql=20est=C3=A1=20dep?= =?utf8?q?recated.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sercom/model.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sercom/model.py b/sercom/model.py index c01b63c..4ddab71 100644 --- a/sercom/model.py +++ b/sercom/model.py @@ -268,6 +268,16 @@ class Alumno(Usuario): #{{{ #}}} class Tarea(InheritableSQLObject, ByObject): #{{{ + class sqlmeta: + createSQL = r''' +CREATE TABLE dependencia ( + padre_id INTEGER NOT NULL CONSTRAINT tarea_id_exists + REFERENCES tarea(id), + hijo_id INTEGER NOT NULL CONSTRAINT tarea_id_exists + REFERENCES tarea(id), + orden INT, + PRIMARY KEY (padre_id, hijo_id) +)''' # Clave nombre = UnicodeCol(length=30, alternateID=True) # Campos @@ -323,6 +333,16 @@ class Tarea(InheritableSQLObject, ByObject): #{{{ #}}} class Enunciado(SQLObject, ByObject): #{{{ + class sqlmeta: + createSQL = r''' +CREATE TABLE enunciado_tarea ( + enunciado_id INTEGER NOT NULL CONSTRAINT enunciado_id_exists + REFERENCES enunciado(id), + tarea_id INTEGER NOT NULL CONSTRAINT tarea_id_exists + REFERENCES tarea(id), + orden INT, + PRIMARY KEY (enunciado_id, tarea_id) +)''' # Clave nombre = UnicodeCol(length=60) anio = IntCol(notNone=True) @@ -447,6 +467,16 @@ class Ejercicio(SQLObject, ByObject): #{{{ #}}} class InstanciaDeEntrega(SQLObject, ByObject): #{{{ + class sqlmeta: + createSQL = r''' +CREATE TABLE instancia_tarea ( + instancia_id INTEGER NOT NULL CONSTRAINT instancia_id_exists + REFERENCES instancia_de_entrega(id), + tarea_id INTEGER NOT NULL CONSTRAINT tarea_id_exists + REFERENCES tarea(id), + orden INT, + PRIMARY KEY (instancia_id, tarea_id) +)''' # Clave ejercicio = ForeignKey('Ejercicio', notNone=True) numero = IntCol(notNone=True) -- 2.43.0