2024-08-26 23:45:39 -04:00
# Generated by Django 5.1 on 2024-08-21 18:17
import uuid
2022-02-12 00:07:16 -05:00
import django . db . models . deletion
2023-12-20 00:54:31 -05:00
from django . db import migrations , models
2024-08-26 23:45:39 -04:00
from django . db . models . functions import Cast
import django_db_views . migration_functions
import django_db_views . operations
2022-02-12 00:07:16 -05:00
class Migration ( migrations . Migration ) :
initial = True
2024-08-26 23:45:39 -04:00
dependencies = [
( " reservations " , " 0001_initial " ) ,
]
2022-02-12 00:07:16 -05:00
operations = [
migrations . CreateModel (
2022-02-14 12:44:42 -05:00
name = " Flag " ,
2022-02-12 00:07:16 -05:00
fields = [
2022-02-14 12:44:42 -05:00
(
" id " ,
models . CharField ( max_length = 24 , primary_key = True , serialize = False ) ,
) ,
2023-12-20 00:54:31 -05:00
( " name " , models . TextField ( blank = True , null = True ) ) ,
2022-02-14 12:44:42 -05:00
( " type " , models . CharField ( max_length = 6 ) ) ,
2022-02-12 00:07:16 -05:00
] ,
options = {
2022-02-14 12:44:42 -05:00
" db_table " : " flag " ,
2023-12-20 00:54:31 -05:00
" ordering " : ( " name " , ) ,
2022-02-12 00:07:16 -05:00
} ,
) ,
migrations . CreateModel (
2022-02-14 12:44:42 -05:00
name = " Member " ,
2022-02-12 00:07:16 -05:00
fields = [
2022-02-14 12:44:42 -05:00
(
" uid " ,
models . CharField ( max_length = 24 , primary_key = True , serialize = False ) ,
) ,
(
" year_of_birth " ,
2023-12-20 00:54:31 -05:00
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
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" address_street " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Address (Street) " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" address_city " ,
2023-12-20 00:54:31 -05:00
models . TextField ( blank = True , db_column = " Address (City) " , null = True ) ,
2022-02-14 12:44:42 -05:00
) ,
(
" address_state_province " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Address (State/Province) " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" address_postal_code " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Address (Postal Code) " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" address_country " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Address (Country) " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" profile_description " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Profile description " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
2023-12-20 00:54:31 -05:00
(
" website " ,
models . TextField ( blank = True , db_column = " Website " , null = True ) ,
) ,
( " fax " , models . TextField ( blank = True , db_column = " Fax " , null = True ) ) ,
2022-02-14 12:44:42 -05:00
(
" contact_person " ,
2023-12-20 00:54:31 -05:00
models . TextField ( blank = True , db_column = " Contact Person " , null = True ) ,
) ,
(
" password " ,
models . TextField ( blank = True , db_column = " Password " , null = True ) ,
2022-02-14 12:44:42 -05:00
) ,
(
" position_relation " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Position/relation " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" parent_account_id " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Parent Account ID " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" closet_storage " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Closet Storage # " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" storage_shelf " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Storage Shelf # " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" personal_studio_space " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Personal Studio Space # " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" access_permitted_shops_during_extended_hours " ,
models . BooleanField (
db_column = " Access Permitted Shops During Extended Hours? "
) ,
) ,
(
" access_front_door_and_studio_space_during_extended_hours " ,
models . BooleanField (
db_column = " Access Front Door and Studio Space During Extended Hours? "
) ,
) ,
(
" access_wood_shop " ,
models . BooleanField ( db_column = " Access Wood Shop? " ) ,
) ,
(
" access_metal_shop " ,
models . BooleanField ( db_column = " Access Metal Shop? " ) ,
) ,
(
" access_storage_closet " ,
models . BooleanField ( db_column = " Access Storage Closet? " ) ,
) ,
(
" access_studio_space " ,
models . BooleanField ( db_column = " Access Studio Space? " ) ,
) ,
(
" access_front_door " ,
models . BooleanField ( db_column = " Access Front Door? " ) ,
) ,
(
" access_card_number " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Access Card Number " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" access_card_facility_code " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Access Card Facility Code " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" auto_billing_id " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Auto Billing ID " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" billing_method " ,
2023-12-20 00:54:31 -05:00
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 ) ,
2022-02-14 12:44:42 -05:00
) ,
(
" profile_gallery_image_url " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Profile gallery image URL " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" business_card_image_url " ,
2023-12-20 00:54:31 -05:00
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 ) ,
) ,
2022-02-14 12:44:42 -05:00
(
" do_not_show_street_address_in_profile " ,
models . TextField (
2023-12-20 00:54:31 -05:00
blank = True ,
db_column = " Do not show street address in profile " ,
null = True ,
2022-02-14 12:44:42 -05:00
) ,
) ,
(
" do_not_list_in_directory " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Do not list in directory " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" how_did_you_hear " ,
2023-12-20 00:54:31 -05:00
models . TextField ( blank = True , db_column = " HowDidYouHear " , null = True ) ,
2022-02-14 12:44:42 -05:00
) ,
(
" authorize_charge " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " authorizeCharge " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" policy_agreement " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " policyAgreement " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" waiver_form_signed_and_on_file_date " ,
models . DateField (
2023-12-20 00:54:31 -05:00
blank = True ,
db_column = " Waiver form signed and on file date. " ,
null = True ,
2022-02-14 12:44:42 -05:00
) ,
) ,
(
" membership_agreement_signed_and_on_file_date " ,
models . DateField (
2023-12-20 00:54:31 -05:00
blank = True ,
2022-02-14 12:44:42 -05:00
db_column = " Membership Agreement signed and on file date. " ,
null = True ,
) ,
) ,
2023-12-20 00:54:31 -05:00
(
" ip_address " ,
models . TextField ( blank = True , db_column = " IP Address " , null = True ) ,
) ,
(
" audit_date " ,
models . DateField ( blank = True , db_column = " Audit Date " , null = True ) ,
) ,
2022-02-14 12:44:42 -05:00
(
" agreement_version " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Agreement Version " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" paperwork_status " ,
2023-12-20 00:54:31 -05:00
models . TextField (
blank = True , db_column = " Paperwork status " , null = True
) ,
2022-02-14 12:44:42 -05:00
) ,
(
" membership_agreement_dated " ,
models . BooleanField ( db_column = " Membership agreement dated " ) ,
) ,
(
" membership_agreement_acknowledgement_page_filled_out " ,
models . BooleanField (
db_column = " Membership Agreement Acknowledgement Page Filled Out "
) ,
) ,
(
" membership_agreement_signed " ,
models . BooleanField ( db_column = " Membership Agreement Signed " ) ,
) ,
(
" liability_form_filled_out " ,
models . BooleanField ( db_column = " Liability Form Filled Out " ) ,
) ,
2022-02-12 00:07:16 -05:00
] ,
options = {
2022-02-14 12:44:42 -05:00
" db_table " : " members " ,
" ordering " : ( " first_name " , " last_name " ) ,
2024-08-26 23:45:39 -04:00
" indexes " : [
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 " ) ,
] ,
2022-02-12 00:07:16 -05:00
} ,
) ,
migrations . CreateModel (
2022-02-14 12:44:42 -05:00
name = " MemberFlag " ,
2022-02-12 00:07:16 -05:00
fields = [
2022-02-14 12:44:42 -05:00
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
2023-12-20 00:54:31 -05:00
(
" flag " ,
models . ForeignKey (
on_delete = django . db . models . deletion . PROTECT ,
to = " membershipworks.flag " ,
) ,
) ,
(
" member " ,
models . ForeignKey (
db_column = " uid " ,
2024-08-26 23:45:39 -04:00
db_constraint = False ,
2023-12-20 00:54:31 -05:00
on_delete = django . db . models . deletion . PROTECT ,
to = " membershipworks.member " ,
) ,
) ,
2022-02-12 00:07:16 -05:00
] ,
options = {
2022-02-14 12:44:42 -05:00
" db_table " : " memberflag " ,
2024-08-26 23:45:39 -04:00
" constraints " : [
models . UniqueConstraint (
fields = ( " member " , " flag " ) , name = " unique_member_flag "
)
] ,
2022-02-12 00:07:16 -05:00
} ,
) ,
2023-12-20 00:54:31 -05:00
migrations . AddField (
model_name = " member " ,
name = " flags " ,
field = models . ManyToManyField (
related_name = " members " ,
through = " membershipworks.MemberFlag " ,
to = " membershipworks.flag " ,
) ,
) ,
2023-12-19 23:42:46 -05:00
migrations . CreateModel (
name = " Transaction " ,
fields = [
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
2024-08-26 23:45:39 -04:00
( " sid " , models . CharField ( blank = True , max_length = 256 , null = True ) ) ,
2023-12-19 23:42:46 -05:00
( " timestamp " , models . DateTimeField ( ) ) ,
( " type " , models . TextField ( blank = True , null = True ) ) ,
(
" sum " ,
models . DecimalField (
blank = True , decimal_places = 4 , max_digits = 13 , null = True
) ,
) ,
(
" fee " ,
models . DecimalField (
blank = True , decimal_places = 4 , max_digits = 13 , null = True
) ,
) ,
( " event_id " , models . TextField ( blank = True , null = True ) ) ,
( " for_what " , models . TextField ( blank = True , db_column = " For " , null = True ) ) ,
( " items " , models . TextField ( blank = True , db_column = " Items " , null = True ) ) ,
(
" discount_code " ,
models . TextField ( blank = True , db_column = " Discount Code " , null = True ) ,
) ,
( " note " , models . TextField ( blank = True , db_column = " Note " , null = True ) ) ,
( " name " , models . TextField ( blank = True , db_column = " Name " , null = True ) ) ,
(
" contact_person " ,
models . TextField ( blank = True , db_column = " Contact Person " , null = True ) ,
) ,
(
" full_address " ,
models . TextField ( blank = True , db_column = " Full Address " , null = True ) ,
) ,
( " street " , models . TextField ( blank = True , db_column = " Street " , null = True ) ) ,
( " city " , models . TextField ( blank = True , db_column = " City " , null = True ) ) ,
(
" state_province " ,
models . TextField ( blank = True , db_column = " State/Province " , null = True ) ,
) ,
(
" postal_code " ,
models . TextField ( blank = True , db_column = " Postal Code " , null = True ) ,
) ,
(
" country " ,
models . TextField ( blank = True , db_column = " Country " , null = True ) ,
) ,
( " phone " , models . TextField ( blank = True , db_column = " Phone " , null = True ) ) ,
( " email " , models . TextField ( blank = True , db_column = " Email " , null = True ) ) ,
(
" member " ,
models . ForeignKey (
blank = True ,
db_column = " uid " ,
2024-08-26 23:45:39 -04:00
db_constraint = False ,
2023-12-19 23:42:46 -05:00
null = True ,
on_delete = django . db . models . deletion . PROTECT ,
related_name = " transactions " ,
to = " membershipworks.member " ,
) ,
) ,
] ,
options = {
" db_table " : " transactions " ,
} ,
) ,
2024-08-26 23:45:39 -04:00
migrations . CreateModel (
name = " EventCategory " ,
fields = [
( " id " , models . IntegerField ( primary_key = True , serialize = False ) ) ,
( " title " , models . TextField ( ) ) ,
] ,
) ,
migrations . CreateModel (
name = " Event " ,
fields = [
(
" eid " ,
models . CharField ( max_length = 255 , primary_key = True , serialize = False ) ,
) ,
( " url " , models . TextField ( ) ) ,
( " title " , models . TextField ( ) ) ,
( " start " , models . DateTimeField ( ) ) ,
( " end " , models . DateTimeField ( blank = True , null = True ) ) ,
( " cap " , models . IntegerField ( blank = True , null = True ) ) ,
( " count " , models . IntegerField ( ) ) ,
(
" calendar " ,
models . IntegerField (
choices = [
( 0 , " Hidden " ) ,
( 1 , " Green " ) ,
( 2 , " Red " ) ,
( 3 , " Yellow " ) ,
( 4 , " Blue " ) ,
( 5 , " Purple " ) ,
( 6 , " Magenta " ) ,
( 7 , " Grey " ) ,
( 8 , " Teal " ) ,
]
) ,
) ,
( " venue " , models . TextField ( blank = True , null = True ) ) ,
(
" category " ,
models . ForeignKey (
on_delete = django . db . models . deletion . PROTECT ,
to = " membershipworks.eventcategory " ,
) ,
) ,
(
" occurred " ,
models . GeneratedField (
db_persist = True ,
expression = models . Q (
( " cap " , 0 ) ,
( " count " , 0 ) ,
( " calendar " , 0 ) ,
_connector = " OR " ,
_negated = True ,
) ,
output_field = models . BooleanField ( ) ,
) ,
) ,
] ,
options = {
" abstract " : False ,
} ,
) ,
migrations . CreateModel (
name = " EventInstructor " ,
fields = [
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
( " name " , models . TextField ( blank = True ) ) ,
(
" member " ,
models . OneToOneField (
blank = True ,
db_constraint = False ,
null = True ,
on_delete = django . db . models . deletion . PROTECT ,
to = " membershipworks.member " ,
) ,
) ,
] ,
) ,
migrations . CreateModel (
name = " EventExt " ,
fields = [
(
" event_ptr " ,
models . OneToOneField (
auto_created = True ,
on_delete = django . db . models . deletion . CASCADE ,
parent_link = True ,
primary_key = True ,
serialize = False ,
to = " membershipworks.event " ,
) ,
) ,
(
" materials_fee " ,
models . DecimalField (
blank = True , decimal_places = 4 , max_digits = 13 , null = True
) ,
) ,
(
" instructor " ,
models . ForeignKey (
blank = True ,
null = True ,
on_delete = django . db . models . deletion . PROTECT ,
to = " membershipworks.eventinstructor " ,
) ,
) ,
(
" instructor_flat_rate " ,
models . DecimalField ( decimal_places = 4 , default = 0 , max_digits = 13 ) ,
) ,
(
" instructor_percentage " ,
models . DecimalField ( decimal_places = 4 , default = 0.5 , max_digits = 5 ) ,
) ,
( " materials_fee_included_in_price " , models . BooleanField ( null = True ) ) ,
( " details " , models . JSONField ( blank = True , null = True ) ) ,
( " registrations " , models . JSONField ( blank = True , null = True ) ) ,
(
" details_timestamp " ,
models . GeneratedField (
db_persist = True ,
expression = models . Func (
Cast ( models . F ( " details___ts " ) , models . IntegerField ( ) ) ,
function = " to_timestamp " ,
) ,
output_field = models . DateTimeField ( ) ,
verbose_name = " Last details fetch " ,
) ,
) ,
( " should_survey " , models . BooleanField ( default = False ) ) ,
( " survey_email_sent " , models . BooleanField ( default = False ) ) ,
] ,
options = {
" verbose_name " : " event " ,
" ordering " : [ " -start " ] ,
} ,
bases = ( " membershipworks.event " , ) ,
) ,
migrations . CreateModel (
name = " EventMeetingTime " ,
fields = [
(
" event " ,
models . ForeignKey (
on_delete = django . db . models . deletion . CASCADE ,
related_name = " meeting_times " ,
to = " membershipworks.eventext " ,
) ,
) ,
(
" reservation_ptr " ,
models . OneToOneField (
auto_created = True ,
on_delete = django . db . models . deletion . CASCADE ,
parent_link = True ,
primary_key = True ,
serialize = False ,
to = " reservations.reservation " ,
) ,
) ,
] ,
options = {
" constraints " : [ ] ,
} ,
) ,
migrations . CreateModel (
name = " EventInvoice " ,
fields = [
(
" uuid " ,
models . UUIDField (
default = uuid . uuid4 ,
editable = False ,
primary_key = True ,
serialize = False ,
) ,
) ,
( " date_submitted " , models . DateField ( ) ) ,
( " date_paid " , models . DateField ( blank = True , null = True ) ) ,
( " pdf " , models . FileField ( upload_to = " protected/invoices/ % Y/ % m/ %d / " ) ) ,
( " amount " , models . DecimalField ( decimal_places = 4 , max_digits = 13 ) ) ,
(
" event " ,
models . OneToOneField (
on_delete = django . db . models . deletion . PROTECT ,
related_name = " invoice " ,
to = " membershipworks.eventext " ,
) ,
) ,
] ,
) ,
migrations . CreateModel (
name = " EventTicketType " ,
fields = [
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
( " label " , models . TextField ( ) ) ,
( " restrict_to " , models . TextField ( blank = True , null = True ) ) ,
( " list_price " , models . FloatField ( ) ) ,
( " quantity " , models . IntegerField ( ) ) ,
] ,
options = {
" managed " : False ,
" base_manager_name " : " objects " ,
} ,
) ,
django_db_views . operations . ViewRunPython (
code = django_db_views . migration_functions . ForwardViewMigration (
" SELECT \n row_number() over () as id, \n eventext.event_ptr_id as event_id, \n tkt.*, \n jsonb_path_query_first( \n eventext.details, \n ' $.tkt[*] ? (exists (@.dsp ? (@[*] == \" 5771675edcdf126302a2f6b9 \" ))).amt ' \n )::numeric as members_price \n FROM membershipworks_eventext AS eventext, \n jsonb_to_recordset(eventext.details -> ' tkt ' ) AS tkt ( \n lbl TEXT, \n amt NUMERIC, \n cnt INT, \n dsp JSONB \n ) " ,
" membershipworks_eventtickettype " ,
engine = " django.db.backends.postgresql " ,
2023-12-20 00:54:31 -05:00
) ,
2024-08-26 23:45:39 -04:00
reverse_code = django_db_views . migration_functions . BackwardViewMigration (
" " ,
" membershipworks_eventtickettype " ,
engine = " django.db.backends.postgresql " ,
) ,
atomic = False ,
2023-12-20 00:54:31 -05:00
) ,
2024-08-26 23:45:39 -04:00
migrations . CreateModel (
name = " EventAttendeeStats " ,
fields = [
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
( " gross_revenue " , models . FloatField ( ) ) ,
] ,
options = {
" managed " : False ,
} ,
2023-12-20 00:54:31 -05:00
) ,
2024-08-26 23:45:39 -04:00
django_db_views . operations . ViewRunPython (
code = django_db_views . migration_functions . ForwardViewMigration (
" SELECT eventext.event_ptr_id as event_id, SUM(usr.sum) as gross_revenue \n FROM \n membershipworks_eventext as eventext, \n jsonb_to_recordset(eventext.details -> ' usr ' ) AS usr ( \n sum NUMERIC \n ) \n GROUP BY event_id " ,
" membershipworks_eventattendeestats " ,
engine = " django.db.backends.postgresql " ,
) ,
reverse_code = django_db_views . migration_functions . BackwardViewMigration (
" " ,
" membershipworks_eventattendeestats " ,
engine = " django.db.backends.postgresql " ,
) ,
atomic = False ,
2023-12-20 00:54:31 -05:00
) ,
2024-08-26 23:45:39 -04:00
migrations . CreateModel (
name = " EventAttendee " ,
fields = [
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
( " name " , models . CharField ( max_length = 256 ) ) ,
( " email " , models . CharField ( max_length = 256 ) ) ,
( " sum " , models . FloatField ( ) ) ,
] ,
options = {
" managed " : False ,
} ,
) ,
django_db_views . operations . ViewRunPython (
code = django_db_views . migration_functions . ForwardViewMigration (
" SELECT eventext.event_ptr_id as event_id, usr.* \n FROM \n membershipworks_eventext AS eventext, \n jsonb_to_recordset(eventext.details -> ' usr ' ) AS usr ( \n uid TEXT, \n nam TEXT, \n eml TEXT, \n sum NUMERIC \n ) " ,
" membershipworks_eventattendee " ,
engine = " django.db.backends.postgresql " ,
) ,
reverse_code = django_db_views . migration_functions . BackwardViewMigration (
" " ,
" membershipworks_eventattendee " ,
engine = " django.db.backends.postgresql " ,
) ,
atomic = False ,
) ,
migrations . CreateModel (
name = " EventTicketAggregate " ,
fields = [
(
" id " ,
models . BigAutoField (
auto_created = True ,
primary_key = True ,
serialize = False ,
verbose_name = " ID " ,
) ,
) ,
( " quantity " , models . IntegerField ( ) ) ,
( " amount " , models . DecimalField ( decimal_places = 4 , max_digits = 13 ) ) ,
( " materials " , models . DecimalField ( decimal_places = 4 , max_digits = 13 ) ) ,
(
" amount_without_materials " ,
models . DecimalField ( decimal_places = 4 , max_digits = 13 ) ,
) ,
(
" instructor_revenue " ,
models . DecimalField ( decimal_places = 4 , max_digits = 13 ) ,
) ,
(
" instructor_amount " ,
models . DecimalField ( decimal_places = 4 , max_digits = 13 ) ,
) ,
] ,
options = {
" managed " : False ,
} ,
) ,
django_db_views . operations . ViewRunPython (
code = django_db_views . migration_functions . ForwardViewMigration (
' SELECT " membershipworks_eventtickettype " . " event_id " , SUM( " membershipworks_eventtickettype " . " cnt " ) AS " quantity " , SUM((CASE WHEN ( " membershipworks_eventtickettype " . " dsp " ? (SELECT U0. " id " FROM " flag " U0 WHERE (U0. " name " = \' Members \' AND U0. " type " = \' folder \' ) ORDER BY U0. " name " ASC LIMIT 1) OR ( " membershipworks_eventtickettype " . " dsp " IS NULL AND ( " membershipworks_event " . " start " < \' 2024-07-01 00:00:00-04:00 \' ::timestamptz OR " membershipworks_eventtickettype " . " members_price " = 0))) THEN " membershipworks_eventtickettype " . " amt " ELSE " membershipworks_eventtickettype " . " members_price " END * " membershipworks_eventtickettype " . " cnt " )) AS " amount " , SUM(CASE WHEN ( " membershipworks_eventext " . " materials_fee_included_in_price " OR ( " membershipworks_eventext " . " materials_fee " = 0 AND " membershipworks_eventext " . " materials_fee " IS NOT NULL)) THEN ( " membershipworks_eventext " . " materials_fee " * " membershipworks_eventtickettype " . " cnt " ) WHEN " membershipworks_eventext " . " materials_fee_included_in_price " IS NULL THEN NULL ELSE 0 END) AS " materials " , SUM(((CASE WHEN ( " membershipworks_eventtickettype " . " dsp " ? (SELECT U0. " id " FROM " flag " U0 WHERE (U0. " name " = \' Members \' AND U0. " type " = \' folder \' ) ORDER BY U0. " name " ASC LIMIT 1) OR ( " membershipworks_eventtickettype " . " dsp " IS NULL AND ( " membershipworks_event " . " start " < \' 2024-07-01 00:00:00-04:00 \' ::timestamptz OR " membershipworks_eventtickettype " . " members_price " = 0))) THEN " membershipworks_eventtickettype " . " amt " ELSE " membershipworks_eventtickettype " . " members_price " END * " membershipworks_eventtickettype " . " cnt " ) - CASE WHEN ( " membershipworks_eventext " . " materials_fee_included_in_price " OR ( " membershipworks_eventext " . " materials_fee " = 0 AND " membershipworks_eventext " . " materials_fee " IS NOT NULL)) THEN ( " membershipworks_eventext " . " materials_fee " * " membershipworks_eventtickettype " . " cnt " ) WHEN " membershipworks_eventext " . " materials_fee_included_in_price " IS NULL THEN NULL ELSE 0 END)) AS " amount_without_materials " , SUM((((CASE WHEN ( " membershipworks_eventtickettype " . " dsp " ? (SELECT U0. " id " FROM " flag " U0 WHERE (U0. " name " = \' Members \' AND U0. " type " = \' folder \' ) ORDER BY U0. " name " ASC LIMIT 1) OR ( " membershipworks_eventtickettype " . " dsp " IS NULL AND ( " membershipworks_event " . " start " < \' 2024-07-01 00:00:00-04:00 \' ::timestamptz OR " membershipworks_eventtickettype " . " members_price " = 0))) THEN " membershipworks_eventtickettype " . " amt " ELSE " membershipworks_eventtickettype " . " members_price " END * " membershipworks_eventtickettype " . " cnt " ) - CASE WHEN ( " membershipworks_eventext " . " materials_fee_included_in_price " OR ( " membershipworks_eventext " . " materials_fee " = 0 AND " membershipworks_eventext " . " materials_fee " IS NOT NULL)) THEN ( " membershipworks_eventext " . " materials_fee " * " membershipworks_eventtickettype " . " cnt " ) WHEN " membershipworks_eventext " . " materials_fee_included_in_price " IS NULL THEN NULL ELSE 0 END) * " membershipworks_eventext " . " instructor_percentage " )) AS " instructor_revenue " , SUM(((((CASE WHEN ( " membershipworks_eventtickettype " . " dsp " ? (SELECT U0. " id " FROM " flag " U0 WHERE (U0. " name " = \' Members \' AND U0. " type " = \' folder \' ) ORDER BY U0. " name " ASC LIMIT 1) OR ( " membershipworks_eventtickettype " . " dsp " IS NULL AND ( " membershipworks_event " . " start " < \' 2024-07-01 00:00:00-04:00 \' ::timestamptz OR " membershipworks_eventtickettype " . " members_price " = 0))) THEN " membershipworks_eventtickettype " . " amt " ELSE " membershipworks_eventtickettype " . " members_price " END * " membershipworks_eventtickettype " . " cnt " ) - CASE WHEN ( " membershipworks_eventext " . " materials_fee_included_in_price " OR ( " membershipworks_eventext " . " materials_fee " = 0 AND " membershipworks_eventext " . " materials_fee " IS NOT NULL)) THEN ( " membershipworks_eventext " . " materials_fee " * " membershipworks_eventtickettype " . " cnt " ) WHEN " membershipworks_eventext " . " materials_fee_included_in_price " IS NULL THEN NULL ELSE 0 END) * " membershipworks_eventext " . " instructor_percentage " ) + CASE WHEN ( " membershipworks_eventext " . " materials_fee_included_in_price " OR ( " membershipworks_eventext " . " materials_fee " = 0 AND " membershipworks_eventext " . " materials_fee " IS NOT NU
" membershipworks_eventticketaggregate " ,
engine = " django.db.backends.postgresql " ,
) ,
reverse_code = django_db_views . migration_functions . BackwardViewMigration (
" " ,
" membershipworks_eventticketaggregate " ,
engine = " django.db.backends.postgresql " ,
) ,
atomic = False ,
2023-12-20 00:54:31 -05:00
) ,
2022-02-12 00:07:16 -05:00
]