|
1 | 1 | export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]
|
2 | 2 |
|
3 |
| -export interface Database { |
| 3 | +export type Database = { |
4 | 4 | personal: {
|
5 | 5 | Tables: {
|
6 | 6 | users: {
|
@@ -112,25 +112,29 @@ export interface Database {
|
112 | 112 | {
|
113 | 113 | foreignKeyName: 'messages_channel_id_fkey'
|
114 | 114 | columns: ['channel_id']
|
| 115 | + isOneToOne: false |
115 | 116 | referencedRelation: 'channels'
|
116 | 117 | referencedColumns: ['id']
|
117 | 118 | },
|
118 | 119 | {
|
119 | 120 | foreignKeyName: 'messages_username_fkey'
|
120 | 121 | columns: ['username']
|
121 |
| - referencedRelation: 'users' |
| 122 | + isOneToOne: false |
| 123 | + referencedRelation: 'non_updatable_view' |
122 | 124 | referencedColumns: ['username']
|
123 | 125 | },
|
124 | 126 | {
|
125 | 127 | foreignKeyName: 'messages_username_fkey'
|
126 | 128 | columns: ['username']
|
127 |
| - referencedRelation: 'non_updatable_view' |
| 129 | + isOneToOne: false |
| 130 | + referencedRelation: 'updatable_view' |
128 | 131 | referencedColumns: ['username']
|
129 | 132 | },
|
130 | 133 | {
|
131 | 134 | foreignKeyName: 'messages_username_fkey'
|
132 | 135 | columns: ['username']
|
133 |
| - referencedRelation: 'updatable_view' |
| 136 | + isOneToOne: false |
| 137 | + referencedRelation: 'users' |
134 | 138 | referencedColumns: ['username']
|
135 | 139 | }
|
136 | 140 | ]
|
@@ -202,6 +206,12 @@ export interface Database {
|
202 | 206 | }
|
203 | 207 | }
|
204 | 208 | Functions: {
|
| 209 | + function_with_optional_param: { |
| 210 | + Args: { |
| 211 | + param?: string |
| 212 | + } |
| 213 | + Returns: string |
| 214 | + } |
205 | 215 | get_status: {
|
206 | 216 | Args: {
|
207 | 217 | name_param: string
|
@@ -236,3 +246,77 @@ export interface Database {
|
236 | 246 | }
|
237 | 247 | }
|
238 | 248 | }
|
| 249 | + |
| 250 | +type PublicSchema = Database[Extract<keyof Database, 'public'>] |
| 251 | + |
| 252 | +export type Tables< |
| 253 | + PublicTableNameOrOptions extends |
| 254 | + | keyof (PublicSchema['Tables'] & PublicSchema['Views']) |
| 255 | + | { schema: keyof Database }, |
| 256 | + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } |
| 257 | + ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] & |
| 258 | + Database[PublicTableNameOrOptions['schema']]['Views']) |
| 259 | + : never = never |
| 260 | +> = PublicTableNameOrOptions extends { schema: keyof Database } |
| 261 | + ? (Database[PublicTableNameOrOptions['schema']]['Tables'] & |
| 262 | + Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends { |
| 263 | + Row: infer R |
| 264 | + } |
| 265 | + ? R |
| 266 | + : never |
| 267 | + : PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] & PublicSchema['Views']) |
| 268 | + ? (PublicSchema['Tables'] & PublicSchema['Views'])[PublicTableNameOrOptions] extends { |
| 269 | + Row: infer R |
| 270 | + } |
| 271 | + ? R |
| 272 | + : never |
| 273 | + : never |
| 274 | + |
| 275 | +export type TablesInsert< |
| 276 | + PublicTableNameOrOptions extends keyof PublicSchema['Tables'] | { schema: keyof Database }, |
| 277 | + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } |
| 278 | + ? keyof Database[PublicTableNameOrOptions['schema']]['Tables'] |
| 279 | + : never = never |
| 280 | +> = PublicTableNameOrOptions extends { schema: keyof Database } |
| 281 | + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { |
| 282 | + Insert: infer I |
| 283 | + } |
| 284 | + ? I |
| 285 | + : never |
| 286 | + : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] |
| 287 | + ? PublicSchema['Tables'][PublicTableNameOrOptions] extends { |
| 288 | + Insert: infer I |
| 289 | + } |
| 290 | + ? I |
| 291 | + : never |
| 292 | + : never |
| 293 | + |
| 294 | +export type TablesUpdate< |
| 295 | + PublicTableNameOrOptions extends keyof PublicSchema['Tables'] | { schema: keyof Database }, |
| 296 | + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } |
| 297 | + ? keyof Database[PublicTableNameOrOptions['schema']]['Tables'] |
| 298 | + : never = never |
| 299 | +> = PublicTableNameOrOptions extends { schema: keyof Database } |
| 300 | + ? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends { |
| 301 | + Update: infer U |
| 302 | + } |
| 303 | + ? U |
| 304 | + : never |
| 305 | + : PublicTableNameOrOptions extends keyof PublicSchema['Tables'] |
| 306 | + ? PublicSchema['Tables'][PublicTableNameOrOptions] extends { |
| 307 | + Update: infer U |
| 308 | + } |
| 309 | + ? U |
| 310 | + : never |
| 311 | + : never |
| 312 | + |
| 313 | +export type Enums< |
| 314 | + PublicEnumNameOrOptions extends keyof PublicSchema['Enums'] | { schema: keyof Database }, |
| 315 | + EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } |
| 316 | + ? keyof Database[PublicEnumNameOrOptions['schema']]['Enums'] |
| 317 | + : never = never |
| 318 | +> = PublicEnumNameOrOptions extends { schema: keyof Database } |
| 319 | + ? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName] |
| 320 | + : PublicEnumNameOrOptions extends keyof PublicSchema['Enums'] |
| 321 | + ? PublicSchema['Enums'][PublicEnumNameOrOptions] |
| 322 | + : never |
0 commit comments