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

Can't sync to a fresh database #63

Open
akatechis opened this issue Oct 18, 2022 · 4 comments
Open

Can't sync to a fresh database #63

akatechis opened this issue Oct 18, 2022 · 4 comments

Comments

@akatechis
Copy link

Following the docs, I'm unable to sync my models to my DB.

I'm starting with a brand new DB, with no tables so I ran denogres --init to bootstrap models in my project.
I created models/UserModel.ts with the following:

export interface User {
  id: string;
  email: string;
  name: string;
  passwordHash: string;
  passwordSalt: string;
}

export class UserModel extends Model {
  static table = 'users';
  static columns = {
    id: { type: 'text', primaryKey: true },
    email: { type: 'text', notNull: true },
    name: { type: 'text' },
    passwordHash: { type: 'text', notNull: true },
    passwordSalt: { type: 'text', notNull: true, length: 32 },
  }
}

and then re-export that model in models/model.ts:

export { UserModel } from './UserModel.ts';

Finally, I run denogres --db-sync to create the users table with all the appropriate columns, but I simply get the following error:

> denogres --db-sync
To avoid all potential prompts, please consider running your command with the -x flag.
Sending fatal alert BadCertificate
TLS connection failed with message: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
Defaulting to non-encrypted connection
error: Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'application_name')
        tableListObj[el.table_name][el.column_name] = {
                                                   ^
    at https://deno.land/x/[email protected]/src/functions/introspect.ts:153:52
    at Array.forEach (<anonymous>)
    at introspect (https://deno.land/x/[email protected]/src/functions/introspect.ts:144:14)
    at async sync (https://deno.land/x/[email protected]/src/functions/sync.ts:30:22)

I'm importing from https://deno.land/x/[email protected]/mod.ts, and deno --version prints the following:

> deno --version
deno 1.23.4 (release, x86_64-pc-windows-msvc)
v8 10.4.132.8
typescript 4.7.4
@cjroth
Copy link

cjroth commented Dec 29, 2022

Same error here

@HelloBanksy
Copy link

Did anyone find a solution on this one? 🤔

@nodgear
Copy link

nodgear commented Apr 18, 2023

Same here

@hermesalvesbr
Copy link

Is this project discontinued?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants