-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove tudo relacionado a municipios #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Procedimentos que usei para testar o PR:
Verificando as a table/column e depois apagando municipio_id
associados=> select * from members_member limit 10;
id | github_user | cpf | phone | address | location | relation_with_community | mailing | partner | category_id | organization_id | user_id | diretoria | thumb_image | municipio_id
----+-------------+-----+-------+---------+----------+-------------------------+---------+---------+-------------+-----------------+---------+-----------+-------------+--------------
associados=> alter table members_member
associados-> drop column municipio_id;
ALTER TABLE
associados=> select * from members_member limit 10;
id | github_user | cpf | phone | address | location | relation_with_community | mailing | partner | category_id | organization_id | user_id | diretoria | thumb_image
----+-------------+-----+-------+---------+----------+-------------------------+---------+---------+-------------+-----------------+---------+-----------+-------------
(0 rows)
Comandos para apagar as tabelas:
associados=> drop table municipios_municipio cascade;
DROP TABLE
associados=> drop table municipios_uf cascade;
DROP TABLE
Após isso, esse era o status da table django_migrations
:
associados=> select * from django_migrations;
id | app | name | applied
----+--------------+------------------------------------------+-------------------------------
1 | contenttypes | 0001_initial | 2016-07-11 15:18:01.050689-03
2 | auth | 0001_initial | 2016-07-11 15:18:01.088193-03
3 | admin | 0001_initial | 2016-07-11 15:18:01.125663-03
4 | contenttypes | 0002_remove_content_type_name | 2016-07-11 15:18:01.200002-03
5 | auth | 0002_alter_permission_name_max_length | 2016-07-11 15:18:01.243281-03
6 | auth | 0003_alter_user_email_max_length | 2016-07-11 15:18:01.27305-03
7 | auth | 0004_alter_user_username_opts | 2016-07-11 15:18:01.295356-03
8 | auth | 0005_alter_user_last_login_null | 2016-07-11 15:18:01.321806-03
9 | auth | 0006_require_contenttypes_0002 | 2016-07-11 15:18:01.328163-03
10 | core | 0001_initial | 2016-07-11 15:18:01.348151-03
11 | core | 0002_auto_20150830_0635 | 2016-07-11 15:18:01.354017-03
12 | sites | 0001_initial | 2016-07-11 15:18:01.368785-03
13 | flatpages | 0001_initial | 2016-07-11 15:18:01.392112-03
14 | members | 0001_initial | 2016-07-11 15:18:01.445321-03
15 | members | 0002_auto_20150830_0626 | 2016-07-11 15:18:01.472528-03
16 | members | 0003_auto_20150830_1154 | 2016-07-11 15:18:01.595041-03
17 | members | 0004_auto_20150830_1236 | 2016-07-11 15:18:01.642937-03
18 | members | 0005_member_municipio_codigo | 2016-07-11 15:18:01.691725-03
19 | members | 0006_auto_20151128_0718 | 2016-07-11 15:18:01.747205-03
20 | members | 0007_auto_20151128_0823 | 2016-07-11 15:18:01.83322-03
21 | members | 0008_auto_20151129_1312 | 2016-07-11 15:18:26.827416-03
22 | payment | 0001_initial | 2016-07-11 15:18:27.028065-03
23 | payment | 0002_auto_20150830_0633 | 2016-07-11 15:18:27.091002-03
24 | sessions | 0001_initial | 2016-07-11 15:18:27.119422-03
25 | municipios | 0001_initial | 2019-10-28 15:18:27.119422-03
26 | admin | 0002_logentry_remove_auto_add | 2019-10-28 15:15:27.762004-03
27 | auth | 0007_alter_validators_add_error_messages | 2019-10-28 15:15:27.85404-03
28 | auth | 0008_alter_user_username_max_length | 2019-10-28 15:15:28.064292-03
29 | sites | 0002_alter_domain_unique | 2019-10-28 15:15:28.13731-03
(29 rows
As migrações a serem dropadas do banco seriam as mesmas referentes as migrações deletadas:
0008_auto_20151129_1312
0007_auto_20151128_0823
0006_auto_20151128_0718
0005_member_municipio_codigo
Então usando os ids, deletei essas rows:
associados=> DELETE FROM django_migrations where django_migrations.id = 21;
DELETE 1
associados=> DELETE FROM django_migrations where django_migrations.id = 20;
DELETE 1
associados=> DELETE FROM django_migrations where django_migrations.id = 19;
DELETE 1
associados=> DELETE FROM django_migrations where django_migrations.id = 18;
DELETE 1
associados=> select * from django_migrations;
id | app | name | applied
----+--------------+------------------------------------------+-------------------------------
1 | contenttypes | 0001_initial | 2016-07-11 15:18:01.050689-03
2 | auth | 0001_initial | 2016-07-11 15:18:01.088193-03
3 | admin | 0001_initial | 2016-07-11 15:18:01.125663-03
4 | contenttypes | 0002_remove_content_type_name | 2016-07-11 15:18:01.200002-03
5 | auth | 0002_alter_permission_name_max_length | 2016-07-11 15:18:01.243281-03
6 | auth | 0003_alter_user_email_max_length | 2016-07-11 15:18:01.27305-03
7 | auth | 0004_alter_user_username_opts | 2016-07-11 15:18:01.295356-03
8 | auth | 0005_alter_user_last_login_null | 2016-07-11 15:18:01.321806-03
9 | auth | 0006_require_contenttypes_0002 | 2016-07-11 15:18:01.328163-03
10 | core | 0001_initial | 2016-07-11 15:18:01.348151-03
11 | core | 0002_auto_20150830_0635 | 2016-07-11 15:18:01.354017-03
12 | sites | 0001_initial | 2016-07-11 15:18:01.368785-03
13 | flatpages | 0001_initial | 2016-07-11 15:18:01.392112-03
14 | members | 0001_initial | 2016-07-11 15:18:01.445321-03
15 | members | 0002_auto_20150830_0626 | 2016-07-11 15:18:01.472528-03
16 | members | 0003_auto_20150830_1154 | 2016-07-11 15:18:01.595041-03
17 | members | 0004_auto_20150830_1236 | 2016-07-11 15:18:01.642937-03
22 | payment | 0001_initial | 2016-07-11 15:18:27.028065-03
23 | payment | 0002_auto_20150830_0633 | 2016-07-11 15:18:27.091002-03
24 | sessions | 0001_initial | 2016-07-11 15:18:27.119422-03
25 | municipios | 0001_initial | 2019-10-28 15:18:27.119422-03
26 | admin | 0002_logentry_remove_auto_add | 2019-10-28 15:15:27.762004-03
27 | auth | 0007_alter_validators_add_error_messages | 2019-10-28 15:15:27.85404-03
28 | auth | 0008_alter_user_username_max_length | 2019-10-28 15:15:28.064292-03
29 | sites | 0002_alter_domain_unique | 2019-10-28 15:15:28.13731-03
(25 rows)
Ao final de todo o processo, reiniciei o server local, acessei o admin e o site em si. Nenhum erro. Acho que agora só precisamos padronizar os comandos para executá-los em produção após o deploy.
Este PR remove tudo relacionado a municipios:
Será necessário fazer as seguintes alterações manuais no banco de produção:
municipio
da tabelamembers
Closes #192