Skip to content

Commit

Permalink
add supabase type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
naoya7076 committed Mar 18, 2024
1 parent 34f632e commit 15404c0
Showing 1 changed file with 193 additions and 0 deletions.
193 changes: 193 additions & 0 deletions app/types/supabase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]

export type Database = {
public: {
Tables: {
hospital_vaccines: {
Row: {
created_at: string
hospital_id: number
updated_at: string
vaccine_id: number
}
Insert: {
created_at?: string
hospital_id: number
updated_at?: string
vaccine_id: number
}
Update: {
created_at?: string
hospital_id?: number
updated_at?: string
vaccine_id?: number
}
Relationships: [
{
foreignKeyName: "public_hospital_vaccines_hospital_id_fkey"
columns: ["hospital_id"]
isOneToOne: false
referencedRelation: "hospitals"
referencedColumns: ["id"]
},
{
foreignKeyName: "public_hospital_vaccines_vaccine_id_fkey"
columns: ["vaccine_id"]
isOneToOne: false
referencedRelation: "vaccines"
referencedColumns: ["id"]
}
]
}
hospitals: {
Row: {
address: string
address_detail: string | null
created_at: string
id: number
name: string
phone_numner: string
postal_code: string
updated_at: string
}
Insert: {
address: string
address_detail?: string | null
created_at?: string
id?: number
name: string
phone_numner: string
postal_code?: string
updated_at?: string
}
Update: {
address?: string
address_detail?: string | null
created_at?: string
id?: number
name?: string
phone_numner?: string
postal_code?: string
updated_at?: string
}
Relationships: []
}
vaccines: {
Row: {
created_at: string
id: number
name: string
}
Insert: {
created_at?: string
id?: number
name?: string
}
Update: {
created_at?: string
id?: number
name?: string
}
Relationships: []
}
}
Views: {
[_ in never]: never
}
Functions: {
[_ in never]: never
}
Enums: {
[_ in never]: never
}
CompositeTypes: {
[_ in never]: never
}
}
}

export type Tables<
PublicTableNameOrOptions extends
| keyof (Database["public"]["Tables"] & Database["public"]["Views"])
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])
: never = never
> = PublicTableNameOrOptions extends { schema: keyof Database }
? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
Row: infer R
}
? R
: never
: PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] &
Database["public"]["Views"])
? (Database["public"]["Tables"] &
Database["public"]["Views"])[PublicTableNameOrOptions] extends {
Row: infer R
}
? R
: never
: never

export type TablesInsert<
PublicTableNameOrOptions extends
| keyof Database["public"]["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Insert: infer I
}
? I
: never
: PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
Insert: infer I
}
? I
: never
: never

export type TablesUpdate<
PublicTableNameOrOptions extends
| keyof Database["public"]["Tables"]
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
: never = never
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Update: infer U
}
? U
: never
: PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
Update: infer U
}
? U
: never
: never

export type Enums<
PublicEnumNameOrOptions extends
| keyof Database["public"]["Enums"]
| { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
: never = never
> = PublicEnumNameOrOptions extends { schema: keyof Database }
? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
: PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]
? Database["public"]["Enums"][PublicEnumNameOrOptions]
: never

0 comments on commit 15404c0

Please sign in to comment.