Commit c44e3094 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update models and scripts to add the table citations.

parent 2014cad3
......@@ -55,7 +55,7 @@ class Core(object):
"""protect the content of the table.
* Record containing the UNDEF string can not be update or delete.
* Inhibit cascade delte for foreign elements
* Inhibit cascade delete for foreign elements
Args:
table (pyDAL.Table): database table
......@@ -88,6 +88,7 @@ class Core(object):
# main tables
Core.organisation(db, T)
Core.publications(db, T)
Core.citations(db, T)
@staticmethod
def authors_roles(db, T):
......@@ -137,6 +138,25 @@ class Core(object):
table.code.filter_in = CLEAN_SPACES
table.usual.filter_in = CLEAN_SPACES
@staticmethod
def citations(db, T):
"""citations table
Args:
db (pyDAl.DAL): database connection
T (gluon.languages.translator): language translator
Returns:
pyDAL.Table
"""
db.define_table(
"citations",
Field("date", "date", notnull=True),
Field("count", "integer", notnull=True),
Field("id_publications", "reference publications", notnull=True),
migrate="citations.table")
@staticmethod
def collaborations(db, T):
"""collaborations table
......
-- MySQL dump 10.16 Distrib 10.2.22-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: test_publications
-- ------------------------------------------------------
-- Server version 10.2.22-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `citations`
--
DROP TABLE IF EXISTS `citations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `citations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`count` int(11) NOT NULL,
`id_publications` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `id_publications__idx` (`id_publications`),
CONSTRAINT `citations_ibfk_1` FOREIGN KEY (`id_publications`) REFERENCES `publications` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-- Dump completed on 2020-02-17 9:27:20
......@@ -233,6 +233,24 @@ INSERT INTO `categories` VALUES (1,'indéfini','','indéfini'),(2,'ACL','article
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `citations`
--
DROP TABLE IF EXISTS `citations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `citations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`count` int(11) NOT NULL,
`id_publications` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `id_publications__idx` (`id_publications`),
CONSTRAINT `citations_ibfk_1` FOREIGN KEY (`id_publications`) REFERENCES `publications` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `collaborations`
--
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment