Skip to content

Commit

Permalink
Add a "quick start" chapter in the documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
beaud76 committed Dec 23, 2017
1 parent 8130b60 commit de7990b
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Welcome to the E-Maj's documentation!
:maxdepth: 1
:caption: How to install E-Maj:

quickStart
install
setup
upgrade
Expand Down
81 changes: 81 additions & 0 deletions docs/en/quickStart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Quick start
===========

The E-Maj installation is described in detail later. But the few following commands allow to quicky install and use E-Maj under Linux.

Software install
^^^^^^^^^^^^^^^^

To download and install E-Maj, log on your postgres (or another) account and type::

pgxn download E-Maj

unzip e-maj-<version>.zip

cd e-maj-<version>/

sudo make install

For more details, or in case of problem, look at :doc:`there <install>`.

Extension install
^^^^^^^^^^^^^^^^^

To install the emaj extension into a database, log on the target database, using a super-user role and execute::

create extension dblink;

create extension btree_gist;

create extension emaj;

grant emaj_adm to <role>;

With the latest statement, you give E-Maj administration grants to a particular role. Then, this role can be used to execute all E-Maj operations, avoiding the use of superuser role.

Extension use
^^^^^^^^^^^^^

You can now log on the database with the role having the E-Maj administration rights.

As a first step, the *emaj_group_def* table that defines groups must be populated with one row per table or sequence to link to the group. A table can be added with a statement like::

INSERT INTO emaj.emaj_group_def (grpdef_group, grpdef_schema, grpdef_tblseq)
VALUES ('my_group', 'my_schema', 'my_table');

or select all tables of a schema with::

INSERT INTO emaj.emaj_group_def (grpdef_group, grpdef_schema, grpdef_tblseq)
SELECT 'my_group', 'my_schema', table_name
FROM information_schema.tables
WHERE table_schema = 'my_schema' AND table_type = 'BASE TABLE';

knowning that tables inserted into a group must have a primary key.

Then the typical sequence::

SELECT emaj.emaj_create_group('my_groupy');

SELECT emaj.emaj_start_group('my_group', 'Mark-1');

[INSERT/UPDATE/DELETE on tables]

SELECT emaj.emaj_set_mark_group('my_group','Mark-2');

[INSERT/UPDATE/DELETE on tables]

SELECT emaj.emaj_set_mark_group('my_group','Mark-3');

[INSERT/UPDATE/DELETE on tables]

SELECT emaj.emaj_rollback_group('my_group','Mark-2');

SELECT emaj.emaj_stop_group('my_group');

SELECT emaj.emaj_drop_group('my_group');

would create and start the tables group, log updates and set several intermediate marks, go back to one of them, stop the recording and finally drop the group.

For more details, main functions are described :doc:`here <mainFunctions>`.

Additionally, a web client can also be installed, either :doc:`a plugin for pgpPhAdmin <ppaPluginInstall>` or :doc:`Emaj_web <webInstall>`.
1 change: 1 addition & 0 deletions docs/fr/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Bienvenue dans la documentation E-Maj !
:maxdepth: 1
:caption: Comment installer E-Maj :

quickStart
install
setup
upgrade
Expand Down
81 changes: 81 additions & 0 deletions docs/fr/quickStart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Démarrage rapide
================

L’installation d’E-Maj est présentée plus loin en détail. Mais les quelques commandes suivantes permettent de procéder rapidement à une installation et une utilisation sous Linux.

Installation du logiciel
^^^^^^^^^^^^^^^^^^^^^^^^

Pour télécharger et installer le logiciel E-Maj, connectez-vous à votre compte postgres (ou un autre) et tapez ::

pgxn download E-Maj

unzip e-maj-<version>.zip

cd e-maj-<version>/

sudo make install

Pour plus de détails, ou en cas de problème, allez :doc:`ici <install>`.

Installation de l’extension
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Pour installer l’extension emaj dans une base de données, connectez-vous à la base de données cible, en utilisant un rôle super-utilisateur et passez les commandes ::

create extension dblink;

create extension btree_gist;

create extension emaj;

grant emaj_adm to <role>;

La dernière requête permet de donner les droits d’administration E-Maj à un rôle particulier, Par la suite, vous pourrez utiliser ce rôle pour exécuter les opérations E-Maj sans être connecté comme super-utilisateur.

Utilisation de l’extension
^^^^^^^^^^^^^^^^^^^^^^^^^^

Vous pouvez maintenant vous connecter à la base de données avec le rôle qui possède les droits d’administration E-Maj.

Il faut tout d'abord garnir la table *emaj_group_def* de définition des groupes avec une ligne par table ou séquence à associer à un groupe. On peut ajouter une table avec une requête du type ::

INSERT INTO emaj.emaj_group_def (grpdef_group, grpdef_schema, grpdef_tblseq)
VALUES ('mon_groupe', 'mon_schema', 'ma_table');

ou sélectionner toutes les tables d’un schéma avec ::

INSERT INTO emaj.emaj_group_def (grpdef_group, grpdef_schema, grpdef_tblseq)
SELECT 'mon_groupe', 'mon_schema', table_name
FROM information_schema.tables
WHERE table_schema = 'mon_schema' AND table_type = 'BASE TABLE';

sachant que les tables insérées dans un groupe de tables doivent avoir une clé primaire.

Ensuite, la séquence typique ::

SELECT emaj.emaj_create_group('mon_groupe');

SELECT emaj.emaj_start_group('mon_groupe', 'Mark-1');

[INSERT/UPDATE/DELETE sur les tables du groupe]

SELECT emaj.emaj_set_mark_group('mon_groupe','Mark-2');

[INSERT/UPDATE/DELETE sur les tables du groupe]

SELECT emaj.emaj_set_mark_group('mon_groupe','Mark-3');

[INSERT/UPDATE/DELETE sur les tables du groupe]

SELECT emaj.emaj_rollback_group('mon_groupe','Mark-2');

SELECT emaj.emaj_stop_group('mon_groupe');

SELECT emaj.emaj_drop_group('mon_groupe');

permet de créer puis « démarrer » le groupe de tables, d'enregistrer les mises à jour en posant des marques intermédiaires, de revenir à l'une d'elles, d’arrêter l’enregistrement et enfin de supprimer le groupe.

Pour plus de précisions, les principales fonctions sont décrites :doc:`ici <mainFunctions>`.

En complément, un client web peut être installé, soit :doc:`un plugin pour pgpPhAdmin <ppaPluginInstall>` soit :doc:`Emaj_web <webInstall>`.

0 comments on commit de7990b

Please sign in to comment.