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(). 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!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server