How to create dynamic models with attributes on form submit - mysql

I have some tables which are nothing but my company services(WAPT, MAPT, NAPT etc). these services are predefined but now team want to add new services with different attributes. They can able to add multiple service table with different columns. Is this possible.
I tried active_dynamic but it's about adding attributes to existing table but i need multiple tables here with dynamic attributes.

Related

Symmetric many-to-many relationship in Directus

I have two collections in Directus (data platform that provides many features including REST API over database records). There is option to set relationship between different collections.
I set many-to-many relationship between collectionA and collectionB.
Special system collection (junction table) called collectionA_collectionB was automatically created. Now I can add items from collectionB while editing collectionA items.
But same time I want to add collectionA items while editing collectionB items and I don't find way to add existing junction table. When I add many-to-many relationship between collectionB and collectionA - new junction table is created.
How can I use same junction table to achieve symmetric many-to-many relationship?
From the Directus UI you can delete the relation from CollectionA and also delete the junction table collectionA_collectionB and then create again the M2M to CollectionB but when creating, please click "Continue in Advanced Field Creation Mode" just below the "Save" button you'd like to rush to click otherwise: https://i.imgur.com/7LASmQp.png
Now, click "Relation" from the left menu and under "Corresponding Field" check the "Add M2M" to ColumnB" checkbox: https://i.imgur.com/ptb0aNr.png
If you don't want to delete what's created already (for example, lot of data in the tables already), then I think the only way is to make changes directly to the directus_* tables on the database. I don't know how to do it as I didn't have much data when I had this problem.

Should I create a separate table that has the same structure as an existing table given that the new table will serve an entirely different purpose?

I have an email table for emails that go to one subset of users. I want to create another email table for emails that go to a completely different subset of users. However, since I have an existing table that has the same exact structure, should I just re-use that table? Is there an architectural advantage of creating a separate table because it serves a different purpose?
Edit: As a note, all columns on both tables will be filled. There aren't different types associated.

Multiple Tables Sharing Info to one

I have 4 tables, "Player", "Crafting", "Battling", "Gathering".
I made a relationship rule for Crafting, Battling and Gathering to share information to the Player table.
The problem is that when I go to the player table it makes me choose which other table's information to display instead of showing all 3.
How can I make a relationship so that I can view all three other tables from the player table?
It's impossible and you don't need this. You already have all relationships you need. Just create a form based on Player table with 3 subforms and link them on form, no additional code required in simple case.
Also I would recommend do not use username as primary key, use Autonumber data type instead.

ASP MySQLRoleProvider tie roles to users

I would like to use the mysql role provider for aspnet. I have setup a custom table for the users using the attribute userTableName="user". Now the problem is that when I assign users to roles, MYSQLRolesprovider creates an entry in a table "my_aspnet_usersinroles" which and "my_aspnet_users". I would like to specify that the table used to specify roles should be the "user" table. How do I do that? Do I need to write a custom role provider? Is there a setting that I can tweak to make that association? Or am I just using this whole system wrong? Thanks
specify that the table used to specify roles should be the "user"
table.
If you want Membership Provider to use your User table, you need to implement Custom Membership Provider.
Custom Membership Provider requires a lot of work especially if you are new to Membership Provider and Provider Model.
Alternative Approach
Use FormAuthentication if you do not need Membership Provider's all features.
OR
create UserId in User tables as PrimaryKey as well as ForeignKey like the following. (One draw back in this approach is you can only use in new application; you cannot implement in existing database.)
You need separate tables for users and their roles. Generally, it's three in total, one for the users, one for the roles, and one to tie a user with one or more roles. The usersinroles table allows the one to many relationship so your user can have more than one role. Also, good database design would dictate this as well as the user table should only contain artifacts directly related to the user itself.

Building the tables for an Auto-drop subscription system

I'm building a system that will auto-drop someone from one or more mailing lists, when they subscribe to another mailing list. I have a table 'lists' containing the list names. Each list will have one or more children in the form of 'exclusions', which are basically other lists. Here is my table:
I'm wondering how best to achieve this. I originally thought of having another table called 'exclusions' linked via a lookup table with a many-to-many relationship, then I could grab all the exclusions for a particular list name.
However, the exclusions are basically the same list names that are contained in the lists table, so it seems like I have redundant data there.
Would there be a better way of acheiving this? I considered adding an extra column to the lists table, containing the ID's of the other lists that I need to exclude.
I think adding a new table that will link the ID of your list to the ID of the email address would be the best course of action with this. Then when your system goes to send email to a specific list, the lookup can be done on this table using joins to the referenced tables.
I found that the answer lies here, in the form of a 'junction' or 'mapping' table: How can I associate one record with another in the same table?