Skip to main content

Database

Development versus Production Database

In your workspace we initialized a PostgreSQL development database with already some fake data inside so you get a feeling of how your app looks. You can access this database from the "Database" tab in the workspace.

When you go to production, we create a new production database (empty). You can access this database with the database URL created for you automatically in Hosting > Environment Variables. You can use a tool like PgAdmin or Postico to access it.

Keep your database in a good state

When updating your data model, you may add attributes, add tables, remove attributes or remove tables.

tip

To avoid having to deal with migration always add fields as optional (using the '?' suffix) or give them a default value.

If you see weird behaviors (ex: you add a field, you apply the changes but you can't see them in your app), check the errors tab, it's likely that your database is not sync.

This happens for example when you add a field required without default value. The database can't create this new attribute because a default value is required. So you can go back to your data model and mark the field as optional or add a default value and re-apply the changes.