Where to define models to create tables in postgres on start of skygearIO


where to define models to create tables in postgres on start of skygearIO
Foe now there are few tables by default. I want to create few more tables. How can i do that?


You don’t really need to define models in Skygear.io. Any Record types that save from the Client side in development mode of Skygear, would have tables and columns automatically created.

If you really wish to create tables, you can do it directly in postgres but it is not recommended. You will need to make sure the table consist of all reserved columns as described in https://docs.skygear.io/guides/advanced/database-schema/

I do know some developers use migration management tools like Alembic to manage the schema, but this is more up to personal preference I guess.


what do i have to do now to achieve this?


Sorry, nope. If you really want to use a tool but not writing SQL, the go-skycli do have such feature: https://docs.skygear.io/guides/advanced/skycli/#manage-database-schema

It works like this:

$ skycli schema add <record_type> <column_name> <column_def>

But it is deprecated as too few developers use it. You might try but can’t promise it will works.

A more user-friendly version of schema editor on developer portal is on the roadmap.


What if i want to create a table through middle ware as it is not to be used by frontend


hey i had created a project named smallmediumbusiness in my account now am not able to see it ? It disappeared from my acccoutn y so?


Best practices is just don’t worry about schema on server side, and start coding the frontend and let the server create the schema for you.

For the specific account you mentioned, did you try login again? If problem persist may you email me at support@skygear.io with your user’s email name so I can check it for you?