{
  "db_name": "PostgreSQL",
  "query": "\n    WITH ins_user AS (\n        INSERT INTO af_user (uid, uuid, email, name)\n        VALUES ($1, $2, $3, $4) \n        ON CONFLICT(email) DO NOTHING\n        RETURNING uid\n    ),\n    owner_role AS (\n        SELECT id FROM af_roles WHERE name = 'Owner'\n    ),\n    ins_workspace AS (\n        INSERT INTO af_workspace (owner_uid)\n        SELECT uid FROM ins_user\n        RETURNING workspace_id, owner_uid\n    ),\n    ins_collab_member AS (\n        INSERT INTO af_collab_member (uid, oid, permission_id)\n        SELECT ins_workspace.owner_uid,\n               ins_workspace.workspace_id::TEXT, \n               (SELECT permission_id FROM af_role_permissions WHERE role_id = owner_role.id)\n        FROM ins_workspace, owner_role\n    ),\n    ins_workspace_member AS (\n        INSERT INTO af_workspace_member (uid, role_id, workspace_id)\n        SELECT ins_workspace.owner_uid, owner_role.id, ins_workspace.workspace_id\n        FROM ins_workspace, owner_role\n    )\n    SELECT COUNT(*) FROM ins_user;\n    ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "count",
        "type_info": "Int8"
      }
    ],
    "parameters": {
      "Left": [
        "Int8",
        "Uuid",
        "Text",
        "Text"
      ]
    },
    "nullable": [
      null
    ]
  },
  "hash": "0896dfcda66db300aedd9aaa162f04c6348dfc6c3263a40e1443013a6521b369"
}
