Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8492893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:51:21+00:00 2026-06-10T22:51:21+00:00

I have database in PostgreSql named tests. And i want to write sh script

  • 0

I have database in PostgreSql named “tests”.
And i want to write sh script to syncdb it with django, run tests and then drop all tables.
Can anyone suggest a proper solution?
A bit of script:

DJANGO_DATABASE='tests' bin/django-admin.py syncdb  
bin/django-admin.py test MyApplication #tests will use "tests" db
sudo su postgres
psql tests
drop schema public; #i think i can drop schema and then syncdb.. or i'm wrong.
exit
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:51:23+00:00Added an answer on June 10, 2026 at 10:51 pm

    As far as i know, django can do this for you. <– outdated

    Actually, it changed a bit :).
    But it’s still possible:

    #!/usr/bin/env sh
    ./manage.py sqlclear | ./manage.py dbshell
    ./manage.py syncdb
    

    this will pipe, the output of sqlclear management-command into the dbshell.
    which will in turn execute it.

    sqlclear will output DROP TABLE ... sql-statements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PostgreSQL database with two tables named user and group. They have
I have a database in PostgreSQL which is named DATA in all caps. When
I have a PostgreSQL database for my Rails application. In the schema named 'public'
Suppose we have a PostgreSQL database with two tables A, B. table A columns:
I have a database named info. In the database I have 4 different tables
In a postgresql database I have 2 tables like these ones: Table items: item_id
I am lost. I have localhost database (PostgreSQL) and I have to add port
I have a postgresql database and am using it for a project which handles
I have a large readonly Wordnet PostgreSQL database that I'd like to use from
I have column in a postgresql database. They are lottery numbers. Four digits in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.