changement programme entités et conversion clés primaires à SERIAL pour gérer l'incrémentation depuis python

This commit is contained in:
francois 2020-05-15 00:49:45 -04:00
parent 02f6610d72
commit 73920ec7c8
18 changed files with 820 additions and 1495 deletions

View file

@ -126,7 +126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.7"
}
},
"nbformat": 4,

View file

@ -1,7 +1,7 @@
#!/bin/bash
pg_dump --column-inserts \
--data-only \
--file "backup_20200509" \
--file "backup_20200515" \
--host "$PG_ETATLIBRE_IP" \
--port "5432" \
--username "etatdulibre" \

View file

@ -8,7 +8,18 @@ Created on Sat May 9 09:53:25 2020
from questionary import prompt
import questions_entite as qe
import dataset
entite = prompt(qe.choix_entite)
choix_entite = prompt(qe.choix_entite)
reponses = prompt(qe.questions_entite[choix_entite['type']])
print(entite['entite'])
print("Choix:\n"+str(choix_entite)+"\nRéponse:\n"+str(reponses))
psql_string = 'postgresql://etatdulibre:etatdulibre@172.19.0.2/etatdulibre'
try:
db = dataset.connect(psql_string)
table = db[choix_entite['type']]
table.insert(reponses)
except:
pass

File diff suppressed because it is too large Load diff

View file

