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

Unable to update columns which uses @date in model? #1804

Open
homocodian opened this issue Jun 10, 2024 · 0 comments
Open

Unable to update columns which uses @date in model? #1804

homocodian opened this issue Jun 10, 2024 · 0 comments

Comments

@homocodian
Copy link

schema

export const Table = {
  note: {
    name: "note",
    columns: [
      {
        name: "deleted_at",
        type: "string",
        isOptional: true,
        isIndexed: true
      }
    ] satisfies ColumnSchema[]
  }
} as const;

export default appSchema({
  version: 13,
  tables: [
    tableSchema({
      name: Table.note.name,
      columns: Table.note.columns
    })
  ]
});

model

import { Table } from "./schema";

export default class Note extends Model {
  static table = Table.note.name;

  @date("deleted_at") deletedAt!: Date | null;

  @readonly @date("created_at") createdAt!: Date;
  @date("updated_at") updatedAt!: Date;
}

changing deletedAt column to use @field works

  @field("deleted_at") deletedAt!: string| null;

  @readonly @date("created_at") createdAt!: Date;
  @date("updated_at") updatedAt!: Date;
}
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

1 participant