Skip to content

Commit

Permalink
Migration post tasks (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-8 authored Feb 27, 2025
1 parent cb8fc16 commit a7a7bb7
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 181 deletions.
3 changes: 1 addition & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default antfu(
{
ignores: [
'**/.svelte-kit**',
'**/functions/lib/**',
'.eslintcache',
'packages/scripts/import/old**',
'**/route/kitbook/**',
Expand Down Expand Up @@ -83,7 +82,7 @@ export default antfu(
},
{
name: 'ld/script-exceptions',
files: ['packages/{scripts,functions}/**'],
files: ['packages/scripts/**'],
rules: {
'no-console': 'off',
'ts/no-unused-vars': 'off',
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"scripts": {
"dev": "pnpm --filter=site dev",
"prod": "pnpm --filter=site prod",
"mixed": "pnpm --filter=site mixed",
"dev:open": "pnpm --filter=site dev --open",
"build": "pnpm --filter=site build",
"preview": "pnpm --filter=site preview",
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/config-supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import './record-logs'
import { S3Client } from '@aws-sdk/client-s3'

program
.option('-e, --environment [dev/prod]', 'Firebase/Supabase Project', 'dev')
.option('-e, --environment [dev/prod]', 'Supabase Project', 'dev')
.allowUnknownOption() // because config is shared by multiple scripts
.parse(process.argv)

Expand Down
5 changes: 1 addition & 4 deletions packages/scripts/migrate-to-supabase/notes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Final Migration cleanup
- use line-clamp instead of truncateString in SelectedDict.svelte and also look at inline-children-elements purpose
- show entry history from pop-up entry modal
- test admin rls, alternative is auth.jwt() read https://supabase.com/docs/guides/database/postgres/row-level-security#authjwt to see if better
- Diego: AuthModal.svelte translations
- review updated_by triggers across all tables
- review created_by forcers to see which tables need set_created_by
- audio_speakers
- dictionary_info
Expand All @@ -11,12 +11,9 @@
- invites
- sense_photos
- remove Entry History i18n
- remove firebase vercel credentials
- remove import_meta from content update endpoint
- remove firebase in SQL
- remove unneeded urls from https://console.cloud.google.com/auth/clients/215143435444-fugm4gpav71r3l89n6i0iath4m436qnv.apps.googleusercontent.com?inv=1&invt=AboyXQ&project=talking-dictionaries-alpha
- move featured images to photos table and make a connection to the dictionary
- use line-clamp instead of truncateString in SelectedDict.svelte and also look at inline-children-elements purpose
- delete dev Firebase project and create new gcs dev bucket
- adjust user migration to set these fields to empty strings and not null to avoid db errors: `confirmation_token`, `recovery_token`, `email_change_token_new`, `email_change`

Expand Down
36 changes: 0 additions & 36 deletions packages/scripts/refactor/get-email.ts

This file was deleted.

109 changes: 0 additions & 109 deletions packages/scripts/refactor/move-firestore-document.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"scripts": {
"dev": "vite dev",
"prod": "vite dev --mode production",
"mixed": "vite dev --mode mixed",
"build": "vite build",
"preview": "vite preview",
"sync": "svelte-kit sync",
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/docs/misc/media-urls.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Media Urls for exporting

Audio urls are made by taking the path string, converting `/` to `%2F` and then plugging the `convertedPath` into
Audio urls are made by taking the path string, converting `/` to `%2F` and then plugging the `convertedPath` into
```
https://firebasestorage.googleapis.com/v0/b/${firebaseConfig.storageBucket}/o/${convertedPath}?alt=media
```
Expand All @@ -9,5 +9,5 @@ resulting in something like https://firebasestorage.googleapis.com/v0/b/talking-
Photo urls are formed by the path and plugging it into the path below to come up with something like https://firebasestorage.googleapis.com/v0/b/talking-dictionaries-alpha.appspot.com/o/images%2Fmandarin-practice%2FmogAtD3lTCtkuwj7tLDD_1630105898118.jpg?alt=media

```
https://firebasestorage.googleapis.com/v0/b/${firebaseConfig.storageBucket}/o/${convertedPath}?alt=media
https://firebasestorage.googleapis.com/v0/b/${storageBucket}/o/${convertedPath}?alt=media
```
2 changes: 1 addition & 1 deletion packages/site/src/routes/admin/dictionaries/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</Button>
</div>
<div class="mb-1" />
<ResponsiveTable class="" stickyHeading stickyColumn>
<ResponsiveTable stickyHeading stickyColumn>
<SortDictionaries dictionaries={filteredDictionaries} let:sortedDictionaries>
{#each sortedDictionaries as dictionary, index (dictionary.id)}
<IntersectionObserverShared bottom={4000} let:intersecting once>
Expand Down
2 changes: 1 addition & 1 deletion packages/site/src/routes/admin/users/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</Button>
</div>
<div class="mb-1" />
<ResponsiveTable class="" stickyColumn stickyHeading>
<ResponsiveTable stickyColumn stickyHeading>
<SortUsers users={filteredUsers} let:sortedUsers>
{#each sortedUsers as user (user.id)}
<UserRow
Expand Down
23 changes: 0 additions & 23 deletions supabase/ideas/trigger-edge-function.sql
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
CREATE FUNCTION before_apply_content_updates()
RETURNS TRIGGER AS $$
DECLARE
fetched_user_id UUID;
BEGIN
SELECT id INTO fetched_user_id
FROM auth.users
WHERE email = NEW.firebase_email;

IF fetched_user_id IS NOT NULL THEN
NEW.user_id := fetched_user_id;
END IF;

RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER before_apply_content_updates -- will fire before the next trigger because postgres executes triggers in alphabetical order
BEFORE INSERT ON content_updates
FOR EACH ROW
EXECUTE FUNCTION before_apply_content_updates();


-- CREATE EXTENSION IF NOT EXISTS http WITH SCHEMA extensions;
CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions;

Expand Down

0 comments on commit a7a7bb7

Please sign in to comment.