{
  "id": "1b8c1e0f-8476-470c-a641-b3c350a2c1a4",
  "prevId": "d81153f7-e0c6-4843-bee9-21a7129f7d01",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.audit_logs": {
      "name": "audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "resource": {
          "name": "resource",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "resource_id": {
          "name": "resource_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "old_value": {
          "name": "old_value",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "new_value": {
          "name": "new_value",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip_address": {
          "name": "ip_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "success": {
          "name": "success",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "audit_logs_user_id_users_id_fk": {
          "name": "audit_logs_user_id_users_id_fk",
          "tableFrom": "audit_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.contacts": {
      "name": "contacts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "added_at": {
          "name": "added_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "contacts_user_id_users_id_fk": {
          "name": "contacts_user_id_users_id_fk",
          "tableFrom": "contacts",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.emails": {
      "name": "emails",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "jmap_id": {
          "name": "jmap_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "message_id": {
          "name": "message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "thread_id": {
          "name": "thread_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "in_reply_to": {
          "name": "in_reply_to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "from": {
          "name": "from",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "to": {
          "name": "to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_read": {
          "name": "is_read",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "date": {
          "name": "date",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "emails_user_id_users_id_fk": {
          "name": "emails_user_id_users_id_fk",
          "tableFrom": "emails",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "emails_contact_id_contacts_id_fk": {
          "name": "emails_contact_id_contacts_id_fk",
          "tableFrom": "emails",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "emails_jmap_id_unique": {
          "name": "emails_jmap_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "jmap_id"
          ]
        },
        "emails_message_id_unique": {
          "name": "emails_message_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "message_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "username": {
          "name": "username",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "email_password": {
          "name": "email_password",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "jmap_account_id": {
          "name": "jmap_account_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "first_name": {
          "name": "first_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_name": {
          "name": "last_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password": {
          "name": "password",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "temp_password": {
          "name": "temp_password",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "changed_password": {
          "name": "changed_password",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "role": {
          "name": "role",
          "type": "role",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'member'"
        },
        "last_login": {
          "name": "last_login",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_username_unique": {
          "name": "users_username_unique",
          "nullsNotDistinct": false,
          "columns": [
            "username"
          ]
        },
        "users_email_unique": {
          "name": "users_email_unique",
          "nullsNotDistinct": false,
          "columns": [
            "email"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {
    "public.role": {
      "name": "role",
      "schema": "public",
      "values": [
        "admin",
        "member"
      ]
    }
  },
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}