Skip to content

Commit bbcaab5

Browse files
authored
Integrations II (#37)
* Add GitHub integration * Add Gemini integration (setup + howto) * Add Google Analytics integration * Add Mux Livestream docs * Add Mux Livestream images * Add One Signal notification docs * Add Deep Dynamic Linking docs * Add Push Notifications docs * Add Supabase Auth docs * Move old docs of Firestore (in progress) * Add all docs of Firestore * Add all docs of Firestore * Add supabase & sqlite
1 parent f973695 commit bbcaab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1878
-1
lines changed

docs/Integrations/authentication/types/supabase-auth/initial-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To use authentication, you will need to complete the following initial setup:
99

1010

1111
:::info[Prerequisites]
12-
Before you begin, make sure you have completed the [Supabase setup](/data-and-backend/supabase/supabase-setup).
12+
Before you begin, make sure you have completed the [**Supabase setup**](/data-and-backend/supabase/supabase-setup).
1313
:::
1414

1515
### 1. Creating a "users" table
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
---
2+
title: Database Actions
3+
toc_max_heading_level: 5
4+
5+
---
6+
7+
# Supabase Database Actions
8+
9+
The Supabase Database Actions allow you to **Insert, Update**, or **Delete a Row** from a Supabase table.
10+
11+
:::note[Prerequisites]
12+
Before getting started with this section, ensure you have,
13+
14+
1. Completed all steps in the [**Supabase setup**](..%2F..%2Fsupabase%2Fsupabase-setup.md)
15+
2. Ensure you have a table created for adding, updating, and deleting data.
16+
:::
17+
18+
19+
## Types of Supabase Database Actions
20+
21+
Following are the types of actions you can perform on a Supabase table.
22+
23+
- [**Insert Row**](#insert-row-action): Adds a new row in a table.
24+
- [**Update Row**](#update-row-action)**:** Updates a row with the specified values.
25+
- [**Delete Row**](#delete-row-action)**:** Deletes a row from a table.
26+
- [**Query Rows**](#query-rows-action): Retrieves
27+
rows from a table based on specific criteria or conditions.
28+
29+
### Insert Row [Action]
30+
31+
1. Select the **Widget** (e.g., Button) on which you want to define the action.
32+
5. Select **Actions** from the Properties Panel (the right menu), and click **Open**. This will
33+
open an **Action Flow Editor** in a new popup window.
34+
35+
1. Click on **+ Add Action**.
36+
5. On the right side, search and select the **Supabase** > **Insert Row** action.
37+
8. Set the **Table** to your table name (e.g., assignments).
38+
11. Under the **Set Fields** section, click on the **+ Add Field** button.
39+
14. Click on the Field name.
40+
41+
1. Scroll down to find the **Value Source** dropdown and change it to **From Variable**.
42+
5. Click on **UNSET** and select **Widget State > Name** of the TextField.
43+
17. Similarly, add the field for the other UI elements.
44+
45+
:::tip[Pro Tip]
46+
While adding this action, you can leave the **id** (if marked as *Primary*) and
47+
**created_at** (if default value is `now()`) fields. Supabase will automatically add values for these fields.
48+
:::
49+
50+
<div class="video-container"><iframe src="https://www.loom.
51+
com/embed/f2a75f9b0e144f6aab06cc1f0965541b?sid=6f57ff8a-ca2a-4c47-833d-03fa928b8301" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
52+
53+
54+
55+
### Update Row [Action]
56+
57+
1. Select the **Widget** (e.g., Button) on which you want to define the action.
58+
5. Select **Actions** from the Properties Panel (the right menu), and click **Open**. This will
59+
open an **Action Flow Editor** in a new popup window.
60+
61+
1. Click on **+ Add Action**.
62+
5. On the right side, search and select the **Supabase** > **Update Row** action.
63+
8. Set the **Table** to your table name (e.g., assignments).
64+
11. Optional: If you want to get the rows after the update is finished, enable the **Return Matching Rows** option.
65+
14. Now, you must set the row you want to update. Usually, this is done by finding a row in a table that matches the current row ID. To do so, click **+ Add Filter** button inside the **Matching Rows** section.
66+
67+
1. Set the **Field Name** to the field that contains the IDs. Typically, this is the
68+
**id** column.
69+
5. Set the **Relation** to **Equal To** because you want to find a row with the exact id.
70+
8. Into the **Value Source**, you can select the **From Variable** and provide the id of the row for which you just updated values in the UI.
71+
17. Under the **Set Fields** section, click on the **+ Add Field** button.
72+
20. Click on the Field Name.
73+
74+
1. Scroll down to find the **Value Source** dropdown and change it to **From Variable**.
75+
5. Click on **UNSET** and select **Widget State > Name** of the TextField.
76+
23. Similarly, add the field for the other UI elements.
77+
78+
79+
80+
81+
82+
:::tip[How to & Tips]
83+
84+
<div class="video-container"><iframe src="https://www.loom.
85+
com/embed/08cb8a851350428bbc226f2e7ce9d2b3?sid=b3d097cf-6f84-4f69-893a-3a363cbf7143" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
86+
87+
<p></p>
88+
If you have a flow like this, *HomePage* -> *AssignmentDetailsPage* ->
89+
*UpdateAssignmentPage*, you can enable the **Replace Route** option (see point no. 5 [here](/actions/actions/navigation/navigate)) when you navigate from *AssignmentDetailsPage* to *UpdateAssignmentPage*. And then chain the [Navigate Back](/actions/actions/navigation/navigate-back#adding-navigate-back-action) action after the update action. This will directly open the *HomePage* after the row is updated.
90+
:::
91+
92+
93+
94+
### Delete Row [Action]
95+
96+
Go to your project page on FlutterFlow and follow the steps below to define the Action to any widget.
97+
98+
1. Select the **Widget** (e.g., Button) on which you want to define the action.
99+
5. Select **Actions** from the Properties panel (the right menu), and click **Open**. This will open an **Action Flow Editor** in a new popup window.
100+
101+
1. Click on **+ Add Action**.
102+
5. On the right side, search and select the **Supabase** -> **Delete Row** action.
103+
8. Set the **Table** to your table name (e.g., assignments).
104+
11. Optional: If you want to know which rows were deleted from a table, enable the **Return
105+
Matching Rows** option.
106+
14. Now, you must set the row you want to delete. Usually, this is done by finding a row in a table that matches the current row ID. To do so, click **+ Add Filter** button inside the **Matching Rows** section.
107+
108+
1. Set the **Field Name** to the field that contains the IDs. Typically, this is the
109+
**id** column.
110+
5. Set the **Relation** to **Equal To** because you want to find a row with the exact id.
111+
8. Into the **Value Source**, you can select the **From Variable** and provide the id of the row you want to delete.
112+
113+
<div class="video-container"><iframe src="https://www.loom.
114+
com/embed/309e0e40832146df8909c2e533e9b11e?sid=34f4ba89-cc53-47c3-8b8d-8859c03a0f6f" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
115+
116+
<p></p>
117+
:::tip
118+
119+
You can chain the [**Refresh Database Request**](../refresh-db-request.md) action after this action to remove the
120+
deleted items from the list.
121+
122+
:::
123+
124+
### Query Rows [Action]
125+
126+
There are certain scenarios where you may want to query a Supabase table manually. For example, you might want to only fetch data in response to a specific user action, such as clicking on a button.
127+
128+
Additionally, if your app fetches different data under different conditions, you might find it more convenient to manually call queries. For example, you might fetch different tasks for admin and team members.
129+
130+
To manually query a Supabase table, follow the steps below to define this action to any widget:
131+
132+
1. Select the **Widget** (e.g., Button) on which you want to define the action.
133+
134+
5. Select **Actions** from the Properties panel (the right menu), and click **Open**. This will open an **Action Flow Editor** in a new popup window.
135+
8. Click on **+ Add Action**.
136+
11. On the right side, search and select the **Supabase** > **Query Rows** action.
137+
14. Select the **Table** you want to query.
138+
17. You can also [Filter](#filtering-table-data) and [Order](#ordering-table-data) the query results.
139+
20. Provide the **Action Output Variable Name**. This will be used to store the query result.
140+
141+
<p></p>
142+
143+
<div class="video-container"><iframe src="https://www.loom.
144+
com/embed/99f47689b5b147678ed197c6ea0facf6?sid=615f2ecf-c8d0-4124-b2fa-ca9798893c92" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
145+
146+
<p></p>
147+
148+
149+
8. Now, you can use the **Action Output Variable Name** provided in the previous step to generate
150+
children from a variable on [ListView](/widgets-and-components/widgets/layout-elements/listview).
151+
5. Finally, you can display data in a [Text](/widgets-and-components/widgets/base-elements/text) widget. To do so, select the **Text widget > Properties Panel > Text > Set from Variable menu > ***[children\_from\_variable\_name]*** item > Get Row Field > select the row field** you want to display.
152+
153+
<div class="video-container"><iframe src="https://www.loom.
154+
com/embed/d30acf8e4451459689b0d295b87bb5f9?sid=9a4f5aec-59ef-4fa3-9e76-0de72e75f278" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
155+
156+
157+
#### Filtering table data
158+
Sometimes you might want to filter a list based on a condition. For example, showing only
159+
completed assignments. You can do so by adding the Filter while you query a Supabase table.
160+
161+
Let's see how to filter the Supabase table to display only desired items:
162+
163+
- In your **Action properties** of Query Rows action, scroll down and click on the **+ Add Filter**
164+
button at the bottom.
165+
166+
- Find the **Field Name**, click on the Unset, and select a column on which you would like to apply
167+
the filter.
168+
- Find the **Relation** dropdown, click on the Unset, and choose the relation amongst the list.
169+
- Find the **Value** property and set it to an appropriate value and click Confirm.
170+
171+
:::tip
172+
You could choose a Filter relation based on your requirements. For example, to show only completed assignments, set the Field Name to the column that holds completed status, e.g., is_done, set the Relation to Equal To, and set the Value to True. Here's another example. For showing only users older than 30, create a column called Age, set the Relation to Greater Than, and set the Value to 30.
173+
:::
174+
175+
<div class="video-container"><iframe src="https://www.loom.
176+
com/embed/b5a62eac1f5d4d9698d30b064c395326?sid=4e8c4972-7fac-4c9b-b495-c9f0cb783717" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
177+
178+
179+
#### Ordering table data
180+
You might want to show a list from the Supabase table in a specific order. For example, showing assignments in order of the due date.
181+
182+
To specify the order:
183+
184+
- In your **Action properties** of Query Rows action, scroll down and click on the **+ Add Order**
185+
button at the bottom.
186+
- Set the **Table Field Name** to the column you would like to choose for ordering.
187+
- Find **Order** dropdown, click on the Unset and choose the order either **Increasing** or **Decreasing** and
188+
click **Confirm**.
189+
190+
:::tip
191+
You could choose the order based on your requirements. For example, to show assignments in order of due date, set Table Field Name to due_date and Order to Increasing.
192+
:::
193+
194+
<div class="video-container"><iframe src="https://www.loom.
195+
com/embed/244eea2a4f694120b08524b7b8cf67de?sid=13d47ef5-5d48-4986-88da-d335ce23bd06" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
196+
197+
198+
199+
200+
201+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"label": "Database"
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Cloud Firestore",
3+
"position": 1
4+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# Creating Collections
6+
7+
A collection is a group of documents. For example, you could have a 'users*'* collection that contains a list of documents, each representing a single user.
8+
9+
<figure>
10+
![img_20.png](img_20.png)
11+
<figcaption class="centered-caption">User collection document model</figcaption>
12+
</figure>
13+
14+
:::info[Getting Started: Things to Know First]
15+
16+
- Get to know how to [**structure the Firebase Database**](getting-started.md#structuring-the-database).
17+
- Ensure you've gone through and completed every step in the [**Firebase Setup**](../../firebase/connect-to-firebase-setup.md)
18+
for your project.
19+
:::
20+
21+
## Creating a collection
22+
23+
Here are the steps to create a collection:
24+
25+
2. Click on the **Firestore** from the Navigation Menu (left side of your screen).
26+
27+
5. Click on the **(+)** Plus sign button.
28+
8. A popup will appear, Enter the collection name and click **Create** Button.
29+
11. Next, [define the collection schema](#define-schema-creating-fields) (create Fields) and
30+
[add some data](firestore-actions.md#create-document-action) to the collection.
31+
32+
:::info
33+
A collection will only appear on [**Firebase Console**](https://console.firebase.google.com/u/0/) if it contains at least one document.
34+
:::
35+
36+
<div class="video-container"><iframe src="https://www.loom.
37+
com/embed/14d7680203494e2bbbffef58535a6499?sid=6a4620bc-0195-4c24-93b3-e5bcd9fd4c94" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
38+
39+
40+
41+
### Define Schema (Creating Fields)
42+
43+
A document represents a single item or entity, such as a user, post, animal, etc. To add data inside the document, you must define the document schema by creating Fields. Creating Fields helps you know what kind of data a document can contain.
44+
45+
Although you can add more fields later on, it's always a good idea to add fields from the start.
46+
47+
:::caution
48+
Field names cannot be changed, so ensure that you have used the correct Field names.
49+
:::
50+
51+
To define the schema (create fields) for the document:
52+
53+
1. Select your collection from the list on the left side.
54+
5. If you haven't added any fields yet:
55+
56+
1. You can choose from the template collections that have common fields needed in most
57+
applications. This will auto-add all the fields.
58+
5. Click on **Start from scratch** to define your own schema.
59+
8. Or, use [AI Gen Schema](#create-schema-using-ai-gen).
60+
8. To add a new field, start typing its name (e.g., title, description, date, etc.) and choose the suitable **Data Type**.
61+
11. While choosing the Data Type, you can set if it will be a list or not using **Is List?** toggle.
62+
63+
1. You can keep it disabled for storing only a single value. For example, fields such as title,
64+
description, price, etc., can have only one value. You can't have multiple titles for a single post.
65+
5. You can enable it to store multiple values of the same data type. For example, to store the list of accessory names for the field accessories.
66+
14. Click on the **Done** icon.
67+
68+
:::tip
69+
You can also use *Tab* and *Enter* keys to navigate quickly while creating fields.
70+
:::
71+
72+
<div class="video-container"><iframe src="https://www.loom.
73+
com/embed/7e7f80567cae477fbf97d937a76c4042?sid=84cbccd3-d084-4f9c-8dae-eff833cd2310" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
74+
75+
76+
### Create schema using AI Gen
77+
78+
With **AI Gen Schema**, you can automatically generate a schema for your Firebase collection from a
79+
simple prompt.
80+
81+
:::tip[To get better results...]
82+
...you can try optimizing your prompt. i.e., make it more descriptive.
83+
:::
84+
85+
Example prompts:
86+
87+
- Generate a collection for books, their reviews, and their purchase history.
88+
- Create a database schema for music albums, their ratings, and sales records.
89+
- Generate a collection for video games, their user reviews, and purchase history.
90+
- Create a collection for art exhibits, visitor reviews, and ticket bookings.
91+
- Generate a collection for online courses, student feedback, and enrollment records.
92+
93+
<div class="video-container"><iframe src="https://www.loom.
94+
com/embed/f3a3c7ad69194342926f83036f07b243?sid=e4ed8f7c-6465-42c3-a46e-0e80a4d1e202" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
95+
96+
97+
---
98+
99+
100+
:::note
101+
To learn more about custom data types within FlutterFlow, [check this doc](../../../resources/data-representation/data-types#built-in-data-types)

0 commit comments

Comments
 (0)