-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.bash
59 lines (44 loc) · 1.81 KB
/
commands.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -----------------------
# Apps
# -----------------------
# Creating apps in a suborder called 'apps'
mkdir apps/<app_name>
python manage.py startapp <app_name> ./apps/<app_name>
# -----------------------
# Database
# -----------------------
python manage.py makemigrations
python manage.py migrate
# squash migration <-- to check , should put all migration into a file
# Manually delete migrations
delete from django_migrations where app = 'account';
python manage.py sqlmigrate <app_name>
python manage.py makemigrations --empty <app_name>
python manage.py migrate --fake address 0002_populate
# -----------------------
# Testings
# -----------------------
# Keep database after test
python manage.py test --keepdb
# Not ask to destroy/reuse database
python manage.py test --noinput
python manage.py test app_name
python manage.py test animals.tests.AnimalTestCase
python manage.py test app_name.tests.AnimalTestCase.test_animals_can_speak
# -----------------------
# Misc and other stuff for memo
# -----------------------
drop table address_address;
drop table address_city;
drop table address_country;
drop table address_subregion;
drop table address_continent;
delete from django_migrations where app = 'address';
python manage.py makemigrations address
python manage.py migrate address 0001_initial
python manage.py sqlmigrate address 0002_populate
python manage.py migrate address 0002_populate
python manage.py migrate account 0002_populate
delete from django_migrations where app = 'account' ;
select COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME, REFERENCED_TABLE_NAME from information_schema.KEY_COLUMN_USAGE where TABLE_NAME = 'link_account';
select COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME, REFERENCED_TABLE_NAME from information_schema.KEY_COLUMN_USAGE where TABLE_NAME = 'social_media_link_account';