┌──(leazhi㉿kali-desktop)-[/data/gitlab/python3-django-small_haoke/haoke] └─$ python manage.py makemigrations Migrations for'goods': haoke/apps/goods/migrations/0003_auto_20230917_0926.py - Add field desc_detail to goods - Add field desc_pack to goods - Add field desc_service to goods
3.执行命令生成数据表:
1 2 3 4 5 6 7 8 9 10
┌──(leazhi㉿kali-desktop)-[/data/gitlab/python3-django-small_haoke/haoke] └─$ python manage.py migrate Operations to perform: Apply all migrations: admin, areas, auth, contents, contenttypes, goods, sessions, users Running migrations: Applying areas.0002_auto_20230917_0914... OK Applying contents.0002_auto_20230917_0914... OK Applying goods.0002_auto_20230917_0923... OK Applying goods.0003_auto_20230917_0926... OK Applying users.0004_auto_20230917_0914... OK
4.登录 mysql ,验证表字段:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
(root@localhost small 09:21:)>describe tb_goods; +--------------+-------------+------+-----+---------+----------------+ | Field | Type |Null| Key |Default| Extra | +--------------+-------------+------+-----+---------+----------------+ | id |int(11) |NO| PRI |NULL| auto_increment | | create_time | datetime(6) |NO||NULL|| | update_time | datetime(6) |NO||NULL|| | name |varchar(50) |NO||NULL|| | sales |int(11) |NO||NULL|| | comments |int(11) |NO||NULL|| | brand_id |int(11) |NO| MUL |NULL|| | category1_id |int(11) |NO| MUL |NULL|| | category2_id |int(11) |NO| MUL |NULL|| | category3_id |int(11) |NO| MUL |NULL|| | desc_detail | longtext |NO||NULL|| | desc_pack | longtext |NO||NULL|| | desc_service | longtext |NO||NULL|| +--------------+-------------+------+-----+---------+----------------+ 13rowsinset (0.001 sec)