Skip to content

[FEATURE]: Option to create dynamic tables #5696

@shadoworion

Description

@shadoworion

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

It would be great to have an option to manage tables in the database at runtime, not just through migrations.

For example:

const tableFactory = (name: string) =>
  sqliteTable(name, {
    id: integer({ mode: "number" }).primaryKey({ autoIncrement: true }),
    ....other columns
  });

await tableFactory("some_table").createIfNotExists()

Or at least an option to generate SQL from this:

const tableFactory = (name: string) =>
  sqliteTable(name, {
    id: integer({ mode: "number" }).primaryKey({ autoIncrement: true }),
    ....other columns
  });

const sql = tableFactory("some_table").getSQL()

await db.$client.execute(sql);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions