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

[BUG]: Outdated docs #2191

Closed
gzuuus opened this issue Apr 22, 2024 · 5 comments
Closed

[BUG]: Outdated docs #2191

gzuuus opened this issue Apr 22, 2024 · 5 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@gzuuus
Copy link

gzuuus commented Apr 22, 2024

What version of drizzle-orm are you using?

0.28.5

What version of drizzle-kit are you using?

0.19.13

Describe the Bug

Hey I was trying to work with composite primary keys in sqlite but the documentation is out of date and the syntax seems to be wrong as it says columns is not in type SQLiteColumn.
The object literal can only specify known properties, and 'columns' does not exist in the type 'SQLiteColumn<Required<{ name: string; dataType: ColumnDataType; columnType: string; data: unknown; driverParam: unknown; notNull: boolean; hasDefault: boolean; enumValues: string[] | undefined; tableName: string; }>, object>'.

This is the code I'm testing:

(table) => {
  return {
    pk: primaryKey({ columns: [table.bookId, table.authorId] }),
  };
}

Please fix the docs to represent the current way of doing composite primary keys.
I also noticed that the numeric type for sqlite is not listed in the docs, even though it can be used.

Expected behavior

No response

Environment & setup

No response

@gzuuus gzuuus added the bug Something isn't working label Apr 22, 2024
@realmikesolo realmikesolo added the documentation Improvements or additions to documentation label Apr 23, 2024
@realmikesolo
Copy link
Collaborator

Hello @gzuuus! Could you please show your schema? The issue might be caused by something else because docs are updated for composite primary key. I could create composite primary key with this code:

import { integer, primaryKey, sqliteTable } from 'drizzle-orm/sqlite-core';

export const tests = sqliteTable(
  'tests',
  {
    authorId: integer('author_id'),
    bookId: integer('book_id'),
  },
  (t) => ({
    pk: primaryKey({ columns: [t.bookId, t.authorId] }),
  }),
);

@gzuuus
Copy link
Author

gzuuus commented Apr 23, 2024

It seems to be fixed by updating the package, at the moment there is no error, however I have found several parts of the documentation to be out of date, as mentioned in the issue numeric type for sqlite is not listed in the docs, even though it can be used. Also the foreign key example in sqlite uses the deprecated method with the fallback https://orm.drizzle.team/docs/indexes-constraints#foreign-key

@realmikesolo
Copy link
Collaborator

@gzuuus thank you. Docs were fixed. I think there is no numeric in the docs, because it is not a datatype, numeric is an affinity according to SQLite docs

@gzuuus
Copy link
Author

gzuuus commented Apr 30, 2024

I see! In any case, it would be nice to have it documented in the documents so that people know they can use it.

@gzuuus gzuuus closed this as completed Apr 30, 2024
@realmikesolo
Copy link
Collaborator

Agree with you! We will add info about numeric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants