首頁 > php教程 > PHP开发 > Django 常見問題及解決方案總結

Django 常見問題及解決方案總結

高洛峰
發布: 2016-11-23 13:05:45
原創
1203 人瀏覽過

1. Django + PostgreSQL: How to reset primary key?

http://stackoverflow.com/questions/544791/django-postgresql-how-to-reset-primary-key

這個是用於在清除表中資料後,資料的pk 不從1開始成長,將序列重新設定為1的方法。

In your app directory try this:

python manage.py help sqlsequencereset

o   🜎

python manage.py sqlsequencereset myapp1 myapp2 | psql

   

Edit: here's an example of the output from this command on one of my _id_seq"', coalesce(max("id "), 1), max("id") IS NOT null) FROM "project_row";

COMMIT;

相關標籤:
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
python - django'沒有名為'mdx_markwdown'的模組
來自於 1970-01-01 08:00:00
0
0
0
python - Django 模型foreignKey 參考
來自於 1970-01-01 08:00:00
0
0
0
angular.js - angularjs和django結合的問題
來自於 1970-01-01 08:00:00
0
0
0
解決Django中的django.db.utils.NotSupportedError錯誤
來自於 1970-01-01 08:00:00
0
0
0
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板