diff --git a/membershipworks/migrations/0001_initial.py b/membershipworks/migrations/0001_initial.py index 591d838..0ccc207 100644 --- a/membershipworks/migrations/0001_initial.py +++ b/membershipworks/migrations/0001_initial.py @@ -1,7 +1,7 @@ -# Generated by Django 4.0.2 on 2022-02-12 05:05 +# Generated by Django 5.0 on 2023-12-20 05:40 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,12 +17,12 @@ class Migration(migrations.Migration): "id", models.CharField(max_length=24, primary_key=True, serialize=False), ), - ("name", models.TextField(null=True)), + ("name", models.TextField(blank=True, null=True)), ("type", models.CharField(max_length=6)), ], options={ "db_table": "flag", - "managed": False, + "ordering": ("name",), }, ), migrations.CreateModel( @@ -34,75 +34,116 @@ class Migration(migrations.Migration): ), ( "year_of_birth", - models.TextField(db_column="Year of Birth", null=True), + models.TextField(blank=True, db_column="Year of Birth", null=True), + ), + ( + "account_name", + models.TextField(blank=True, db_column="Account Name", null=True), + ), + ( + "first_name", + models.TextField(blank=True, db_column="First Name", null=True), + ), + ( + "last_name", + models.TextField(blank=True, db_column="Last Name", null=True), + ), + ("phone", models.TextField(blank=True, db_column="Phone", null=True)), + ("email", models.TextField(blank=True, db_column="Email", null=True)), + ( + "volunteer_email", + models.TextField( + blank=True, db_column="Volunteer Email", null=True + ), ), - ("account_name", models.TextField(db_column="Account Name", null=True)), - ("first_name", models.TextField(db_column="First Name", null=True)), - ("last_name", models.TextField(db_column="Last Name", null=True)), - ("phone", models.TextField(db_column="Phone", null=True)), - ("email", models.TextField(db_column="Email", null=True)), ( "address_street", - models.TextField(db_column="Address (Street)", null=True), + models.TextField( + blank=True, db_column="Address (Street)", null=True + ), ), ( "address_city", - models.TextField(db_column="Address (City)", null=True), + models.TextField(blank=True, db_column="Address (City)", null=True), ), ( "address_state_province", - models.TextField(db_column="Address (State/Province)", null=True), + models.TextField( + blank=True, db_column="Address (State/Province)", null=True + ), ), ( "address_postal_code", - models.TextField(db_column="Address (Postal Code)", null=True), + models.TextField( + blank=True, db_column="Address (Postal Code)", null=True + ), ), ( "address_country", - models.TextField(db_column="Address (Country)", null=True), + models.TextField( + blank=True, db_column="Address (Country)", null=True + ), ), ( "profile_description", - models.TextField(db_column="Profile description", null=True), + models.TextField( + blank=True, db_column="Profile description", null=True + ), ), - ("website", models.TextField(db_column="Website", null=True)), - ("fax", models.TextField(db_column="Fax", null=True)), + ( + "website", + models.TextField(blank=True, db_column="Website", null=True), + ), + ("fax", models.TextField(blank=True, db_column="Fax", null=True)), ( "contact_person", - models.TextField(db_column="Contact Person", null=True), + models.TextField(blank=True, db_column="Contact Person", null=True), + ), + ( + "password", + models.TextField(blank=True, db_column="Password", null=True), ), - ("password", models.TextField(db_column="Password", null=True)), ( "position_relation", - models.TextField(db_column="Position/relation", null=True), + models.TextField( + blank=True, db_column="Position/relation", null=True + ), ), ( "parent_account_id", - models.TextField(db_column="Parent Account ID", null=True), + models.TextField( + blank=True, db_column="Parent Account ID", null=True + ), ), ( "gift_membership_purchased_by", models.TextField( - db_column="Gift Membership purchased by", null=True + blank=True, db_column="Gift Membership purchased by", null=True ), ), ( "purchased_gift_membership_for", models.TextField( - db_column="Purchased Gift Membership for", null=True + blank=True, db_column="Purchased Gift Membership for", null=True ), ), ( "closet_storage", - models.TextField(db_column="Closet Storage #", null=True), + models.TextField( + blank=True, db_column="Closet Storage #", null=True + ), ), ( "storage_shelf", - models.TextField(db_column="Storage Shelf #", null=True), + models.TextField( + blank=True, db_column="Storage Shelf #", null=True + ), ), ( "personal_studio_space", - models.TextField(db_column="Personal Studio Space #", null=True), + models.TextField( + blank=True, db_column="Personal Studio Space #", null=True + ), ), ( "access_permitted_shops_during_extended_hours", @@ -150,84 +191,145 @@ class Migration(migrations.Migration): ), ( "access_card_number", - models.TextField(db_column="Access Card Number", null=True), + models.TextField( + blank=True, db_column="Access Card Number", null=True + ), ), ( "access_card_facility_code", - models.TextField(db_column="Access Card Facility Code", null=True), + models.TextField( + blank=True, db_column="Access Card Facility Code", null=True + ), ), ( "auto_billing_id", - models.TextField(db_column="Auto Billing ID", null=True), + models.TextField( + blank=True, db_column="Auto Billing ID", null=True + ), ), ( "billing_method", - models.TextField(db_column="Billing Method", null=True), + models.TextField(blank=True, db_column="Billing Method", null=True), + ), + ( + "renewal_date", + models.DateField(blank=True, db_column="Renewal Date", null=True), + ), + ( + "join_date", + models.DateField(blank=True, db_column="Join Date", null=True), + ), + ( + "admin_note", + models.TextField(blank=True, db_column="Admin note", null=True), ), - ("renewal_date", models.DateField(db_column="Renewal Date", null=True)), - ("join_date", models.DateField(db_column="Join Date", null=True)), - ("admin_note", models.TextField(db_column="Admin note", null=True)), ( "profile_gallery_image_url", - models.TextField(db_column="Profile gallery image URL", null=True), + models.TextField( + blank=True, db_column="Profile gallery image URL", null=True + ), ), ( "business_card_image_url", - models.TextField(db_column="Business card image URL", null=True), + models.TextField( + blank=True, db_column="Business card image URL", null=True + ), + ), + ( + "instagram", + models.TextField(blank=True, db_column="Instagram", null=True), + ), + ( + "pinterest", + models.TextField(blank=True, db_column="Pinterest", null=True), + ), + ( + "youtube", + models.TextField(blank=True, db_column="Youtube", null=True), + ), + ("yelp", models.TextField(blank=True, db_column="Yelp", null=True)), + ( + "google", + models.TextField(blank=True, db_column="Google+", null=True), + ), + ("bbb", models.TextField(blank=True, db_column="BBB", null=True)), + ( + "twitter", + models.TextField(blank=True, db_column="Twitter", null=True), + ), + ( + "facebook", + models.TextField(blank=True, db_column="Facebook", null=True), + ), + ( + "linked_in", + models.TextField(blank=True, db_column="LinkedIn", null=True), ), - ("instagram", models.TextField(db_column="Instagram", null=True)), - ("pinterest", models.TextField(db_column="Pinterest", null=True)), - ("youtube", models.TextField(db_column="Youtube", null=True)), - ("yelp", models.TextField(db_column="Yelp", null=True)), - ("google", models.TextField(db_column="Google+", null=True)), - ("bbb", models.TextField(db_column="BBB", null=True)), - ("twitter", models.TextField(db_column="Twitter", null=True)), - ("facebook", models.TextField(db_column="Facebook", null=True)), - ("linked_in", models.TextField(db_column="LinkedIn", null=True)), ( "do_not_show_street_address_in_profile", models.TextField( - db_column="Do not show street address in profile", null=True + blank=True, + db_column="Do not show street address in profile", + null=True, ), ), ( "do_not_list_in_directory", - models.TextField(db_column="Do not list in directory", null=True), + models.TextField( + blank=True, db_column="Do not list in directory", null=True + ), ), ( "how_did_you_hear", - models.TextField(db_column="HowDidYouHear", null=True), + models.TextField(blank=True, db_column="HowDidYouHear", null=True), ), ( "authorize_charge", - models.TextField(db_column="authorizeCharge", null=True), + models.TextField( + blank=True, db_column="authorizeCharge", null=True + ), ), ( "policy_agreement", - models.TextField(db_column="policyAgreement", null=True), + models.TextField( + blank=True, db_column="policyAgreement", null=True + ), ), ( "waiver_form_signed_and_on_file_date", models.DateField( - db_column="Waiver form signed and on file date.", null=True + blank=True, + db_column="Waiver form signed and on file date.", + null=True, ), ), ( "membership_agreement_signed_and_on_file_date", models.DateField( + blank=True, db_column="Membership Agreement signed and on file date.", null=True, ), ), - ("ip_address", models.TextField(db_column="IP Address", null=True)), - ("audit_date", models.DateField(db_column="Audit Date", null=True)), + ( + "ip_address", + models.TextField(blank=True, db_column="IP Address", null=True), + ), + ( + "audit_date", + models.DateField(blank=True, db_column="Audit Date", null=True), + ), ( "agreement_version", - models.TextField(db_column="Agreement Version", null=True), + models.TextField( + blank=True, db_column="Agreement Version", null=True + ), ), ( "paperwork_status", - models.TextField(db_column="Paperwork status", null=True), + models.TextField( + blank=True, db_column="Paperwork status", null=True + ), ), ( "membership_agreement_dated", @@ -259,7 +361,6 @@ class Migration(migrations.Migration): options={ "db_table": "members", "ordering": ("first_name", "last_name"), - "managed": False, }, ), migrations.CreateModel( @@ -274,12 +375,35 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), + ( + "flag", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="membershipworks.flag", + ), + ), + ( + "member", + models.ForeignKey( + db_column="uid", + on_delete=django.db.models.deletion.PROTECT, + to="membershipworks.member", + ), + ), ], options={ "db_table": "memberflag", - "managed": False, }, ), + migrations.AddField( + model_name="member", + name="flags", + field=models.ManyToManyField( + related_name="members", + through="membershipworks.MemberFlag", + to="membershipworks.flag", + ), + ), migrations.CreateModel( name="Transaction", fields=[ @@ -356,4 +480,22 @@ class Migration(migrations.Migration): "db_table": "transactions", }, ), + migrations.AddConstraint( + model_name="memberflag", + constraint=models.UniqueConstraint( + fields=("member", "flag"), name="unique_member_flag" + ), + ), + migrations.AddIndex( + model_name="member", + index=models.Index(fields=["account_name"], name="account_name_idx"), + ), + migrations.AddIndex( + model_name="member", + index=models.Index(fields=["first_name"], name="first_name_idx"), + ), + migrations.AddIndex( + model_name="member", + index=models.Index(fields=["last_name"], name="last_name_idx"), + ), ] diff --git a/membershipworks/migrations/0002_alter_flag_options.py b/membershipworks/migrations/0002_alter_flag_options.py deleted file mode 100644 index 8e0fc2a..0000000 --- a/membershipworks/migrations/0002_alter_flag_options.py +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Django 4.1.3 on 2023-01-24 02:02 - -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("membershipworks", "0001_initial"), - ] - - operations = [ - migrations.AlterModelOptions( - name="flag", - options={"managed": False, "ordering": ("name",)}, - ), - ] diff --git a/membershipworks/models.py b/membershipworks/models.py index 6c129e2..50ea376 100644 --- a/membershipworks/models.py +++ b/membershipworks/models.py @@ -195,9 +195,9 @@ class Member(models.Model): db_table = "members" ordering = ("first_name", "last_name") indexes = [ - models.Index(fields=["account_name"]), - models.Index(fields=["first_name"]), - models.Index(fields=["last_name"]), + models.Index(fields=["account_name"], name="account_name_idx"), + models.Index(fields=["first_name"], name="first_name_idx"), + models.Index(fields=["last_name"], name="last_name_idx"), ] @classmethod diff --git a/paperwork/migrations/0009_rename_department_list_moderator_flag_to_shop_lead_flag.py b/paperwork/migrations/0009_rename_department_list_moderator_flag_to_shop_lead_flag.py index ab0025c..2e8870f 100644 --- a/paperwork/migrations/0009_rename_department_list_moderator_flag_to_shop_lead_flag.py +++ b/paperwork/migrations/0009_rename_department_list_moderator_flag_to_shop_lead_flag.py @@ -6,7 +6,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ("membershipworks", "0002_alter_flag_options"), + ("membershipworks", "0001_initial"), ("paperwork", "0008_remove_certificationdefinition_mailing_list"), ] diff --git a/paperwork/migrations/0014_alter_certificationdefinition_options_and_more.py b/paperwork/migrations/0014_alter_certificationdefinition_options_and_more.py index 275e5bd..dd6d205 100644 --- a/paperwork/migrations/0014_alter_certificationdefinition_options_and_more.py +++ b/paperwork/migrations/0014_alter_certificationdefinition_options_and_more.py @@ -6,7 +6,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ("membershipworks", "0002_alter_flag_options"), + ("membershipworks", "0001_initial"), ("paperwork", "0013_alter_certificationdefinition_certification_name"), ]