Block la création de shema sans table

This commit is contained in:
2025-01-22 07:39:57 +01:00
parent 7c46818923
commit 3301c1395d
3 changed files with 11 additions and 8 deletions
+6 -3
View File
@@ -7,7 +7,7 @@ from builtins import str
from builtins import object
import qgis
from qgis.PyQt.QtCore import QSettings
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog,QMessageBox
from qgis.PyQt.QtGui import QIcon
from PyQt5.QtCore import *
from PyQt5.QtGui import *
@@ -83,8 +83,11 @@ class Postgis_Creator(QDialog, EDITOR_CLASS):
SQL_schema = "CREATE SCHEMA " + schema + ";"
SQL_GRANT_SCHEMA="GRANT CREATE, USAGE ON SCHEMA "+schema+" TO grp_qgis; GRANT CREATE, USAGE ON SCHEMA "+schema+" TO grp_sig;"
cur.execute(SQL_schema)
cur.execute(SQL_GRANT_SCHEMA)
if self.couche_contour.isChecked() or self.couche_habitat.isChecked() or self.couche_travaux_prevus.isChecked() or self.couche_vierge.isChecked():
cur.execute(SQL_schema)
cur.execute(SQL_GRANT_SCHEMA)
else:
iface.messageBar().pushMessage("POSTGRESQL :", "Pas de couche sélectionnée, création refusée.", level=Qgis.Warning, duration=30)
### Creation de la table contour
if self.couche_contour.isChecked(): # Verifie si la checkbox est cochee