-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(data-warehouse): salesforce add model (#26369)
- Loading branch information
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
posthog/migrations/0522_datawarehouse_salesforce_opportunity.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 4.2.15 on 2024-11-25 02:41 | ||
from django.db import migrations, connection | ||
|
||
|
||
def insert_salesforce_opportunity_schemas(apps, schema_editor): | ||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT id, team_id FROM posthog_externaldatasource where source_type = 'Salesforce'") | ||
salesforce_sources = cursor.fetchall() | ||
|
||
ExternalDataSchema = apps.get_model("posthog", "ExternalDataSchema") | ||
for source in salesforce_sources: | ||
schema = ExternalDataSchema.objects.create( | ||
name="Opportunity", | ||
source_id=source[0], | ||
team_id=source[1], | ||
should_sync=False, | ||
sync_type=None, | ||
sync_type_config={}, | ||
) | ||
schema.save() | ||
|
||
|
||
def reverse(apps, _): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("posthog", "0521_alter_errortrackingstackframe_context"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(insert_salesforce_opportunity_schemas, reverse), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0521_alter_errortrackingstackframe_context | ||
0522_datawarehouse_salesforce_opportunity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters