From 12d72e31118655e8d0b526024b1c196020f7c5cf Mon Sep 17 00:00:00 2001 From: Arjun Komath Date: Sat, 7 Dec 2024 14:12:19 +1100 Subject: [PATCH 1/2] Add tags column to posts --- packages/supabase/migrations/14_post_tags.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 packages/supabase/migrations/14_post_tags.sql diff --git a/packages/supabase/migrations/14_post_tags.sql b/packages/supabase/migrations/14_post_tags.sql new file mode 100644 index 0000000..b3538d5 --- /dev/null +++ b/packages/supabase/migrations/14_post_tags.sql @@ -0,0 +1,2 @@ +ALTER TABLE IF EXISTS public.posts +ADD COLUMN tags text [] not null DEFAULT '{}'; \ No newline at end of file From ff375c87476d706ec0ac3dcec9788e7c588ee0c0 Mon Sep 17 00:00:00 2001 From: Arjun Komath Date: Sun, 8 Dec 2024 22:53:45 +1100 Subject: [PATCH 2/2] Update type --- packages/supabase/types/index.ts | 52 ++++++++++++-------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/packages/supabase/types/index.ts b/packages/supabase/types/index.ts index 18edfe4..51f96e7 100644 --- a/packages/supabase/types/index.ts +++ b/packages/supabase/types/index.ts @@ -152,13 +152,6 @@ export type Database = { referencedRelation: "pages" referencedColumns: ["id"] }, - { - foreignKeyName: "page_settings_user_id_fkey" - columns: ["user_id"] - isOneToOne: false - referencedRelation: "users" - referencedColumns: ["id"] - }, ] } page_views: { @@ -236,15 +229,7 @@ export type Database = { url_slug?: string | null user_id?: string } - Relationships: [ - { - foreignKeyName: "pages_user_id_fkey" - columns: ["user_id"] - isOneToOne: false - referencedRelation: "users" - referencedColumns: ["id"] - }, - ] + Relationships: [] } post_reactions: { Row: { @@ -303,6 +288,7 @@ export type Database = { publication_date: string | null publish_at: string | null status: Database["public"]["Enums"]["post_status"] + tags: string[] title: string type: Database["public"]["Enums"]["post_type"] updated_at: string @@ -320,6 +306,7 @@ export type Database = { publication_date?: string | null publish_at?: string | null status: Database["public"]["Enums"]["post_status"] + tags?: string[] title: string type: Database["public"]["Enums"]["post_type"] updated_at?: string @@ -337,6 +324,7 @@ export type Database = { publication_date?: string | null publish_at?: string | null status?: Database["public"]["Enums"]["post_status"] + tags?: string[] title?: string type?: Database["public"]["Enums"]["post_type"] updated_at?: string @@ -350,13 +338,6 @@ export type Database = { referencedRelation: "pages" referencedColumns: ["id"] }, - { - foreignKeyName: "posts_user_id_fkey" - columns: ["user_id"] - isOneToOne: false - referencedRelation: "users" - referencedColumns: ["id"] - }, ] } users: { @@ -384,15 +365,7 @@ export type Database = { stripe_subscription?: Json | null stripe_subscription_id?: string | null } - Relationships: [ - { - foreignKeyName: "users_id_fkey" - columns: ["id"] - isOneToOne: true - referencedRelation: "users" - referencedColumns: ["id"] - }, - ] + Relationships: [] } } Views: { @@ -548,3 +521,18 @@ export type Enums< : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] ? PublicSchema["Enums"][PublicEnumNameOrOptions] : never + +export type CompositeTypes< + PublicCompositeTypeNameOrOptions extends + | keyof PublicSchema["CompositeTypes"] + | { schema: keyof Database }, + CompositeTypeName extends PublicCompositeTypeNameOrOptions extends { + schema: keyof Database + } + ? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] + : never = never, +> = PublicCompositeTypeNameOrOptions extends { schema: keyof Database } + ? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] + : PublicCompositeTypeNameOrOptions extends keyof PublicSchema["CompositeTypes"] + ? PublicSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] + : never