From 5e1992e74a7a7cbaca89f8d16f7f9c735ab6fade Mon Sep 17 00:00:00 2001 From: Isaiah Hamilton Date: Mon, 24 Jan 2022 16:25:46 -0500 Subject: [PATCH 1/8] docs: migrate storage objects --- web/docs/guides/database.mdx | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/web/docs/guides/database.mdx b/web/docs/guides/database.mdx index ba024cf68fa..65f0e041a0f 100644 --- a/web/docs/guides/database.mdx +++ b/web/docs/guides/database.mdx @@ -138,6 +138,73 @@ Migrating projects can be achieved using standard PostgreSQL tooling. This is pa 6. Run `TRUNCATE storage.objects` in the *new* project's SQL editor 7. Run `ALTER ROLE postgres NOSUPERUSER` in the *new* project's SQL editor +#### Migrate storage objects + +This script moves storage objects from one project to another. If you have more than 10k objects, we can move the objects for you. Just contact us at [support@supabase.io](mailto:support@supabase.io). + +```js +const { createClient } = require("@supabase/supabase-js"); + +const OLD_PROJECT_URL = "https://xxx.supabase.co"; +const OLD_PROJECT_SERVICE_KEY = "old-project-service-key-xxx"; + +const NEW_PROJECT_URL = "https://yyy.supabase.co"; +const NEW_PROJECT_SERVICE_KEY = "new-project-service-key-yyy"; + +(async () => { + const oldSupabaseRestClient = createClient( + OLD_PROJECT_URL, + OLD_PROJECT_SERVICE_KEY, + { schema: "storage" } + ); + const oldSupabaseClient = createClient( + OLD_PROJECT_URL, + OLD_PROJECT_SERVICE_KEY + ); + const newSupabaseClient = createClient( + NEW_PROJECT_URL, + NEW_PROJECT_SERVICE_KEY + ); + + // make sure you update max_rows in postgrest settings if you have a lot of objects + // or paginate here + const { data: oldObjects, error } = await oldSupabaseRestClient + .from("objects") + .select(); + if (error) { + console.log("error getting objects from old bucket"); + throw error; + } + + for (const objectData of oldObjects) { + console.log(`moving ${objectData.id}`); + try { + const { data, error: downloadObjectError } = + await oldSupabaseClient.storage + .from(objectData.bucket_id) + .download(objectData.name); + if (downloadObjectError) { + throw downloadObjectError; + } + + const { _, error: uploadObjectError } = await newSupabaseClient.storage + .from(objectData.bucket_id) + .upload(objectData.name, data, { + upsert: true, + contentType: objectData.metadata.mimetype, + cacheControl: objectData.metadata.cacheControl, + }); + if (uploadObjectError) { + throw uploadObjectError; + } + } catch (err) { + console.log("error moving ", objectData); + console.log(err); + } + } +})(); +``` + #### Caveats - The new project will have the old project's Storage buckets, but not the objects. You will need to migrate Storage objects manually. From 2fb6207ed110e54315987359c948e7ea012d212b Mon Sep 17 00:00:00 2001 From: Hamza <74574779+hamzakat@users.noreply.github.com> Date: Tue, 25 Jan 2022 03:42:13 +0300 Subject: [PATCH 2/8] Fix: RTL and LTR words combinations --- i18n/README.ar.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/i18n/README.ar.md b/i18n/README.ar.md index 4dfffae0192..e330660bffb 100644 --- a/i18n/README.ar.md +++ b/i18n/README.ar.md @@ -41,7 +41,8 @@ ## كيف تعمل (Supabase)؟ -Supabase عبارة عن مجموعة من الأدوات مفتوحة المصدر. نحن نبني ميزات (Firebase) باستخدام أدوات مفتوحة المصدر عالية الجودة تستخدمها الشركات. إذا كانت الأدوات والمجتمعات موجودة ، باستخدام MIT أو Apache 2 أو ترخيص مفتوح مكافئ ، فسنستخدم هذه الأداة وندعمها. إذا لم تكن الأداة موجودة ، فإننا نبنيها ونفتح مصدرها بأنفسنا. (Supabase) ليس تعيين 1 إلى 1 لـ(Firebase). هدفنا هو منح المطورين تجربة مطور تشبه (Firebase) باستخدام أدوات مفتوحة المصدر. + Supabase عبارة عن مجموعة من الأدوات مفتوحة المصدر. نحن نبني ميزات Firebase باستخدام أدوات مفتوحة المصدر عالية الجودة تستخدمها الشركات. إذا كانت الأدوات والمجتمعات موجودة ، باستخدام MIT أوApache 2 أو ترخيص مفتوح مكافئ ، فسنستخدم هذه الأداة وندعمها. إذا لم تكن الأداة موجودة ، فإننا نبنيها ونفتح مصدرها بأنفسنا. Supabase ليس تعيين 1 إلى 1 لـFirebase. هدفنا هو منح المطورين تجربة مطور تشبه Firebase باستخدام أدوات مفتوحة المصدر. + **الهيكلة الحالية** From 1084cf1c1175df55929339084ed3dbcac670cdfc Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Wed, 26 Jan 2022 01:10:55 +0800 Subject: [PATCH 3/8] split up tests to reduce flakiness --- studio/tests/pages/projects/LogPanel.test.js | 36 +++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/studio/tests/pages/projects/LogPanel.test.js b/studio/tests/pages/projects/LogPanel.test.js index b707a7303c0..581ec8605df 100644 --- a/studio/tests/pages/projects/LogPanel.test.js +++ b/studio/tests/pages/projects/LogPanel.test.js @@ -72,17 +72,28 @@ test('timestamp from filter default value', async () => { render() userEvent.click(await screen.findByText('Custom')) await screen.findByDisplayValue('2022-01-18T10:43:39+0000') -}) -test('timestamp from filter', async () => { - const mockFn = jest.fn() - render() - const dropdown = await screen.findByText(/Now/) - - // click the dropdown - userEvent.click(dropdown) - // TODO: use screen.findByLabelText when https://github.com/supabase/ui/issues/310 is resolved await screen.findByText('From') + await screen.findByTitle('Reset') +}) + +test('timestamp from filter error handling', async () => { + const mockFn = jest.fn() + render() + userEvent.click(await screen.findByText(/Now/)) + + // display iso timestamp + const year = new Date().getFullYear() + const input = await screen.findByDisplayValue(RegExp(year)) + userEvent.clear(input) + userEvent.type(input, '123456') + await screen.findByText(/[iI]nvalid ISO 8601 timestamp/) +}) + +test('timestamp from filter value change', async () => { + const mockFn = jest.fn() + render() + userEvent.click(await screen.findByText(/Now/)) // display iso timestamp const year = new Date().getFullYear() const input = await screen.findByDisplayValue(RegExp(year)) @@ -90,19 +101,12 @@ test('timestamp from filter', async () => { // replace the input's value userEvent.clear(input) - // type some random input to check for error handling - userEvent.type(input, '123456') - await screen.findByText(/[iI]nvalid ISO 8601 timestamp/) - userEvent.clear(input) - await expect(screen.findByText(/[iI]nvalid ISO 8601 timestamp/)).rejects.toThrow() - // get time 20 mins before const newDate = new Date() newDate.setMinutes(new Date().getMinutes() - 20) userEvent.type(input, newDate.toISOString()) // input actions - await screen.findByTitle('Reset') const set = await screen.findByRole('button', { name: 'Set' }) userEvent.click(set) From a0e21e4f406464e1880a7a3b18a107ae90cacb47 Mon Sep 17 00:00:00 2001 From: "Mohamed A. Salah" Date: Wed, 26 Jan 2022 11:20:20 +0200 Subject: [PATCH 4/8] =?UTF-8?q?fix=20typo=20it's=20more=20like=20"=D9=8A?= =?UTF-8?q?=D8=B9=D9=85=D9=84"=20than=20"=D8=AA=D8=B9=D9=85=D9=84"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/README.ar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/README.ar.md b/i18n/README.ar.md index 4dfffae0192..5d16a996cba 100644 --- a/i18n/README.ar.md +++ b/i18n/README.ar.md @@ -39,7 +39,7 @@ Watch this repo -## كيف تعمل (Supabase)؟ +## كيف يعمل (Supabase)؟ Supabase عبارة عن مجموعة من الأدوات مفتوحة المصدر. نحن نبني ميزات (Firebase) باستخدام أدوات مفتوحة المصدر عالية الجودة تستخدمها الشركات. إذا كانت الأدوات والمجتمعات موجودة ، باستخدام MIT أو Apache 2 أو ترخيص مفتوح مكافئ ، فسنستخدم هذه الأداة وندعمها. إذا لم تكن الأداة موجودة ، فإننا نبنيها ونفتح مصدرها بأنفسنا. (Supabase) ليس تعيين 1 إلى 1 لـ(Firebase). هدفنا هو منح المطورين تجربة مطور تشبه (Firebase) باستخدام أدوات مفتوحة المصدر. From cb8aa5fa2cdfc89fee140024e867c24d06d678d6 Mon Sep 17 00:00:00 2001 From: "Mohamed A. Salah" Date: Wed, 26 Jan 2022 11:27:40 +0200 Subject: [PATCH 5/8] =?UTF-8?q?fix=20typo,=20there=20no=20such=20thing=20c?= =?UTF-8?q?alled=20"=D9=85=D9=86=D8=AF=D9=8A"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/README.ar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/README.ar.md b/i18n/README.ar.md index 4dfffae0192..17470f3d9c2 100644 --- a/i18n/README.ar.md +++ b/i18n/README.ar.md @@ -24,7 +24,7 @@ ## المجتمع والدعم -- [مندى المجتمع](https://github.com/supabase/supabase/discussions). الأفضل لـ: المساعدة في البناء، والنقاش حول أفضل ممارسات قاعدة البيانات. +- [منتدى المجتمع](https://github.com/supabase/supabase/discussions). الأفضل لـ: المساعدة في البناء، والنقاش حول أفضل ممارسات قاعدة البيانات. - [مشاكل GitHub](https://github.com/supabase/supabase/issues). الأفضل لـ: المشاكل والأخطاء التي تواجهها عند استخدامك لـ(Supabase). - [دعم البريد الإلكتروني](https://supabase.com/docs/support#business-support). الأفضل لـ: مشاكل مع قاعدة بياناتك أو البنية التحتية. From 129d0bb61d41950bc0ff8bafb11816183a910b94 Mon Sep 17 00:00:00 2001 From: asyncxco <98457265+asyncxco@users.noreply.github.com> Date: Wed, 26 Jan 2022 19:10:44 +0800 Subject: [PATCH 6/8] Update with-expo.mdx --- web/docs/guides/with-expo.mdx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/web/docs/guides/with-expo.mdx b/web/docs/guides/with-expo.mdx index 62bab155081..c0eeb3e2dce 100644 --- a/web/docs/guides/with-expo.mdx +++ b/web/docs/guides/with-expo.mdx @@ -154,10 +154,12 @@ expo init supabaseReactNative cd supabaseReactNative ``` -Then let's install the only additional dependency: [supabase-js](https://github.com/supabase/supabase-js) +Then let's install the additional dependencies: [supabase-js](https://github.com/supabase/supabase-js) ```bash yarn add @supabase/supabase-js +yarn add react-native-elements +yarn add react-native-safe-area-context ``` Now let's create a helper file to initialize the Supabase client. @@ -182,7 +184,7 @@ We'll use Magic Links, so users can sign in with their email without using passw ```jsx title="components/Auth.js" import React, {useState} from 'react' import {Alert, StyleSheet, View} from 'react-native' -import {supabaseClient} from '../lib/initSupabase' +import {supabase} from '../lib/supabase' import {Button, Input} from 'react-native-elements' export default function Auth() { @@ -267,7 +269,7 @@ Let's create a new component for that called `Account.js`. ```jsx title="components/Account.js" import { useState, useEffect } from 'react' -import { supabase } from '../utils/supabaseClient' +import { supabase } from '../utils/supabase' import {StyleSheet, View} from 'react-native' import {Button, Input} from 'react-native-elements' @@ -386,10 +388,10 @@ Now that we have all the components in place, let's update `app.js`: ```jsx title="app.js" import { useState, useEffect } from 'react' -import { supabase } from './lib/supabaseClient' +import { supabase } from './lib/supabase' import Auth from './components/Auth' import Account from './components/Account' -import View from 'react-native' +import { View } from 'react-native' export default function App() { const [session, setSession] = useState(null) From 5c3ef8ec7d5c9693bc6aef077f299009d83035db Mon Sep 17 00:00:00 2001 From: "Mohamed A. Salah" Date: Wed, 26 Jan 2022 21:22:52 +0200 Subject: [PATCH 7/8] add transelation of discord in the community and support section. --- i18n/README.ar.md | 1 + 1 file changed, 1 insertion(+) diff --git a/i18n/README.ar.md b/i18n/README.ar.md index 27e89c492d1..50aa8043080 100644 --- a/i18n/README.ar.md +++ b/i18n/README.ar.md @@ -27,6 +27,7 @@ - [مندى المجتمع](https://github.com/supabase/supabase/discussions). الأفضل لـ: المساعدة في البناء، والنقاش حول أفضل ممارسات قاعدة البيانات. - [مشاكل GitHub](https://github.com/supabase/supabase/issues). الأفضل لـ: المشاكل والأخطاء التي تواجهها عند استخدامك لـ(Supabase). - [دعم البريد الإلكتروني](https://supabase.com/docs/support#business-support). الأفضل لـ: مشاكل مع قاعدة بياناتك أو البنية التحتية. +- [ديسكورد](https://discord.supabase.com/). الأفضل لـ: مشاركة التطبيقات الخاصه بك وقضاء بعض الوقت مع المجتمع. ## الحالة From dec01f9bac281f858861c0a159aa8a0b16ac2a6f Mon Sep 17 00:00:00 2001 From: Mohamed Date: Thu, 27 Jan 2022 01:03:37 +0200 Subject: [PATCH 8/8] add discord to community and support section --- i18n/README.ar.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/i18n/README.ar.md b/i18n/README.ar.md index 50aa8043080..d65d540e37a 100644 --- a/i18n/README.ar.md +++ b/i18n/README.ar.md @@ -24,7 +24,7 @@ ## المجتمع والدعم -- [مندى المجتمع](https://github.com/supabase/supabase/discussions). الأفضل لـ: المساعدة في البناء، والنقاش حول أفضل ممارسات قاعدة البيانات. +- [منتدى المجتمع](https://github.com/supabase/supabase/discussions). الأفضل لـ: المساعدة في البناء، والنقاش حول أفضل ممارسات قاعدة البيانات. - [مشاكل GitHub](https://github.com/supabase/supabase/issues). الأفضل لـ: المشاكل والأخطاء التي تواجهها عند استخدامك لـ(Supabase). - [دعم البريد الإلكتروني](https://supabase.com/docs/support#business-support). الأفضل لـ: مشاكل مع قاعدة بياناتك أو البنية التحتية. - [ديسكورد](https://discord.supabase.com/). الأفضل لـ: مشاركة التطبيقات الخاصه بك وقضاء بعض الوقت مع المجتمع. @@ -42,8 +42,7 @@ ## كيف يعمل (Supabase)؟ - Supabase عبارة عن مجموعة من الأدوات مفتوحة المصدر. نحن نبني ميزات Firebase باستخدام أدوات مفتوحة المصدر عالية الجودة تستخدمها الشركات. إذا كانت الأدوات والمجتمعات موجودة ، باستخدام MIT أوApache 2 أو ترخيص مفتوح مكافئ ، فسنستخدم هذه الأداة وندعمها. إذا لم تكن الأداة موجودة ، فإننا نبنيها ونفتح مصدرها بأنفسنا. Supabase ليس تعيين 1 إلى 1 لـFirebase. هدفنا هو منح المطورين تجربة مطور تشبه Firebase باستخدام أدوات مفتوحة المصدر. - +Supabase عبارة عن مجموعة من الأدوات مفتوحة المصدر. نحن نبني ميزات (Firebase) باستخدام أدوات مفتوحة المصدر عالية الجودة تستخدمها الشركات. إذا كانت الأدوات والمجتمعات موجودة ، باستخدام MIT أو Apache 2 أو ترخيص مفتوح مكافئ ، فسنستخدم هذه الأداة وندعمها. إذا لم تكن الأداة موجودة ، فإننا نبنيها ونفتح مصدرها بأنفسنا. (Supabase) ليس تعيين 1 إلى 1 لـ(Firebase). هدفنا هو منح المطورين تجربة مطور تشبه (Firebase) باستخدام أدوات مفتوحة المصدر. **الهيكلة الحالية**