Question

Two Seperate Schemas for Two Devs

If I have two devs working on an application and I want to make sure they cannot see each others work. Can I set up two different schemas?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
February 25, 2024

Heya @bigdarkbluecrab,

Yes, you can set up two different schemas in a database to segregate the work of two developers. This approach allows each developer to have a separate namespace where they can create, modify, and manage database objects (like tables, views, stored procedures, etc.) without interfering with each other’s work. Here’s how this can be done and some considerations to keep in mind:

Setting Up Separate Schemas

  1. Create Schemas: First, create two separate schemas in your database, one for each developer. The process of creating a schema varies depending on the database management system (DBMS) you’re using. For example, in SQL Server or PostgreSQL, you would use the CREATE SCHEMA statement.

  2. Assign Permissions: Assign appropriate permissions to each developer for their respective schema. Ensure that each developer has full control over their schema but no or limited access to the other’s schema.

  3. Schema Usage: Instruct each developer to create and work with database objects within their own schema. This ensures that their activities are isolated from each other.

Additionally, every managed database instance has a how-to/modify-user-privileges article which you can go over as soon as you decide on a DB you want to use,

https://docs.digitalocean.com/products/databases/

Bobby Iliev
Site Moderator
Site Moderator badge
February 24, 2024

Hi there,

Yes, you can set up two different schemas to ensure that two developers working on an application do not see each other’s work.

  1. Create Separate Schemas: In your database, create two separate schemas, one for each developer: CREATE SCHEMA schema_name;.

  2. Assign Permissions: After creating the schemas, you need to set up permissions to ensure that each developer has access only to their respective schema. For example, you can use GRANT ALL PRIVILEGES ON SCHEMA schema_name TO user_name; to give a developer full access to their schema while restricting access to the other developer’s schema.

For more information on how to manage users and their permissions, I could suggest this documentaiton here:

https://docs.digitalocean.com/products/databases/postgresql/how-to/modify-user-privileges/

An alternative approach is to have separate databases on a single database cluster as well.

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel