The best way to generate a table

Hi, if I want to create a new table with some fields, do I use parse server API call? Or, do I use express.js database migration? Which way is better?

Easiest way is via dashboard. But, programmatically, both ways should work well. If you are dynamically creating new classes to your schema, I’d way with the api call. But, if you are talking about migrating an existing schema from one app (let’s say dev) to another app (let’s say prod), I’d go with the mongodb dump/restore.

@davimacedo Thanks. What do you mean dashboard? Does parse server have a dashboard? If I initially create a table using the api call, could I create an express.js migration schema from the database table? I vaguely remember this is doable, but I have not done so.

Or, if I use parse server api call to create a table, will parse server generate a migration scheme corresponding to the new table?

Yes. Parse Server has a dashboard: GitHub - parse-community/parse-dashboard: A dashboard for managing your Parse Server Apps

There isn’t a migration tool yet on Parse but the community is working on that. In the meantime, the easiest way is by dumping/restoring the _SCHEMA collection.

1 Like

@davimacedo How does parse initially create all the tables during the installation process? For example, the _User table has [username] and [email] columns. How does Parse create those columns? Also, the column has length limit and tables also have primary keys/foreign keys. Where do we specify those parameters? Does parse have a data model? I come from Python/Django background. So, I don’t quite understand. Also, I use Postgres and most tutorials assume you use MongoDB. So, my questions possibly are only relevant to Postgres. Thanks

There is a special table called _SCHEMA which has your data model. When an object is created for the first time on a certain class, the table is created before inserting the object.