Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refractor Planetscale to Neon #234

Merged
merged 11 commits into from
May 11, 2024
Merged

refractor Planetscale to Neon #234

merged 11 commits into from
May 11, 2024

Conversation

Codehagen
Copy link
Member

@Codehagen Codehagen commented Apr 17, 2024

Description

This Pull Request initiates the migration from PlanetScale to Neon for our database needs. It is currently in draft status and provides initial setup and migration steps.

  1. Create an account at Noen Tech to start using their database services.
  2. Update your local environment with the Neon connection URL in the .env file.
  3. Run pnpm db:push
  4. Confirm that the tables are populated correctly by checking the database through the Neon web interface. You can view the expected results in the following screenshot:
    image

Remaining Tasks:

  • Update so that when a user has signed in, this goes into the database.
  • Update the user login function to adapt to the database structure.
  • Test the new authentication flow.

Optional tasks

  • Enhance the seed.ts script to populate the database with default data necessary for initial testing and setup.

Completion Criteria:

This PR will be considered complete when a user can sign in and their data is verifiably inserted into the database as reflected in the Neon tables.

What type of PR is this? (check all applicable)

  • πŸ’‘ Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Copy link

vercel bot commented Apr 17, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
badget βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback May 11, 2024 9:48am

@Codehagen
Copy link
Member Author

@shouryan01 wanna continue on this? ✨

@Codehagen
Copy link
Member Author

Assigned this to you @shouryan01 - Ok? πŸ”₯

@Codehagen
Copy link
Member Author

We are almost there i think @shouryan01.
When I'm trying to add an asset I get this error:

www:dev: Error in tRPC handler (edge) on path account.addAccount
www:dev:  [TRPCError: column reference "name" is ambiguous] {
www:dev:   code: 'INTERNAL_SERVER_ERROR',
www:dev:   name: 'TRPCError'
www:dev: }

The file is under /packages/api/src/router/account.ts. And I think its a error that has something with this:

      await db.transaction(async (tx) => {
        await tx
          .insert(schema.balance)
          .values({
            accountId: BigInt(accountQuery.insertId),
            currencyIso: createAccountSchema.parse(opts.input).currencyIso,
            amount: createAccountSchema.parse(opts.input).amount ?? 0,
            date: new Date(),
            type: "AVAILABLE",
            originalPayload: createAccountSchema.parse(opts.input),
          })
          .onConflictDoUpdate({
            target: schema.balance.id,
            set: {
              amount: sql`amount`,
              date: sql`date`,
            },
          });

Im getting this error for this function:

No overload matches this call.
  Overload 2 of 2, '(values: { type: SQL<unknown> | "AVAILABLE" | "BOOKED" | "EXPECTED" | Placeholder<string, any>; currencyIso: string | SQL<unknown> | Placeholder<string, any>; ... 7 more ...; accountId?: string | ... 3 more ... | undefined; }[]): PgInsertBase<...>', gave the following error.
    Object literal may only specify known properties, and 'accountId' does not exist in type '{ type: SQL<unknown> | "AVAILABLE" | "BOOKED" | "EXPECTED" | Placeholder<string, any>; currencyIso: string | SQL<unknown> | Placeholder<string, any>; ... 7 more ...; accountId?: string | ... 3 more ... | undefined; }[]'.

@Codehagen
Copy link
Member Author

Hello, tried it and got these errors @shouryan01 :

  1. Pressed Add asset.
  2. Pressed Real Estate
  3. Made up some names and pressed submit

Screenshot 2024-05-09@2x

@Codehagen Codehagen marked this pull request as ready for review May 11, 2024 09:38
@Codehagen Codehagen requested a review from shouryan01 May 11, 2024 09:39
@Codehagen Codehagen assigned Codehagen and unassigned Codehagen May 11, 2024
@Codehagen Codehagen merged commit d41a151 into main May 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants