{
  "id": "8f34bafa-cffc-4933-952f-64b46afa9c5c",
  "prevId": "6455ad81-98c0-4f32-a2fa-0f99ce9ce8e5",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.account": {
      "name": "account",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "account_id": {
          "name": "account_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "provider_id": {
          "name": "provider_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "access_token": {
          "name": "access_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "refresh_token": {
          "name": "refresh_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "id_token": {
          "name": "id_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "access_token_expires_at": {
          "name": "access_token_expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "refresh_token_expires_at": {
          "name": "refresh_token_expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "scope": {
          "name": "scope",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password": {
          "name": "password",
          "type": "text",
          "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
        }
      },
      "indexes": {
        "account_userId_idx": {
          "name": "account_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "account_user_id_user_id_fk": {
          "name": "account_user_id_user_id_fk",
          "tableFrom": "account",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.deck_terms": {
      "name": "deck_terms",
      "schema": "",
      "columns": {
        "deck_id": {
          "name": "deck_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "term_id": {
          "name": "term_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "deck_terms_deck_id_decks_id_fk": {
          "name": "deck_terms_deck_id_decks_id_fk",
          "tableFrom": "deck_terms",
          "tableTo": "decks",
          "columnsFrom": ["deck_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "deck_terms_term_id_terms_id_fk": {
          "name": "deck_terms_term_id_terms_id_fk",
          "tableFrom": "deck_terms",
          "tableTo": "terms",
          "columnsFrom": ["term_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "deck_terms_deck_id_term_id_pk": {
          "name": "deck_terms_deck_id_term_id_pk",
          "columns": ["deck_id", "term_id"]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.decks": {
      "name": "decks",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "source_language": {
          "name": "source_language",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true
        },
        "validated_languages": {
          "name": "validated_languages",
          "type": "varchar(10)[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'"
        },
        "type": {
          "name": "type",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "idx_decks_type": {
          "name": "idx_decks_type",
          "columns": [
            {
              "expression": "type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "source_language",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "unique_deck_name": {
          "name": "unique_deck_name",
          "nullsNotDistinct": false,
          "columns": ["name", "source_language"]
        }
      },
      "policies": {},
      "checkConstraints": {
        "source_language_check": {
          "name": "source_language_check",
          "value": "\"decks\".\"source_language\" IN ('en', 'it')"
        },
        "validated_languages_check": {
          "name": "validated_languages_check",
          "value": "validated_languages <@ ARRAY['en', 'it']::varchar[]"
        },
        "validated_languages_excludes_source": {
          "name": "validated_languages_excludes_source",
          "value": "NOT (\"decks\".\"source_language\" = ANY(\"decks\".\"validated_languages\"))"
        },
        "deck_type_check": {
          "name": "deck_type_check",
          "value": "\"decks\".\"type\" IN ('grammar', 'media')"
        }
      },
      "isRLSEnabled": false
    },
    "public.session": {
      "name": "session",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "token": {
          "name": "token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "ip_address": {
          "name": "ip_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "session_userId_idx": {
          "name": "session_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "session_user_id_user_id_fk": {
          "name": "session_user_id_user_id_fk",
          "tableFrom": "session",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "session_token_unique": {
          "name": "session_token_unique",
          "nullsNotDistinct": false,
          "columns": ["token"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.term_glosses": {
      "name": "term_glosses",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "term_id": {
          "name": "term_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "language_code": {
          "name": "language_code",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true
        },
        "text": {
          "name": "text",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "term_glosses_term_id_terms_id_fk": {
          "name": "term_glosses_term_id_terms_id_fk",
          "tableFrom": "term_glosses",
          "tableTo": "terms",
          "columnsFrom": ["term_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "unique_term_gloss": {
          "name": "unique_term_gloss",
          "nullsNotDistinct": false,
          "columns": ["term_id", "language_code"]
        }
      },
      "policies": {},
      "checkConstraints": {
        "language_code_check": {
          "name": "language_code_check",
          "value": "\"term_glosses\".\"language_code\" IN ('en', 'it')"
        }
      },
      "isRLSEnabled": false
    },
    "public.term_topics": {
      "name": "term_topics",
      "schema": "",
      "columns": {
        "term_id": {
          "name": "term_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "topic_id": {
          "name": "topic_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "term_topics_term_id_terms_id_fk": {
          "name": "term_topics_term_id_terms_id_fk",
          "tableFrom": "term_topics",
          "tableTo": "terms",
          "columnsFrom": ["term_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "term_topics_topic_id_topics_id_fk": {
          "name": "term_topics_topic_id_topics_id_fk",
          "tableFrom": "term_topics",
          "tableTo": "topics",
          "columnsFrom": ["topic_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "term_topics_term_id_topic_id_pk": {
          "name": "term_topics_term_id_topic_id_pk",
          "columns": ["term_id", "topic_id"]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.terms": {
      "name": "terms",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "source": {
          "name": "source",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": false
        },
        "source_id": {
          "name": "source_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "pos": {
          "name": "pos",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "idx_terms_source_pos": {
          "name": "idx_terms_source_pos",
          "columns": [
            {
              "expression": "source",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "pos",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "unique_source_id": {
          "name": "unique_source_id",
          "nullsNotDistinct": false,
          "columns": ["source", "source_id"]
        }
      },
      "policies": {},
      "checkConstraints": {
        "pos_check": {
          "name": "pos_check",
          "value": "\"terms\".\"pos\" IN ('noun', 'verb')"
        }
      },
      "isRLSEnabled": false
    },
    "public.topics": {
      "name": "topics",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "slug": {
          "name": "slug",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "topics_slug_unique": {
          "name": "topics_slug_unique",
          "nullsNotDistinct": false,
          "columns": ["slug"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.translations": {
      "name": "translations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "term_id": {
          "name": "term_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "language_code": {
          "name": "language_code",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true
        },
        "text": {
          "name": "text",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "cefr_level": {
          "name": "cefr_level",
          "type": "varchar(2)",
          "primaryKey": false,
          "notNull": false
        },
        "difficulty": {
          "name": "difficulty",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "idx_translations_lang": {
          "name": "idx_translations_lang",
          "columns": [
            {
              "expression": "language_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "difficulty",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "cefr_level",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "term_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "translations_term_id_terms_id_fk": {
          "name": "translations_term_id_terms_id_fk",
          "tableFrom": "translations",
          "tableTo": "terms",
          "columnsFrom": ["term_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "unique_translations": {
          "name": "unique_translations",
          "nullsNotDistinct": false,
          "columns": ["term_id", "language_code", "text"]
        }
      },
      "policies": {},
      "checkConstraints": {
        "language_code_check": {
          "name": "language_code_check",
          "value": "\"translations\".\"language_code\" IN ('en', 'it')"
        },
        "cefr_check": {
          "name": "cefr_check",
          "value": "\"translations\".\"cefr_level\" IN ('A1', 'A2', 'B1', 'B2', 'C1', 'C2')"
        },
        "difficulty_check": {
          "name": "difficulty_check",
          "value": "\"translations\".\"difficulty\" IN ('easy', 'intermediate', 'hard')"
        }
      },
      "isRLSEnabled": false
    },
    "public.user": {
      "name": "user",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email_verified": {
          "name": "email_verified",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "image": {
          "name": "image",
          "type": "text",
          "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": {
        "user_email_unique": {
          "name": "user_email_unique",
          "nullsNotDistinct": false,
          "columns": ["email"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.verification": {
      "name": "verification",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "identifier": {
          "name": "identifier",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "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": {
        "verification_identifier_idx": {
          "name": "verification_identifier_idx",
          "columns": [
            {
              "expression": "identifier",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": { "columns": {}, "schemas": {}, "tables": {} }
}
