twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.71k stars 1.71k forks source link

Improve `workspace:seed:dev` command to seed all field types #6364

Closed lucasbordeau closed 1 month ago

lucasbordeau commented 1 month ago

Scope & Context

When seeding the database in dev mode.

Technical inputs

Right now we use the seeds that were relevant months ago, but now we have multiple new field types like JSON, Address and Links, and we have to create them manually each time we want to test them while developing our features.

What would really help all the community is to seed people and company with all possible field types, and fill all rows with more demo data so our initial tables aren't so empty.

A nice good first issue !

otutukingsley commented 1 month ago

I'm interested in helping! can you assign this issue to me? @lucasbordeau

Bonapara commented 1 month ago

Sure @otutukingsley, thanks for contributing! Regarding the content, we should keep the five companies and five people we have but fill in all the columns.

prateekj117 commented 1 month ago

@otutukingsley If you have not taken it up yet or not planning to take it up, I can have a look into this?

@Bonapara I see in the command, we only seed for 2 companies, SEED_APPLE_WORKSPACE_ID, SEED_TWENTY_WORKSPACE_ID, and not 5. Or am I missing something here?

prateekj117 commented 1 month ago

Ohh and in the case of all companies and all people, it's 13 companies and 15 people. I think this is what you were talking about. My bad.

prateekj117 commented 1 month ago

@Bonapara Can I take this up?

Bonapara commented 1 month ago

@otutukingsley are you still on it? Otherwise I'll assign you @prateekj117!

lucasbordeau commented 1 month ago

@Bonapara I'm assigning @prateekj117 as it would be nice to have it soon.

lucasbordeau commented 1 month ago

@prateekj117, I'll explain more :

Step 1 :

You might want to import the field metadata service in DataSeedWorkspaceCommand and call createOne directly in a new function seedCompanyCustomFields and seedPeopleCustomFields.

Be careful to seed custom field with isCustom: true.

Step 2 :

Once those fields are created in the DB, you can proceed to seed them with demo data in seedCompanies and seedPeople.

prateekj117 commented 1 month ago

@lucasbordeau This gave me a good idea of the db structuring haha! Thanks for assigning this to me.