Update createtabletest.yaml #65
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
name: Create Supabase Table | |
on: | |
push: | |
branches: | |
- test_table_script | |
jobs: | |
create-supabase-table: | |
runs-on: ubuntu-latest | |
env: | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} | |
SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }} | |
PROJECT_ID: "oecrkeanazdxowjcpjqr" | |
SUPABASE_API_URL: "https://oecrkeanazdxowjcpjqr.supabase.co" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
- name: Set up Supabase CLI | |
uses: supabase/setup-cli@v1 | |
with: | |
version: latest | |
- name: Init | |
run: supabase init | |
- name: Start local | |
run: supabase start | |
- name: Reset | |
run: supabase db reset | |
- name: Configure Supabase | |
run: supabase link --project-ref $PROJECT_ID | |
- name: Add Columns to Supabase Table | |
run: | | |
# Define the JSON payload for adding columns | |
TABLEDEF='{ | |
"name": "reform_map_data", | |
"columns": [ | |
{ | |
"name": "new_column_name_1", | |
"type": "text" | |
}, | |
{ | |
"name": "new_column_name_2", | |
"type": "integer" | |
} | |
] | |
}' | |
# Make an HTTP POST request to Supabase API to add columns | |
curl -X POST -H "Content-Type: application/json" -H "apikey: $SUPABASE_API_KEY" -d "$TABLEDEF" "$SUPABASE_API_URL/rest/v1/tables" | |
# - name: Create Supabase Table | |
# run: | | |
# TABLE_DEFINITION='[ | |
# { | |
# "name": "reform_map_data", | |
# "columns": [ | |
# { | |
# "name": "id", | |
# "type": "integer", | |
# "primary": true | |
# } | |
# ] | |
# } | |
# ]' | |
# curl -X POST -H "Content-Type: application/json" -H "apikey: $SUPABASE_API_KEY" -d "$TABLE_DEFINITION" "https://oecrkeanazdxowjcpjqr.supabase.co/rest/v1/tables" |