@ -1,679 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The sql extension is already loaded. To reload it, use:\n",
" %reload_ext sql\n"
]
}
],
"source": [
"%load_ext sql\n",
"%config SqlMagic.autocommit=False # for engines that do not support autommit\n",
"%sql postgresql://etatdulibre:etatdulibre@172.23.0.2/etatdulibre"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# adresse"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.adresse(\n",
" adresse_id, numero_civique, type_rue, nom_rue, code_postal, ville, date_saisie)\n",
" VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING adresse_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# association"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.association(\n",
"\tassoc_id, logo_id, date_saisie, nom, sigle, type, description, date_fondation, date_fermeture)\n",
"\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING assoc_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# association_adresse"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.association_adresse(\n",
"\tassoc_id, adresse_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# association_coordonnees"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.association_coordonnees(\n",
"\tassoc_id, coord_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# association_personne"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.association_personne(\n",
"\tassoc_id, pers_id, description)\n",
"\tVALUES (?, ?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# coordonnees"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n",
"1 rows affected.\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"INSERT INTO public.coordonnees(\n",
"\tcoord_id, coord_type, coord_contenu)\n",
"\tVALUES (?, ?, ?) RETURNING coord_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# cours"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.cours(\n",
"\tcours_id, numero, nom, description)\n",
"\tVALUES (?, ?, ?, ?) RETURNING cours_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# cours_coordonnees"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.cours_coordonnees(\n",
"\tcours_id, coord_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# cours_etablissement"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.cours_etablissement(\n",
"\tcours_id, etabl_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# cours_personne"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.cours_personne(\n",
"\tcours_id, pers_id, description)\n",
"\tVALUES (?, ?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# etablissement"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.etablissement(\n",
"\tetabl_id, nom)\n",
"\tVALUES (?, ?) RETURNING etabl_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# etablissement_adresse"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.etablissement_adresse(\n",
"\tetabl_id, adresse_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# etablissement_coordonnees"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.etablissement_coordonnees(\n",
"\tetabl_id, coord_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# evenement"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.evenement(\n",
"\tevent_id, nom, date_debut, date_fin, est_recurrent, detail_recurrence, premiere_date, description)\n",
"\tVALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING event_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# evenement_association"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.evenement_association(\n",
"\tevent_id, assoc_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# evenement_coordonnees"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.evenement_coordonnees(\n",
"\tcoord_id, event_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# evenement_etablissement"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.evenement_etablissement(\n",
"\tevent_id, etabl_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# evenement_personne"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.evenement_personne(\n",
"\tevent_id, pers_id, description)\n",
"\tVALUES (?, ?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# licence"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.licence(\n",
"\tlicence_id, nom, sigle)\n",
"\tVALUES (?, ?, ?) RETURNING licence_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# logo"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.logo(\n",
"\tlogo_id, logo_url)\n",
"\tVALUES (?, ?) RETURNING logo_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# personne"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n",
"1 rows affected.\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"INSERT INTO public.personne(\n",
"\tpers_id, nom, prenom)\n",
"\tVALUES (?, ?, ?) RETURNING pers_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# personne_coordonnees"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n",
"1 rows affected.\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"INSERT INTO public.personne_coordonnees(\n",
"\tcoord_id, pers_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# projet"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n",
"1 rows affected.\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"INSERT INTO public.projet(\n",
"\tprojet_id, nom, description)\n",
"\tVALUES (?, ?, ?) RETURNING projet_id;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# projet_association"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.projet_association(\n",
"\tprojet_id, assoc_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# projet_coordonnees"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n",
"1 rows affected.\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"INSERT INTO public.projet_coordonnees(\n",
"\tprojet_id, coord_id)\n",
"\tVALUES (1, 2);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# projet_licence"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"INSERT INTO public.projet_licence(\n",
"\tprojet_id, licence_id)\n",
"\tVALUES (?, ?);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# projet_personne"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://etatdulibre:***@172.22.0.2/etatdulibre\n",
"1 rows affected.\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"INSERT INTO public.projet_personne(\n",
"\tprojet_id, pers_id, description)\n",
"\tVALUES (?, ?, ?);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View file

@ -9,7 +9,7 @@ Created on Sat May 9 23:18:09 2020
choix_entite = [
{
'type': 'list',
'name': 'entite',
'name': 'type',
'message': 'entite',
'choices': [
'adresse',
@ -26,211 +26,204 @@ choix_entite = [
}
]
questions_adresse = [
{
'type': 'input',
'name': 'numero_civique',
'message': 'numero_civique'
},
{
'type': 'list',
'name': 'type_rue',
'message': 'type_rue',
'choices': [
'rue',
'avenue',
'boulevard',
'chemin'
'route'
''
]
},
{
'type': 'input',
'name': 'nom_rue',
'message': 'nom_rue'
},
{
'type': 'input',
'name': 'code_postal',
'message': 'code_postal'
},
{
'type': 'input',
'name': 'ville',
'message': 'ville'
}
]
questions_association = [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'sigle',
'message': 'sigle'
},
{
'type': 'list',
'name': 'type',
'message': 'type',
'choices': [
'groupe d\'utilisateurs',
'groupe de développeurs',
'réseautage et évenementiel',
'atelier ou fablab',
'formation',
'bienfaisance',
'autre'
]
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
},
{
'type': 'input',
'name': 'date_fondation',
'message': 'date_fondation'
},
{
'type': 'input',
'name': 'date_fermeture',
'message': 'date_fermeture'
}
]
questions_coordonnees = [
{
'type': 'list',
'name': 'coord_type',
'message': 'coord_type',
'choices': [
'url',
'courriel',
'telephone',
'fax'
]
},
{
'type': 'input',
'name': 'coord_contenu',
'message': 'coord_contenu'
}
]
questions_cours = [
{
'type': 'input',
'name': 'numero',
'message': 'numero'
},
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
}
]
questions_etablissement = [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
}
]
questions_evenement = [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'date_debut',
'message': 'date_debut'
},
{
'type': 'input',
'name': 'date_fin',
'message': 'date_fin'
},
{
'type': 'list',
'name': 'est_recurrent',
'message': 'est_recurrent',
'choices': ['O', 'N']
},
{
'type': 'input',
'name': 'detail_recurrence',
'message': 'detail_recurrence'
},
{
'type': 'input',
'name': 'premiere_date',
'message': 'premiere_date'
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
}
]
questions_licence = [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'sigle',
'message': 'sigle'
}
]
questions_logo = [
{
'type': 'input',
'name': 'logo_url',
'message': 'logo_url'
}
]
questions_personne = [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'prénom',
'message': 'prénom'
}
]
questions_projet = [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
}
]
questions_entite = {
'adresse': [
{
'type': 'input',
'name': 'numero_civique',
'message': 'numero_civique'
},
{
'type': 'list',
'name': 'type_rue',
'message': 'type_rue',
'choices': [
'rue',
'avenue',
'boulevard',
'chemin'
'route'
''
]
},
{
'type': 'input',
'name': 'nom_rue',
'message': 'nom_rue'
},
{
'type': 'input',
'name': 'code_postal',
'message': 'code_postal'
},
{
'type': 'input',
'name': 'ville',
'message': 'ville'
}
],
'association': [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'sigle',
'message': 'sigle'
},
{
'type': 'list',
'name': 'type',
'message': 'type',
'choices': [
'groupe d\'utilisateurs',
'groupe de développeurs',
'réseautage et évenementiel',
'atelier ou fablab',
'formation',
'bienfaisance',
'autre'
]
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
},
{
'type': 'input',
'name': 'date_fondation',
'message': 'date_fondation'
},
{
'type': 'input',
'name': 'date_fermeture',
'message': 'date_fermeture'
}
],
'coordonnees': [
{
'type': 'list',
'name': 'coord_type',
'message': 'coord_type',
'choices': [
'url',
'courriel',
'telephone',
'fax'
]
},
{
'type': 'input',
'name': 'coord_contenu',
'message': 'coord_contenu'
}
],
'cours': [
{
'type': 'input',
'name': 'numero',
'message': 'numero'
},
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
}
],
'etablissement': [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
}
],
'evenement': [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'date_debut',
'message': 'date_debut'
},
{
'type': 'input',
'name': 'date_fin',
'message': 'date_fin'
},
{
'type': 'list',
'name': 'est_recurrent',
'message': 'est_recurrent',
'choices': ['O', 'N']
},
{
'type': 'input',
'name': 'detail_recurrence',
'message': 'detail_recurrence'
},
{
'type': 'input',
'name': 'premiere_date',
'message': 'premiere_date'
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
}
],
'licence': [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'sigle',
'message': 'sigle'
}
],
'logo': [
{
'type': 'input',
'name': 'logo_url',
'message': 'logo_url'
}
],
'personne': [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'input',
'name': 'prenom',
'message': 'prenom'
}
],
'projet': [
{
'type': 'input',
'name': 'nom',
'message': 'nom'
},
{
'type': 'editor',
'name': 'description',
'message': 'description'
}
]
}

View file

@ -5,7 +5,7 @@
--
CREATE TABLE adresse (
adresse_id integer NOT NULL ,
serial integer NOT NULL ,
numero_civique character varying NOT NULL ,
type_rue character varying NOT NULL ,
nom_rue character varying NOT NULL ,
@ -13,11 +13,11 @@ CREATE TABLE adresse (
ville character varying NOT NULL ,
date_saisie date NOT NULL
);
CREATE SEQUENCE adresse_adresse_id_seq START 1 INCREMENT 1 ;
ALTER TABLE adresse ALTER COLUMN adresse_id SET NOT 0;
ALTER TABLE adresse ALTER COLUMN adresse_id SET DEFAULT nextval('adresse_adresse_id_seq');
CREATE SEQUENCE adresse_serial_seq START 1 INCREMENT 1 ;
ALTER TABLE adresse ALTER COLUMN serial SET NOT NULL;
ALTER TABLE adresse ALTER COLUMN serial SET DEFAULT nextval('adresse_serial_seq');
--
ALTER TABLE adresse ADD CONSTRAINT primaire_adresse_id PRIMARY KEY (adresse_id);
ALTER TABLE adresse ADD CONSTRAINT primaire_adresse_id PRIMARY KEY (serial);
CREATE INDEX adresse_adresse_id_index ON adresse(adresse_id);
CREATE INDEX adresse_serial_index ON adresse(serial);

View file

@ -5,7 +5,7 @@
--
CREATE TABLE association (
assoc_id integer NOT NULL ,
assoc_id serial NOT NULL ,
date_saisie date NOT NULL ,
nom character varying NOT NULL ,
sigle character varying,
@ -15,7 +15,7 @@ CREATE TABLE association (
date_fermeture date
);
CREATE SEQUENCE association_assoc_id_seq START 1 INCREMENT 1 ;
ALTER TABLE association ALTER COLUMN assoc_id SET NOT 0;
ALTER TABLE association ALTER COLUMN assoc_id SET NOT NULL;
ALTER TABLE association ALTER COLUMN assoc_id SET DEFAULT nextval('association_assoc_id_seq');
--

View file

@ -10,7 +10,7 @@ CREATE TABLE association_adresse (
);
--
ALTER TABLE association_adresse ADD CONSTRAINT association_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(adresse_id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE association_adresse ADD CONSTRAINT association_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(serial) ON UPDATE CASCADE ON DELETE CASCADE;
--
ALTER TABLE association_adresse ADD CONSTRAINT nouvelle_contrainte_clé_étrangère FOREIGN KEY (assoc_id) REFERENCES association(assoc_id) ON UPDATE CASCADE ON DELETE CASCADE;

View file

@ -5,12 +5,12 @@
--
CREATE TABLE coordonnees (
coord_id integer NOT NULL ,
coord_id serial NOT NULL ,
coord_type character varying NOT NULL ,
coord_contenu character varying
);
CREATE SEQUENCE coordonnees_coord_id_seq START 1 INCREMENT 1 ;
ALTER TABLE coordonnees ALTER COLUMN coord_id SET NOT 0;
ALTER TABLE coordonnees ALTER COLUMN coord_id SET NOT NULL;
ALTER TABLE coordonnees ALTER COLUMN coord_id SET DEFAULT nextval('coordonnees_coord_id_seq');
--

View file

@ -5,13 +5,13 @@
--
CREATE TABLE cours (
cours_id integer NOT NULL ,
cours_id serial NOT NULL ,
numero character varying,
nom character varying,
description character varying
);
CREATE SEQUENCE cours_cours_id_seq START 1 INCREMENT 1 ;
ALTER TABLE cours ALTER COLUMN cours_id SET NOT 0;
ALTER TABLE cours ALTER COLUMN cours_id SET NOT NULL;
ALTER TABLE cours ALTER COLUMN cours_id SET DEFAULT nextval('cours_cours_id_seq');
--

View file

@ -5,11 +5,11 @@
--
CREATE TABLE etablissement (
etabl_id integer NOT NULL ,
etabl_id serial NOT NULL ,
nom character varying
);
CREATE SEQUENCE etablissement_etabl_id_seq START 1 INCREMENT 1 ;
ALTER TABLE etablissement ALTER COLUMN etabl_id SET NOT 0;
ALTER TABLE etablissement ALTER COLUMN etabl_id SET NOT NULL;
ALTER TABLE etablissement ALTER COLUMN etabl_id SET DEFAULT nextval('etablissement_etabl_id_seq');
--

View file

@ -13,7 +13,7 @@ CREATE TABLE etablissement_adresse (
ALTER TABLE etablissement_adresse ADD CONSTRAINT etablissement_adresse_etablissement FOREIGN KEY (etabl_id) REFERENCES etablissement(etabl_id) ON UPDATE CASCADE ON DELETE CASCADE;
--
ALTER TABLE etablissement_adresse ADD CONSTRAINT etablissement_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(adresse_id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE etablissement_adresse ADD CONSTRAINT etablissement_adresse_adresse FOREIGN KEY (adresse_id) REFERENCES adresse(serial) ON UPDATE CASCADE ON DELETE CASCADE;
CREATE INDEX etablissement_adresse_etabl_id_index ON etablissement_adresse(etabl_id);

View file

@ -15,7 +15,7 @@ CREATE TABLE evenement (
description character varying
);
CREATE SEQUENCE evenement_event_id_seq START 1 INCREMENT 1 ;
ALTER TABLE evenement ALTER COLUMN event_id SET NOT 0;
ALTER TABLE evenement ALTER COLUMN event_id SET NOT NULL;
ALTER TABLE evenement ALTER COLUMN event_id SET DEFAULT nextval('evenement_event_id_seq');
--

View file

@ -5,12 +5,12 @@
--
CREATE TABLE licence (
licence_id integer NOT NULL ,
licence_id serial NOT NULL ,
nom character varying NOT NULL ,
sigle character varying
);
CREATE SEQUENCE licence_licence_id_seq START 1 INCREMENT 1 ;
ALTER TABLE licence ALTER COLUMN licence_id SET NOT 0;
ALTER TABLE licence ALTER COLUMN licence_id SET NOT NULL;
ALTER TABLE licence ALTER COLUMN licence_id SET DEFAULT nextval('licence_licence_id_seq');
--

View file

@ -5,11 +5,11 @@
--
CREATE TABLE logo (
logo_id integer NOT NULL ,
logo_id serial NOT NULL ,
logo_url character varying
);
CREATE SEQUENCE logo_logo_id_seq START 1 INCREMENT 1 ;
ALTER TABLE logo ALTER COLUMN logo_id SET NOT 0;
ALTER TABLE logo ALTER COLUMN logo_id SET NOT NULL;
ALTER TABLE logo ALTER COLUMN logo_id SET DEFAULT nextval('logo_logo_id_seq');
--

View file

@ -5,12 +5,12 @@
--
CREATE TABLE personne (
pers_id integer NOT NULL ,
pers_id serial NOT NULL ,
nom character varying,
prenom character varying
);
CREATE SEQUENCE personne_pers_id_seq START 1 INCREMENT 1 ;
ALTER TABLE personne ALTER COLUMN pers_id SET NOT 0;
ALTER TABLE personne ALTER COLUMN pers_id SET NOT NULL;
ALTER TABLE personne ALTER COLUMN pers_id SET DEFAULT nextval('personne_pers_id_seq');
--

View file

@ -5,12 +5,12 @@
--
CREATE TABLE projet (
projet_id integer NOT NULL ,
projet_id serial NOT NULL ,
nom character varying NOT NULL ,
description character varying
);
CREATE SEQUENCE projet_projet_id_seq START 1 INCREMENT 1 ;
ALTER TABLE projet ALTER COLUMN projet_id SET NOT 0;
ALTER TABLE projet ALTER COLUMN projet_id SET NOT NULL;
ALTER TABLE projet ALTER COLUMN projet_id SET DEFAULT nextval('projet_projet_id_seq');
--