2022-01-29 11:56:10 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import logging
|
|
|
|
import psycopg2
|
|
|
|
|
2022-02-03 16:36:16 +01:00
|
|
|
from procrusql import HaveTable, HaveColumn, HaveData, Ref, fit, dump_dot
|
2022-01-29 11:56:10 +01:00
|
|
|
|
|
|
|
logging.basicConfig(format="%(asctime)s %(levelname)s %(name)s %(lineno)d | %(message)s", level=logging.DEBUG)
|
|
|
|
|
|
|
|
want = [
|
|
|
|
HaveTable("table_service", depends=[],
|
|
|
|
table="service"
|
|
|
|
),
|
|
|
|
HaveColumn("column_service_id", depends=["table_service"],
|
|
|
|
table="service",
|
|
|
|
column="id",
|
|
|
|
definition="serial primary key",
|
|
|
|
),
|
|
|
|
HaveColumn("column_service_type", depends=["table_service"],
|
|
|
|
table="service",
|
|
|
|
column="type",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
HaveColumn("column_service_feature", depends=["table_service"],
|
|
|
|
table="service",
|
|
|
|
column="feature",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
HaveColumn("column_service_description", depends=["table_service"],
|
|
|
|
table="service",
|
|
|
|
column="description",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
HaveColumn("column_service_hidden", depends=["table_service"],
|
|
|
|
table="service",
|
|
|
|
column="hidden",
|
|
|
|
definition="boolean",
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveData("data_login_unix", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "login", "feature": "unix"},
|
|
|
|
extra={"description": "Can login on Unix systems", "hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_login_wds", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "login", "feature": "wds"},
|
|
|
|
extra={"description": "Can login into WDS", "hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_login_wwa", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "login", "feature": "wwa"},
|
|
|
|
extra={"description": "Can login into WWA", "hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_group_wifo", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "group", "feature": "wifo"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_group_wifo_intern", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "group", "feature": "wifo-intern"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_group_wsr", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "group", "feature": "wsr"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_mailinglist2_wifo_aktuell", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "mailinglist2", "feature": "wifo-aktuell"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_org_wifo", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "org", "feature": "WIFO"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_org_wsr", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "org", "feature": "WSR"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_wifo_intern", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "publ", "feature": "wifo_intern"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_wifo_temporary", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "publ", "feature": "wifo_temporary"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_administrative_staff_member", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "administrative_staff_member"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_Xassociate", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "Xassociate"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_economist", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "economist"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_emeritus_consultant", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "emeritus_consultant"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_research_assistant", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "research_assistant"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_scientific_administration_staff_member", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature":
|
|
|
|
"scientific_administration_staff_member"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_scientific_administrative_assistant", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "scientific_administrative_assistant"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_scientific_consultant", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "scientific_consultant"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
HaveData("data_publ_rolle_senior_economist", depends=["column_service_id", "column_service_type", "column_service_feature", "column_service_description", "column_service_hidden"],
|
|
|
|
table="service",
|
|
|
|
key={"type": "rolle", "feature": "senior_economist"},
|
|
|
|
extra={"hidden": False},
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveData("data_template_std", depends=["column_template_name", "column_template_sortorder"],
|
|
|
|
table="template",
|
|
|
|
key={"name": "Standard Vorlage"},
|
|
|
|
extra={"sortorder": 1},
|
|
|
|
),
|
|
|
|
HaveData("data_template_wifo_wa", depends=["column_template_name", "column_template_sortorder", "column_template_email_pattern", "column_template_email_after", "column_template_funktion", "column_template_status"],
|
|
|
|
table="template",
|
|
|
|
key={"name": "WIFO Wissenschaftliche Assistenz"},
|
|
|
|
extra={"sortorder": 10, "email_pattern": "vorname#.#nachname", "email_after": "wifo.ac.at", "funktion": "FB (1-5)", "status": "FU, FM"},
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveColumn("column_template_name", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="name",
|
|
|
|
definition="text not null unique",
|
|
|
|
),
|
|
|
|
HaveTable("table_template", depends=[],
|
|
|
|
table="template"
|
|
|
|
),
|
|
|
|
HaveColumn("column_template_sortorder", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="sortorder",
|
|
|
|
definition="int",
|
|
|
|
),
|
|
|
|
HaveColumn("column_template_email_pattern", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="email_pattern",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
HaveColumn("column_template_email_after", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="email_after",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
HaveColumn("column_template_funktion", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="funktion",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
HaveColumn("column_template_status", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="status",
|
|
|
|
definition="text",
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveData("data_template_std_login_wwa", depends=["data_template_std", "data_login_wwa", "column_service_id", "column_template_id", "column_template_service_template", "column_template_service_service"],
|
|
|
|
table="template_service",
|
|
|
|
key={"template": Ref("data_template_std", 0, "id"), "service": Ref("data_login_wwa", 0, "id")},
|
|
|
|
extra={}
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveColumn("column_template_id", depends=["table_template"],
|
|
|
|
table="template",
|
|
|
|
column="id",
|
|
|
|
definition="serial primary key",
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveColumn("column_template_service_template", depends=["table_template_service"],
|
|
|
|
table="template_service",
|
|
|
|
column="template",
|
|
|
|
definition="int references template",
|
|
|
|
),
|
|
|
|
|
|
|
|
HaveTable("table_template_service", depends=[],
|
|
|
|
table="template_service",
|
|
|
|
),
|
|
|
|
HaveColumn("column_template_service_service", depends=["table_template_service"],
|
|
|
|
table="template_service",
|
|
|
|
column="service",
|
|
|
|
definition="int references service",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
db = psycopg2.connect(dbname="procrusql_test")
|
|
|
|
fit(db, want)
|
2022-02-03 16:36:16 +01:00
|
|
|
dump_dot()
|
2022-01-29 11:56:10 +01:00
|
|
|
|
|
|
|
# vim: tw=0
|