2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Supabase のWrapper 機能の設定方法 (修正済み)

Last updated at Posted at 2024-03-09

環境

Windows
Supabase のサーバーとローカル両方で確認

Supabase Wrapper

Supabase Wrapperを使ってStripeのデータにSupabaseからアクセスする #SQL - Qiita
https://qiita.com/dshukertjr/items/eb20dc13ec5c313d9dfa

この記事は、↑この記事の修正記事です。

修正箇所

2箇所あります。

エラーの1箇所目は、

SupabaseのWrappers機能を設定する前に。

Postgresのpublicとは別に外部スキーマを作ります。

CREATE SCHEMA Stripe;

↑SupabaseのSQL Editorで実行してください。

※このStripeのスキーマが存在しないと、Wrapperを登録できないのでエラーになるようです。

Wrappersの設定

Supabaseのダッシュボードから

左サイドバーDatabase
Wrappers
Enable 有効化

  • Create a new wrapperボタンを押します。

※ボタンは2つ見えるがどちらでもいい。

Stripeを選んで追加します。

Create a Stripe Wrapper画面が開きます。

Wrapper Configuration

エラーの2箇所目、空白を使わない。

# Wrapper Name
Stripe dev <<<<文字間に空白をいれるとエラーになる
↓
Stripe_dev <<<<文字間に空白を入れない

# Your wrapper's server name will be Stripe dev_server

# Stripe Configuration
# Stripe Secret Key
.env.localファイルから取ってくる
sk_test_51*****VmU


# Stripe API URL
https://api.stripe.com/v1

# Foreign Tables
# You can query your data from these foreign tables after the wrapper is created

# Add foreign tableボタン

↑「Add foreign table」ボタンを押して、「テーブルの数分」設定画面をそのたびに開きます。

# Select a target the table will point to
Subscriptionsを選択

# Select a schema for the foreign table
Stripeを選択 (新規に作りません、作ってもエラーになります。)

# Table name

subscriptions
customers
prices
products

テーブルは↓これだけ作るのを繰り返します。
subscriptions
customers
prices
products

Saveボタンを押します。

これでStripeのWrappersが作成されます。

Stripe設定後.PNG

結果

Wrapperの設定はできたが、このWrapperをどうやって使うかはまだ勉強中なので、この設定でちゃんと使えるかどうかはわからない。

わからないこと

作った外部テーブルの中身は何を設定したらいいかわからない。

今回はSupabaseのWrappers機能を使ってStripeの外部テーブルを作成しただけで、これをどうやって使うのかはまだわからない。

現在は、Wrappersで外部テーブルを作っただけで、この先は未知数

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?