sailfork / t3code-github / .repos/ alchemy-effect/ examples/ cloudflare-neon-prisma/ migrations/ app/ 20260830T0525_init/ ops.json

[
  {
    "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.Post",
    "label": "Create table \"Post\"",
    "summary": "Creates table \"Post\"",
    "operationClass": "additive",
    "target": {
      "id": "postgres",
      "details": {
        "schema": "public",
        "objectType": "table",
        "name": "Post"
      }
    },
    "precheck": [
      {
        "description": "ensure table \"Post\" does not exist",
        "sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"",
        "params": ["\"public\".\"Post\""]
      }
    ],
    "execute": [
      {
        "description": "create table \"Post\"",
        "sql": "CREATE TABLE \"public\".\"Post\" (\n  \"authorId\" uuid NOT NULL,\n  \"id\" uuid NOT NULL,\n  \"title\" text NOT NULL,\n  PRIMARY KEY (\"id\")\n)",
        "params": []
      }
    ],
    "postcheck": [
      {
        "description": "verify table \"Post\" exists",
        "sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"",
        "params": ["\"public\".\"Post\""]
      }
    ]
  },
  {
    "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  \"id\" uuid NOT NULL,\n  \"name\" text NOT NULL,\n  PRIMARY KEY (\"id\")\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\""]
      }
    ]
  }
]