[
  {
    "id": "schema.public",
    "label": "Create schema \"public\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres"
    },
    "precheck": [],
    "execute": [
      {
        "description": "Create schema \"public\"",
        "sql": "CREATE SCHEMA IF NOT EXISTS \"public\"",
        "params": []
      }
    ],
    "postcheck": []
  },
  {
    "id": "table.Activity",
    "label": "Create table \"Activity\"",
    "summary": "Creates table \"Activity\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "table",
        "name": "Activity"
      }
    },
    "precheck": [
      {
        "description": "ensure table \"Activity\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create table \"Activity\"",
        "sql": "CREATE TABLE \"public\".\"Activity\" (\n  \"completedAt\" timestamptz,\n  \"createdAt\" timestamptz DEFAULT (now()) NOT NULL,\n  \"description\" text,\n  \"dueAt\" timestamptz,\n  \"id\" text NOT NULL,\n  \"leadId\" text NOT NULL,\n  \"title\" text NOT NULL,\n  \"type\" text NOT NULL,\n  \"updatedAt\" timestamptz NOT NULL,\n  \"userId\" text NOT NULL,\n  PRIMARY KEY (\"id\"),\n  CONSTRAINT \"Activity_type_check_7582c318\" CHECK (\"type\" IN ('NOTE', 'CALL', 'EMAIL', 'MEETING', 'TASK'))\n)",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify table \"Activity\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity\""
        ]
      }
    ]
  },
  {
    "id": "table.Company",
    "label": "Create table \"Company\"",
    "summary": "Creates table \"Company\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "table",
        "name": "Company"
      }
    },
    "precheck": [
      {
        "description": "ensure table \"Company\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Company\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create table \"Company\"",
        "sql": "CREATE TABLE \"public\".\"Company\" (\n  \"address\" text,\n  \"createdAt\" timestamptz DEFAULT (now()) NOT NULL,\n  \"email\" text,\n  \"id\" text NOT NULL,\n  \"industry\" text,\n  \"name\" text NOT NULL,\n  \"phone\" text,\n  \"updatedAt\" timestamptz NOT NULL,\n  \"website\" text,\n  PRIMARY KEY (\"id\")\n)",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify table \"Company\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Company\""
        ]
      }
    ]
  },
  {
    "id": "table.Lead",
    "label": "Create table \"Lead\"",
    "summary": "Creates table \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "table",
        "name": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure table \"Lead\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create table \"Lead\"",
        "sql": "CREATE TABLE \"public\".\"Lead\" (\n  \"assignedToId\" text NOT NULL,\n  \"companyId\" text,\n  \"createdAt\" timestamptz DEFAULT (now()) NOT NULL,\n  \"createdById\" text NOT NULL,\n  \"email\" text,\n  \"firstName\" text NOT NULL,\n  \"id\" text NOT NULL,\n  \"jobTitle\" text,\n  \"lastName\" text,\n  \"notes\" text,\n  \"phone\" text,\n  \"source\" text DEFAULT 'OTHER' NOT NULL,\n  \"status\" text DEFAULT 'NEW' NOT NULL,\n  \"updatedAt\" timestamptz NOT NULL,\n  PRIMARY KEY (\"id\"),\n  CONSTRAINT \"Lead_source_check_5fb42089\" CHECK (\"source\" IN ('WEBSITE', 'REFERRAL', 'COLD_CALL', 'COLD_EMAIL', 'SOCIAL_MEDIA', 'OTHER')),\n  CONSTRAINT \"Lead_status_check_760483ed\" CHECK (\"status\" IN ('NEW', 'CONTACTED', 'QUALIFIED', 'PROPOSAL', 'WON', 'LOST'))\n)",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify table \"Lead\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead\""
        ]
      }
    ]
  },
  {
    "id": "table.User",
    "label": "Create table \"User\"",
    "summary": "Creates table \"User\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "table",
        "name": "User"
      }
    },
    "precheck": [
      {
        "description": "ensure table \"User\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"User\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create table \"User\"",
        "sql": "CREATE TABLE \"public\".\"User\" (\n  \"createdAt\" timestamptz DEFAULT (now()) NOT NULL,\n  \"email\" text NOT NULL,\n  \"firstName\" text NOT NULL,\n  \"id\" text NOT NULL,\n  \"isActive\" bool DEFAULT true NOT NULL,\n  \"lastName\" text NOT NULL,\n  \"passwordHash\" text NOT NULL,\n  \"role\" text DEFAULT 'SALES_USER' NOT NULL,\n  \"updatedAt\" timestamptz NOT NULL,\n  PRIMARY KEY (\"id\"),\n  CONSTRAINT \"User_role_check_14cfa751\" CHECK (\"role\" IN ('ADMIN', 'SALES_USER'))\n)",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify table \"User\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"User\""
        ]
      }
    ]
  },
  {
    "id": "unique.User.User_email_key",
    "label": "Add unique constraint on \"User\" (email)",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "unique",
        "name": "User_email_key",
        "table": "User"
      }
    },
    "precheck": [
      {
        "description": "ensure constraint \"User_email_key\" does not exist",
        "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "User_email_key",
          "public",
          "\"public\".\"User\""
        ]
      }
    ],
    "execute": [
      {
        "description": "add unique constraint \"User_email_key\"",
        "sql": "ALTER TABLE \"public\".\"User\" ADD CONSTRAINT \"User_email_key\" UNIQUE (\"email\")"
      }
    ],
    "postcheck": [
      {
        "description": "verify constraint \"User_email_key\" exists",
        "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "User_email_key",
          "public",
          "\"public\".\"User\""
        ]
      }
    ]
  },
  {
    "id": "index.Activity.Activity_leadId_idx_9113844c",
    "label": "Create index \"Activity_leadId_idx_9113844c\" on \"Activity\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Activity_leadId_idx_9113844c",
        "table": "Activity"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Activity_leadId_idx_9113844c\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity_leadId_idx_9113844c\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Activity_leadId_idx_9113844c\"",
        "sql": "CREATE INDEX \"Activity_leadId_idx_9113844c\" ON \"public\".\"Activity\" (\"leadId\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Activity_leadId_idx_9113844c\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity_leadId_idx_9113844c\""
        ]
      }
    ]
  },
  {
    "id": "index.Activity.Activity_type_idx_b6b604ea",
    "label": "Create index \"Activity_type_idx_b6b604ea\" on \"Activity\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Activity_type_idx_b6b604ea",
        "table": "Activity"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Activity_type_idx_b6b604ea\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity_type_idx_b6b604ea\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Activity_type_idx_b6b604ea\"",
        "sql": "CREATE INDEX \"Activity_type_idx_b6b604ea\" ON \"public\".\"Activity\" (\"type\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Activity_type_idx_b6b604ea\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity_type_idx_b6b604ea\""
        ]
      }
    ]
  },
  {
    "id": "index.Activity.Activity_userId_idx_a489d58a",
    "label": "Create index \"Activity_userId_idx_a489d58a\" on \"Activity\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Activity_userId_idx_a489d58a",
        "table": "Activity"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Activity_userId_idx_a489d58a\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity_userId_idx_a489d58a\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Activity_userId_idx_a489d58a\"",
        "sql": "CREATE INDEX \"Activity_userId_idx_a489d58a\" ON \"public\".\"Activity\" (\"userId\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Activity_userId_idx_a489d58a\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Activity_userId_idx_a489d58a\""
        ]
      }
    ]
  },
  {
    "id": "index.Company.Company_name_idx_ce87e6ba",
    "label": "Create index \"Company_name_idx_ce87e6ba\" on \"Company\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Company_name_idx_ce87e6ba",
        "table": "Company"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Company_name_idx_ce87e6ba\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Company_name_idx_ce87e6ba\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Company_name_idx_ce87e6ba\"",
        "sql": "CREATE INDEX \"Company_name_idx_ce87e6ba\" ON \"public\".\"Company\" (\"name\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Company_name_idx_ce87e6ba\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Company_name_idx_ce87e6ba\""
        ]
      }
    ]
  },
  {
    "id": "index.Lead.Lead_assignedToId_idx_45a131c2",
    "label": "Create index \"Lead_assignedToId_idx_45a131c2\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Lead_assignedToId_idx_45a131c2",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Lead_assignedToId_idx_45a131c2\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_assignedToId_idx_45a131c2\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Lead_assignedToId_idx_45a131c2\"",
        "sql": "CREATE INDEX \"Lead_assignedToId_idx_45a131c2\" ON \"public\".\"Lead\" (\"assignedToId\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Lead_assignedToId_idx_45a131c2\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_assignedToId_idx_45a131c2\""
        ]
      }
    ]
  },
  {
    "id": "index.Lead.Lead_companyId_idx_33acc5ed",
    "label": "Create index \"Lead_companyId_idx_33acc5ed\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Lead_companyId_idx_33acc5ed",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Lead_companyId_idx_33acc5ed\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_companyId_idx_33acc5ed\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Lead_companyId_idx_33acc5ed\"",
        "sql": "CREATE INDEX \"Lead_companyId_idx_33acc5ed\" ON \"public\".\"Lead\" (\"companyId\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Lead_companyId_idx_33acc5ed\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_companyId_idx_33acc5ed\""
        ]
      }
    ]
  },
  {
    "id": "index.Lead.Lead_createdById_idx_8bf640ed",
    "label": "Create index \"Lead_createdById_idx_8bf640ed\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Lead_createdById_idx_8bf640ed",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Lead_createdById_idx_8bf640ed\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_createdById_idx_8bf640ed\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Lead_createdById_idx_8bf640ed\"",
        "sql": "CREATE INDEX \"Lead_createdById_idx_8bf640ed\" ON \"public\".\"Lead\" (\"createdById\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Lead_createdById_idx_8bf640ed\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_createdById_idx_8bf640ed\""
        ]
      }
    ]
  },
  {
    "id": "index.Lead.Lead_status_idx_e98638ab",
    "label": "Create index \"Lead_status_idx_e98638ab\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "index",
        "name": "Lead_status_idx_e98638ab",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure index \"Lead_status_idx_e98638ab\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_status_idx_e98638ab\""
        ]
      }
    ],
    "execute": [
      {
        "description": "create index \"Lead_status_idx_e98638ab\"",
        "sql": "CREATE INDEX \"Lead_status_idx_e98638ab\" ON \"public\".\"Lead\" (\"status\")",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify index \"Lead_status_idx_e98638ab\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": [
          "\"public\".\"Lead_status_idx_e98638ab\""
        ]
      }
    ]
  },
  {
    "id": "foreignKey.Activity.Activity_leadId_fkey",
    "label": "Add foreign key \"Activity_leadId_fkey\" on \"Activity\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "foreignKey",
        "name": "Activity_leadId_fkey",
        "table": "Activity"
      }
    },
    "precheck": [
      {
        "description": "ensure FK \"Activity_leadId_fkey\" does not exist",
        "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Activity_leadId_fkey",
          "public",
          "\"public\".\"Activity\""
        ]
      }
    ],
    "execute": [
      {
        "description": "add FK \"Activity_leadId_fkey\"",
        "sql": "ALTER TABLE \"public\".\"Activity\"\nADD CONSTRAINT \"Activity_leadId_fkey\"\nFOREIGN KEY (\"leadId\")\nREFERENCES \"public\".\"Lead\" (\"id\")\nON DELETE CASCADE"
      }
    ],
    "postcheck": [
      {
        "description": "verify FK \"Activity_leadId_fkey\" exists",
        "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Activity_leadId_fkey",
          "public",
          "\"public\".\"Activity\""
        ]
      }
    ]
  },
  {
    "id": "foreignKey.Activity.Activity_userId_fkey",
    "label": "Add foreign key \"Activity_userId_fkey\" on \"Activity\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "foreignKey",
        "name": "Activity_userId_fkey",
        "table": "Activity"
      }
    },
    "precheck": [
      {
        "description": "ensure FK \"Activity_userId_fkey\" does not exist",
        "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Activity_userId_fkey",
          "public",
          "\"public\".\"Activity\""
        ]
      }
    ],
    "execute": [
      {
        "description": "add FK \"Activity_userId_fkey\"",
        "sql": "ALTER TABLE \"public\".\"Activity\"\nADD CONSTRAINT \"Activity_userId_fkey\"\nFOREIGN KEY (\"userId\")\nREFERENCES \"public\".\"User\" (\"id\")"
      }
    ],
    "postcheck": [
      {
        "description": "verify FK \"Activity_userId_fkey\" exists",
        "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Activity_userId_fkey",
          "public",
          "\"public\".\"Activity\""
        ]
      }
    ]
  },
  {
    "id": "foreignKey.Lead.Lead_createdById_fkey",
    "label": "Add foreign key \"Lead_createdById_fkey\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "foreignKey",
        "name": "Lead_createdById_fkey",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure FK \"Lead_createdById_fkey\" does not exist",
        "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Lead_createdById_fkey",
          "public",
          "\"public\".\"Lead\""
        ]
      }
    ],
    "execute": [
      {
        "description": "add FK \"Lead_createdById_fkey\"",
        "sql": "ALTER TABLE \"public\".\"Lead\"\nADD CONSTRAINT \"Lead_createdById_fkey\"\nFOREIGN KEY (\"createdById\")\nREFERENCES \"public\".\"User\" (\"id\")"
      }
    ],
    "postcheck": [
      {
        "description": "verify FK \"Lead_createdById_fkey\" exists",
        "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Lead_createdById_fkey",
          "public",
          "\"public\".\"Lead\""
        ]
      }
    ]
  },
  {
    "id": "foreignKey.Lead.Lead_assignedToId_fkey",
    "label": "Add foreign key \"Lead_assignedToId_fkey\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "foreignKey",
        "name": "Lead_assignedToId_fkey",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure FK \"Lead_assignedToId_fkey\" does not exist",
        "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Lead_assignedToId_fkey",
          "public",
          "\"public\".\"Lead\""
        ]
      }
    ],
    "execute": [
      {
        "description": "add FK \"Lead_assignedToId_fkey\"",
        "sql": "ALTER TABLE \"public\".\"Lead\"\nADD CONSTRAINT \"Lead_assignedToId_fkey\"\nFOREIGN KEY (\"assignedToId\")\nREFERENCES \"public\".\"User\" (\"id\")"
      }
    ],
    "postcheck": [
      {
        "description": "verify FK \"Lead_assignedToId_fkey\" exists",
        "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Lead_assignedToId_fkey",
          "public",
          "\"public\".\"Lead\""
        ]
      }
    ]
  },
  {
    "id": "foreignKey.Lead.Lead_companyId_fkey",
    "label": "Add foreign key \"Lead_companyId_fkey\" on \"Lead\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "foreignKey",
        "name": "Lead_companyId_fkey",
        "table": "Lead"
      }
    },
    "precheck": [
      {
        "description": "ensure FK \"Lead_companyId_fkey\" does not exist",
        "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Lead_companyId_fkey",
          "public",
          "\"public\".\"Lead\""
        ]
      }
    ],
    "execute": [
      {
        "description": "add FK \"Lead_companyId_fkey\"",
        "sql": "ALTER TABLE \"public\".\"Lead\"\nADD CONSTRAINT \"Lead_companyId_fkey\"\nFOREIGN KEY (\"companyId\")\nREFERENCES \"public\".\"Company\" (\"id\")"
      }
    ],
    "postcheck": [
      {
        "description": "verify FK \"Lead_companyId_fkey\" exists",
        "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"",
        "params": [
          "Lead_companyId_fkey",
          "public",
          "\"public\".\"Lead\""
        ]
      }
    ]
  }
]