-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(supabase): wip - scripts that autogenerate main db types
- Loading branch information
Showing
3 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Chemin vers le fichier de types générés par Supabase | ||
inputFile="/home/jkergal/dev/drafty/database/types/database.types.ts" | ||
|
||
# Chemin vers le fichier de sortie main.types.ts | ||
outputFile="/home/jkergal/dev/drafty/database/types/main.types.ts" | ||
|
||
# Extrait les noms des tables du fichier de types | ||
tableNames=($(grep -oE '\b[a-z][a-zA-Z0-9_]*: \{' "$inputFile" | sed 's/: {//')) | ||
|
||
# Génère dynamiquement le contenu du fichier main.types.ts | ||
> "$outputFile" | ||
echo "import { SupabackTypes } from './generic.types'" >> "$outputFile" | ||
echo "" >> "$outputFile" | ||
echo $tableNames | ||
|
||
# Génère les types pour chaque table et les déclarations | ||
for tableName in "${tableNames[@]}"; do | ||
echo "export type $tableName = SupabackTypes<'$tableName'>" >> "$outputFile" | ||
done | ||
|
||
echo "Le fichier $outputFile a été généré avec succès." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { SupabackTypes } from './generic.types'; | ||
|
||
export type DraftyConfig = SupabackTypes<'drafty_configurations'>; | ||
export type EnrollmentMessage = SupabackTypes<'enrollment_messages'>; | ||
export type GameTable = SupabackTypes<'game_tables'>; | ||
export type Pod = SupabackTypes<'pods'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
import { SupabackTypes } from './generic.types'; | ||
import { SupabackTypes } from './generic.types' | ||
|
||
export type DraftyConfig = SupabackTypes<'drafty_configurations'>; | ||
export type EnrollmentMessage = SupabackTypes<'enrollment_messages'>; | ||
export type GameTable = SupabackTypes<'game_tables'>; | ||
export type Pod = SupabackTypes<'pods'>; | ||
export type public = SupabackTypes<'public'> | ||
export type drafty_configurations = SupabackTypes<'drafty_configurations'> | ||
export type enrollment_messages = SupabackTypes<'enrollment_messages'> | ||
export type game_tables = SupabackTypes<'game_tables'> | ||
export type pods = SupabackTypes<'pods'> | ||
export type storage = SupabackTypes<'storage'> | ||
export type buckets = SupabackTypes<'buckets'> | ||
export type migrations = SupabackTypes<'migrations'> | ||
export type objects = SupabackTypes<'objects'> | ||
export type can_insert_object = SupabackTypes<'can_insert_object'> | ||
export type extension = SupabackTypes<'extension'> | ||
export type filename = SupabackTypes<'filename'> | ||
export type foldername = SupabackTypes<'foldername'> | ||
export type get_size_by_bucket = SupabackTypes<'get_size_by_bucket'> | ||
export type search = SupabackTypes<'search'> |