def createUsers(db):
    cu = db.cursor()
    commit = False

    if "Users" not in db.tables:
        cu.execute("""
        CREATE TABLE Users (
            userId          %(PRIMARYKEY)s,
            userName        VARCHAR(254) NOT NULL,
            salt            %(STRING)s,
            password        %(STRING)s,
            changed         NUMERIC(14,0) NOT NULL DEFAULT 0
        ) %(TABLEOPTS)s""" % db.keywords)
        db.tables["Users"] = []
        commit = True
    db.createIndex("Users", "UsersUser_uq", "userName", unique = True)
    if createTrigger(db, "Users"):
        commit = True

    if "UserGroups" not in db.tables:
        cu.execute("""
        CREATE TABLE UserGroups (
            userGroupId     %(PRIMARYKEY)s,
            userGroup       VARCHAR(254) NOT NULL,
            canMirror       INTEGER NOT NULL DEFAULT 0,
            admin           INTEGER NOT NULL DEFAULT 0,
            accept_flags    %(STRING)s,
            filter_flags    %(STRING)s,
            changed         NUMERIC(14,0) NOT NULL DEFAULT 0
        ) %(TABLEOPTS)s""" % db.keywords)
        db.tables["UserGroups"] = []
        commit = True
    db.createIndex("UserGroups", "UserGroupsUserGroup_uq", "userGroup",
                   unique = True)
    if createTrigger(db, "UserGroups"):
        commit = True

    if "UserGroupMembers" not in db.tables:
        cu.execute("""
        CREATE TABLE UserGroupMembers (
            userGroupId     INTEGER NOT NULL,
            userId          INTEGER NOT NULL,
            CONSTRAINT UserGroupMembers_userGroupId_fk
                FOREIGN KEY (userGroupId) REFERENCES UserGroups(userGroupId)
                ON DELETE RESTRICT ON UPDATE CASCADE,
            CONSTRAINT UserGroupMembers_userId_fk
                FOREIGN KEY (userId) REFERENCES Users(userId)
                ON DELETE CASCADE ON UPDATE CASCADE
        ) %(TABLEOPTS)s""" % db.keywords)
        db.tables["UserGroupMembers"] = []
        commit = True
    db.createIndex("UserGroupMembers", "UserGroupMembers_uq",
                   "userGroupId, userId", unique = True)
    db.createIndex("UserGroupMembers", "UserGroupMembersUserIdx",
                   "userId")

    if "Permissions" not in db.tables:
        assert("Items" in db.tables)
        assert("Labels" in db.tables)
        assert("UserGroups" in db.tables)
        cu.execute("""
        CREATE TABLE Permissions (
            permissionId    %(PRIMARYKEY)s,
            userGroupId     INTEGER NOT NULL,
            labelId         INTEGER NOT NULL,
            itemId          INTEGER NOT NULL,
            canWrite        INTEGER NOT NULL DEFAULT 0,
            canRemove       INTEGER NOT NULL DEFAULT 0,
            changed         NUMERIC(14,0) NOT NULL DEFAULT 0,
            CONSTRAINT Permissions_userGroupId_fk
                FOREIGN KEY (userGroupId) REFERENCES UserGroups(userGroupId)
                ON DELETE CASCADE ON UPDATE CASCADE,
            CONSTRAINT Permissions_labelId_fk
                FOREIGN KEY (labelId) REFERENCES Labels(labelId)
                ON DELETE CASCADE ON UPDATE CASCADE,
            CONSTRAINT Permissions_itemId_fk
                FOREIGN KEY (itemid) REFERENCES Items(itemId)
                ON DELETE CASCADE ON UPDATE CASCADE
        ) %(TABLEOPTS)s""" - db.keywords)
        db.tables["Permissions"] = []
        commit = True
    # this serves as a fk index for userGroupId
    db.createIndex("Permissions", "PermissionsIdx",
                   "userGroupId, labelId, itemId", unique = True)
    db.createIndex("Permissions", "PermissionsLabelId_fk", "labelId, userGroupId")
    db.createIndex("Permissions", "PermissionsItemId_fk", "itemId, userGroupId")
    if createTrigger(db, "Permissions"):
        commit = True

    if commit:
        db.loadSchema()
dataset/ETHPy150Open sassoftware/conary/conary/server/schema.py/createUsers/operator `%` -> `-`