© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago
UnityTheMaker

Adding Columns or Merging Tables

TL;DR: We're developing a flexible, time-saving Nuxt module that dynamically includes/excludes table columns based on user-selected features. We're seeking advice on enabling users to add new columns to existing tables and exploring the possibility of merging tables or adding columns dynamically. Current focus is on pgTable, with plans to extend support to MySQL and SQLite. Any insights or relevant documentation would be greatly appreciated.

Hi!

We're developing a Nuxt module designed to significantly enhance flexibility and save time. Unlike a typical boilerplate, our module offers helper functions that facilitate interaction with a pre-configured architecture, commonly reinitialized in various projects. This modular approach allows for easy updates and maintenance across all projects utilizing this architecture.

A key feature of our module is the implementation of authentication and various other functionalities. Depending on selected features, our module dynamically includes or excludes tables and columns. However, we've encountered a challenge: How can we enable users to add new columns to existing tables?

Our current process involves initializing tables in a JavaScript file during the Nuxt build process, where we can add or remove elements. We're exploring different approaches to address this challenge:

1. Direct User Input for Additional Columns: Considering an option to let users specify additional columns directly in the module's settings.
2. Separate Schema Management: Allowing users to maintain two different schemas, although this might not be the best practice.
3. Table Merging or Dynamic Column Addition: We're looking for a method, possibly akin to something in Drizzle (which we haven't found in the documentation yet), that would allow merging two pgTables or adding columns to an existing table with a method like
tableName.addColumn()
tableName.addColumn()
.

Currently, our module does not support MySQL and SQLite, but we plan to include these in the future as part of our commitment to a flexible architecture.

Any insights, suggestions, or references to relevant documentation would be greatly appreciated.

Thank you for your support!
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Struggling when changing tables relationships or columns
Drizzle TeamDTDrizzle Team / help
2y ago
2 tables cannot reference each others columns?
Drizzle TeamDTDrizzle Team / help
2y ago
How to handle adding new columns to schema?
Drizzle TeamDTDrizzle Team / help
3y ago
[SOLVED] - How to prevent columns from dropping - after merging fellow developer changes?
Drizzle TeamDTDrizzle Team / help
14mo ago