agrs-sequelize-sdk 1.4.52 → 1.4.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations/2026-05-17-PIXELS-FOLLOWUP.md +85 -85
- package/migrations/2026-05-17-add-platform-to-ad.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adaccount.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adperformance.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adset.js +19 -19
- package/migrations/2026-05-17-add-platform-to-adsetperformance.js +19 -19
- package/migrations/2026-05-17-add-platform-to-aiarticleretryqueue.js +19 -19
- package/migrations/2026-05-17-add-platform-to-aicampaignqueue.js +19 -19
- package/migrations/2026-05-17-add-platform-to-article.js +19 -19
- package/migrations/2026-05-17-add-platform-to-campaign.js +19 -19
- package/migrations/2026-05-17-add-platform-to-codefuelcampaign.js +19 -19
- package/migrations/2026-05-17-add-platform-to-dynamicfeed.js +19 -19
- package/migrations/2026-05-17-add-platform-to-facebookretryqueue.js +19 -19
- package/migrations/2026-05-17-add-platform-to-pages.js +19 -19
- package/migrations/2026-05-17-add-platform-to-presets.js +19 -19
- package/migrations/2026-05-18-add-group-id-to-ai-campaign-queue.js +18 -18
- package/migrations/2026-05-18-add-platform-code-to-creation-logs.js +65 -65
- package/migrations/2026-05-18-add-platform-code-to-pixels.js +55 -55
- package/migrations/2026-05-18-add-platform-code-to-rsoc-feed-campaigns.js +55 -55
- package/migrations/2026-05-18-add-platform-date-index-to-adperformance.js +16 -16
- package/migrations/2026-05-18-add-platform-date-index-to-adsetperformance.js +16 -16
- package/migrations/2026-05-18-add-review-status-to-ad.js +36 -36
- package/migrations/2026-05-18-create-canonical-insights.js +84 -84
- package/migrations/2026-05-18-create-snapchat-public-profiles.js +68 -68
- package/migrations/2026-05-18-create-tiktok-identities.js +71 -71
- package/migrations/2026-05-18-create-tiktok-snapchat-campaigns.js +143 -143
- package/migrations/2026-05-18-create-tt-snp-adset-ad-tables.js +309 -309
- package/migrations/RUN_ME_MANUALLY_2026-05-17.sql +99 -99
- package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
- package/migrations/change-adset-name-to-text.js +79 -79
- package/models/AICampaignQueue.js +152 -152
- package/models/AIGenerationLog.js +85 -85
- package/models/AIGenerationRequest.js +212 -212
- package/models/AdAccountValues.js +25 -25
- package/models/AdHistory.js +30 -30
- package/models/AdPerformance.js +104 -104
- package/models/AdSet.js +295 -295
- package/models/AdSetHistory.js +30 -30
- package/models/AdsetPerformance.js +137 -137
- package/models/AiArticleRetryQueue.js +157 -157
- package/models/AiCreationRetryQueue.js +134 -134
- package/models/ApiAuditLog.js +127 -127
- package/models/ApiToken.js +67 -67
- package/models/Article.js +222 -222
- package/models/AutomationRule.js +179 -179
- package/models/BannerTemplate.js +129 -129
- package/models/Buyers.js +25 -25
- package/models/Campaign.js +168 -163
- package/models/CampaignActionHistory.js +101 -101
- package/models/CampaignCreationLog.js +340 -340
- package/models/CampaignCreationLogV2.js +392 -392
- package/models/CampaignHistory.js +33 -33
- package/models/CampaignTag.js +46 -0
- package/models/CampaignTagAssignment.js +48 -0
- package/models/CanonicalInsights.js +68 -68
- package/models/Channel.js +55 -55
- package/models/Domain.js +44 -44
- package/models/DynamicFeed.js +218 -218
- package/models/ExplorAdsChannel.js +61 -61
- package/models/FacebookRetryQueue.js +163 -163
- package/models/Feed.js +33 -33
- package/models/FeedArticleConfiguration.js +80 -80
- package/models/FrontStoryChannel.js +59 -59
- package/models/FrontStoryChannelV2.js +60 -60
- package/models/GenericFlowRequest.js +114 -114
- package/models/MidoWebChannel.js +47 -47
- package/models/MineBrandBlocklist.js +40 -40
- package/models/MineChannel.js +42 -42
- package/models/MineRedirectDomain.js +36 -36
- package/models/MineWebhookEvent.js +53 -53
- package/models/Pages.js +117 -117
- package/models/PipelineExecution.js +59 -59
- package/models/PolicyDogsCreativeCache.js +50 -50
- package/models/PolicyDogsImageCache.js +30 -30
- package/models/Presets.js +40 -40
- package/models/PublicApiBatch.js +155 -155
- package/models/PublicApiBatchItem.js +166 -166
- package/models/PublicApiIdempotencyCache.js +135 -135
- package/models/RSOCFeedCampaign.js +387 -387
- package/models/RsocKeywordPerformance.js +110 -110
- package/models/RuleAction.js +90 -90
- package/models/RuleCondition.js +137 -137
- package/models/RuleExecution.js +107 -107
- package/models/RulesValues.js +56 -56
- package/models/SingularChannel.js +31 -31
- package/models/SnapchatAd.js +69 -69
- package/models/SnapchatAdSquad.js +92 -92
- package/models/SnapchatCampaign.js +69 -69
- package/models/SnapchatChannel.js +31 -31
- package/models/SnapchatPublicProfiles.js +67 -67
- package/models/SupportedLocale.js +23 -23
- package/models/SyncHistory.js +249 -249
- package/models/TTQChannel.js +42 -42
- package/models/TemplateMetadata.js +260 -260
- package/models/Tier2_AdAccounts.js +110 -110
- package/models/Tier2_Assets.js +70 -70
- package/models/Tier2_BusinessManagers.js +105 -105
- package/models/Tier2_CreditLines.js +99 -99
- package/models/Tier2_Pages.js +91 -91
- package/models/Tier2_Pixels.js +82 -82
- package/models/Tier2_Tokens.js +64 -64
- package/models/Tier2_UserAdAccounts.js +83 -83
- package/models/TikTokAd.js +71 -71
- package/models/TikTokAdGroup.js +82 -82
- package/models/TikTokCampaign.js +71 -71
- package/models/TiktokChannel.js +31 -31
- package/models/TiktokIdentities.js +65 -65
- package/models/TokenRotationState.js +121 -121
- package/models/TonicRSOCKeywordPerformance.js +122 -122
- package/models/Users.js +190 -185
- package/models/Vertical.js +25 -25
- package/models/newFiles.js +137 -137
- package/package.json +21 -19
- package/run.sh +214 -214
- package/services/sequelizeService.js +110 -110
- package/tarzo-skalio-integration-docs.md +691 -691
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
up: async (queryInterface, Sequelize) => {
|
|
5
|
-
await queryInterface.createTable("canonical_insights", {
|
|
6
|
-
id: {
|
|
7
|
-
type: Sequelize.BIGINT,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
autoIncrement: true,
|
|
10
|
-
allowNull: false,
|
|
11
|
-
},
|
|
12
|
-
platform: {
|
|
13
|
-
type: Sequelize.ENUM("fb", "tt", "snp"),
|
|
14
|
-
allowNull: false,
|
|
15
|
-
comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
|
|
16
|
-
},
|
|
17
|
-
entity_type: {
|
|
18
|
-
type: Sequelize.ENUM("campaign", "adset", "ad"),
|
|
19
|
-
allowNull: false,
|
|
20
|
-
},
|
|
21
|
-
entity_id: {
|
|
22
|
-
type: Sequelize.STRING(64),
|
|
23
|
-
allowNull: false,
|
|
24
|
-
},
|
|
25
|
-
date: {
|
|
26
|
-
type: Sequelize.DATEONLY,
|
|
27
|
-
allowNull: false,
|
|
28
|
-
},
|
|
29
|
-
impressions: {
|
|
30
|
-
type: Sequelize.BIGINT,
|
|
31
|
-
defaultValue: 0,
|
|
32
|
-
},
|
|
33
|
-
clicks: {
|
|
34
|
-
type: Sequelize.BIGINT,
|
|
35
|
-
defaultValue: 0,
|
|
36
|
-
},
|
|
37
|
-
spend: {
|
|
38
|
-
type: Sequelize.DECIMAL(14, 4),
|
|
39
|
-
defaultValue: 0,
|
|
40
|
-
},
|
|
41
|
-
conversions: {
|
|
42
|
-
type: Sequelize.BIGINT,
|
|
43
|
-
defaultValue: 0,
|
|
44
|
-
},
|
|
45
|
-
revenue: {
|
|
46
|
-
type: Sequelize.DECIMAL(14, 4),
|
|
47
|
-
defaultValue: 0,
|
|
48
|
-
},
|
|
49
|
-
raw_payload: {
|
|
50
|
-
type: Sequelize.JSONB,
|
|
51
|
-
allowNull: true,
|
|
52
|
-
},
|
|
53
|
-
createdAt: {
|
|
54
|
-
type: Sequelize.DATE,
|
|
55
|
-
allowNull: false,
|
|
56
|
-
},
|
|
57
|
-
updatedAt: {
|
|
58
|
-
type: Sequelize.DATE,
|
|
59
|
-
allowNull: false,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
await queryInterface.addIndex(
|
|
64
|
-
"canonical_insights",
|
|
65
|
-
["platform", "entity_type", "entity_id", "date"],
|
|
66
|
-
{
|
|
67
|
-
unique: true,
|
|
68
|
-
name: "canonical_insights_unique_per_entity_date",
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
await queryInterface.addIndex("canonical_insights", ["platform", "date"]);
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
down: async (queryInterface) => {
|
|
76
|
-
await queryInterface.dropTable("canonical_insights");
|
|
77
|
-
await queryInterface.sequelize.query(
|
|
78
|
-
'DROP TYPE IF EXISTS "enum_canonical_insights_platform";'
|
|
79
|
-
);
|
|
80
|
-
await queryInterface.sequelize.query(
|
|
81
|
-
'DROP TYPE IF EXISTS "enum_canonical_insights_entity_type";'
|
|
82
|
-
);
|
|
83
|
-
},
|
|
84
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
await queryInterface.createTable("canonical_insights", {
|
|
6
|
+
id: {
|
|
7
|
+
type: Sequelize.BIGINT,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
autoIncrement: true,
|
|
10
|
+
allowNull: false,
|
|
11
|
+
},
|
|
12
|
+
platform: {
|
|
13
|
+
type: Sequelize.ENUM("fb", "tt", "snp"),
|
|
14
|
+
allowNull: false,
|
|
15
|
+
comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
|
|
16
|
+
},
|
|
17
|
+
entity_type: {
|
|
18
|
+
type: Sequelize.ENUM("campaign", "adset", "ad"),
|
|
19
|
+
allowNull: false,
|
|
20
|
+
},
|
|
21
|
+
entity_id: {
|
|
22
|
+
type: Sequelize.STRING(64),
|
|
23
|
+
allowNull: false,
|
|
24
|
+
},
|
|
25
|
+
date: {
|
|
26
|
+
type: Sequelize.DATEONLY,
|
|
27
|
+
allowNull: false,
|
|
28
|
+
},
|
|
29
|
+
impressions: {
|
|
30
|
+
type: Sequelize.BIGINT,
|
|
31
|
+
defaultValue: 0,
|
|
32
|
+
},
|
|
33
|
+
clicks: {
|
|
34
|
+
type: Sequelize.BIGINT,
|
|
35
|
+
defaultValue: 0,
|
|
36
|
+
},
|
|
37
|
+
spend: {
|
|
38
|
+
type: Sequelize.DECIMAL(14, 4),
|
|
39
|
+
defaultValue: 0,
|
|
40
|
+
},
|
|
41
|
+
conversions: {
|
|
42
|
+
type: Sequelize.BIGINT,
|
|
43
|
+
defaultValue: 0,
|
|
44
|
+
},
|
|
45
|
+
revenue: {
|
|
46
|
+
type: Sequelize.DECIMAL(14, 4),
|
|
47
|
+
defaultValue: 0,
|
|
48
|
+
},
|
|
49
|
+
raw_payload: {
|
|
50
|
+
type: Sequelize.JSONB,
|
|
51
|
+
allowNull: true,
|
|
52
|
+
},
|
|
53
|
+
createdAt: {
|
|
54
|
+
type: Sequelize.DATE,
|
|
55
|
+
allowNull: false,
|
|
56
|
+
},
|
|
57
|
+
updatedAt: {
|
|
58
|
+
type: Sequelize.DATE,
|
|
59
|
+
allowNull: false,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
await queryInterface.addIndex(
|
|
64
|
+
"canonical_insights",
|
|
65
|
+
["platform", "entity_type", "entity_id", "date"],
|
|
66
|
+
{
|
|
67
|
+
unique: true,
|
|
68
|
+
name: "canonical_insights_unique_per_entity_date",
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
await queryInterface.addIndex("canonical_insights", ["platform", "date"]);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
down: async (queryInterface) => {
|
|
76
|
+
await queryInterface.dropTable("canonical_insights");
|
|
77
|
+
await queryInterface.sequelize.query(
|
|
78
|
+
'DROP TYPE IF EXISTS "enum_canonical_insights_platform";'
|
|
79
|
+
);
|
|
80
|
+
await queryInterface.sequelize.query(
|
|
81
|
+
'DROP TYPE IF EXISTS "enum_canonical_insights_entity_type";'
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates the `snapchat_public_profiles` rotation pool used by
|
|
5
|
-
* `assetResolver.getDefaultAssetForPlatform({ platform: 'snp' })`.
|
|
6
|
-
*
|
|
7
|
-
* Additive-only: no foreign keys, no touching of existing tables.
|
|
8
|
-
* Safe to apply on production. Pre-seed environments fall back to the
|
|
9
|
-
* `SNAPCHAT_DEFAULT_PUBLIC_PROFILE_ID` env var until rows exist.
|
|
10
|
-
*/
|
|
11
|
-
module.exports = {
|
|
12
|
-
up: async (queryInterface, Sequelize) => {
|
|
13
|
-
await queryInterface.createTable("snapchat_public_profiles", {
|
|
14
|
-
id: {
|
|
15
|
-
type: Sequelize.BIGINT,
|
|
16
|
-
primaryKey: true,
|
|
17
|
-
autoIncrement: true,
|
|
18
|
-
},
|
|
19
|
-
public_profile_id: {
|
|
20
|
-
type: Sequelize.STRING(64),
|
|
21
|
-
allowNull: false,
|
|
22
|
-
unique: true,
|
|
23
|
-
},
|
|
24
|
-
name: {
|
|
25
|
-
type: Sequelize.STRING(255),
|
|
26
|
-
allowNull: true,
|
|
27
|
-
},
|
|
28
|
-
ad_account_id: {
|
|
29
|
-
type: Sequelize.STRING(64),
|
|
30
|
-
allowNull: false,
|
|
31
|
-
},
|
|
32
|
-
status: {
|
|
33
|
-
type: Sequelize.STRING(16),
|
|
34
|
-
allowNull: false,
|
|
35
|
-
defaultValue: "active",
|
|
36
|
-
},
|
|
37
|
-
tier: {
|
|
38
|
-
type: Sequelize.INTEGER,
|
|
39
|
-
allowNull: false,
|
|
40
|
-
defaultValue: 1,
|
|
41
|
-
},
|
|
42
|
-
createdAt: {
|
|
43
|
-
type: Sequelize.DATE,
|
|
44
|
-
allowNull: false,
|
|
45
|
-
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
46
|
-
},
|
|
47
|
-
updatedAt: {
|
|
48
|
-
type: Sequelize.DATE,
|
|
49
|
-
allowNull: false,
|
|
50
|
-
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
await queryInterface.addIndex(
|
|
55
|
-
"snapchat_public_profiles",
|
|
56
|
-
["ad_account_id", "status"],
|
|
57
|
-
{ name: "snapchat_public_profiles_ad_account_status_idx" }
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
down: async (queryInterface) => {
|
|
62
|
-
await queryInterface.removeIndex(
|
|
63
|
-
"snapchat_public_profiles",
|
|
64
|
-
"snapchat_public_profiles_ad_account_status_idx"
|
|
65
|
-
);
|
|
66
|
-
await queryInterface.dropTable("snapchat_public_profiles");
|
|
67
|
-
},
|
|
68
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates the `snapchat_public_profiles` rotation pool used by
|
|
5
|
+
* `assetResolver.getDefaultAssetForPlatform({ platform: 'snp' })`.
|
|
6
|
+
*
|
|
7
|
+
* Additive-only: no foreign keys, no touching of existing tables.
|
|
8
|
+
* Safe to apply on production. Pre-seed environments fall back to the
|
|
9
|
+
* `SNAPCHAT_DEFAULT_PUBLIC_PROFILE_ID` env var until rows exist.
|
|
10
|
+
*/
|
|
11
|
+
module.exports = {
|
|
12
|
+
up: async (queryInterface, Sequelize) => {
|
|
13
|
+
await queryInterface.createTable("snapchat_public_profiles", {
|
|
14
|
+
id: {
|
|
15
|
+
type: Sequelize.BIGINT,
|
|
16
|
+
primaryKey: true,
|
|
17
|
+
autoIncrement: true,
|
|
18
|
+
},
|
|
19
|
+
public_profile_id: {
|
|
20
|
+
type: Sequelize.STRING(64),
|
|
21
|
+
allowNull: false,
|
|
22
|
+
unique: true,
|
|
23
|
+
},
|
|
24
|
+
name: {
|
|
25
|
+
type: Sequelize.STRING(255),
|
|
26
|
+
allowNull: true,
|
|
27
|
+
},
|
|
28
|
+
ad_account_id: {
|
|
29
|
+
type: Sequelize.STRING(64),
|
|
30
|
+
allowNull: false,
|
|
31
|
+
},
|
|
32
|
+
status: {
|
|
33
|
+
type: Sequelize.STRING(16),
|
|
34
|
+
allowNull: false,
|
|
35
|
+
defaultValue: "active",
|
|
36
|
+
},
|
|
37
|
+
tier: {
|
|
38
|
+
type: Sequelize.INTEGER,
|
|
39
|
+
allowNull: false,
|
|
40
|
+
defaultValue: 1,
|
|
41
|
+
},
|
|
42
|
+
createdAt: {
|
|
43
|
+
type: Sequelize.DATE,
|
|
44
|
+
allowNull: false,
|
|
45
|
+
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
46
|
+
},
|
|
47
|
+
updatedAt: {
|
|
48
|
+
type: Sequelize.DATE,
|
|
49
|
+
allowNull: false,
|
|
50
|
+
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
await queryInterface.addIndex(
|
|
55
|
+
"snapchat_public_profiles",
|
|
56
|
+
["ad_account_id", "status"],
|
|
57
|
+
{ name: "snapchat_public_profiles_ad_account_status_idx" }
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
down: async (queryInterface) => {
|
|
62
|
+
await queryInterface.removeIndex(
|
|
63
|
+
"snapchat_public_profiles",
|
|
64
|
+
"snapchat_public_profiles_ad_account_status_idx"
|
|
65
|
+
);
|
|
66
|
+
await queryInterface.dropTable("snapchat_public_profiles");
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates the `tiktok_identities` rotation pool used by
|
|
5
|
-
* `assetResolver.getDefaultAssetForPlatform({ platform: 'tt' })`.
|
|
6
|
-
*
|
|
7
|
-
* Additive-only: no foreign keys, no touching of existing tables.
|
|
8
|
-
* Safe to apply on production. Pre-seed environments fall back to the
|
|
9
|
-
* `TIKTOK_DEFAULT_IDENTITY_ID` env var until rows exist.
|
|
10
|
-
*/
|
|
11
|
-
module.exports = {
|
|
12
|
-
up: async (queryInterface, Sequelize) => {
|
|
13
|
-
await queryInterface.createTable("tiktok_identities", {
|
|
14
|
-
id: {
|
|
15
|
-
type: Sequelize.BIGINT,
|
|
16
|
-
primaryKey: true,
|
|
17
|
-
autoIncrement: true,
|
|
18
|
-
},
|
|
19
|
-
identity_id: {
|
|
20
|
-
type: Sequelize.STRING(64),
|
|
21
|
-
allowNull: false,
|
|
22
|
-
unique: true,
|
|
23
|
-
},
|
|
24
|
-
identity_type: {
|
|
25
|
-
type: Sequelize.STRING(32),
|
|
26
|
-
allowNull: false,
|
|
27
|
-
defaultValue: "CUSTOMIZED_USER",
|
|
28
|
-
},
|
|
29
|
-
name: {
|
|
30
|
-
type: Sequelize.STRING(255),
|
|
31
|
-
allowNull: true,
|
|
32
|
-
},
|
|
33
|
-
ad_account_id: {
|
|
34
|
-
type: Sequelize.STRING(64),
|
|
35
|
-
allowNull: false,
|
|
36
|
-
},
|
|
37
|
-
status: {
|
|
38
|
-
type: Sequelize.STRING(16),
|
|
39
|
-
allowNull: false,
|
|
40
|
-
defaultValue: "active",
|
|
41
|
-
},
|
|
42
|
-
tier: {
|
|
43
|
-
type: Sequelize.INTEGER,
|
|
44
|
-
allowNull: false,
|
|
45
|
-
defaultValue: 1,
|
|
46
|
-
},
|
|
47
|
-
createdAt: {
|
|
48
|
-
type: Sequelize.DATE,
|
|
49
|
-
allowNull: false,
|
|
50
|
-
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
51
|
-
},
|
|
52
|
-
updatedAt: {
|
|
53
|
-
type: Sequelize.DATE,
|
|
54
|
-
allowNull: false,
|
|
55
|
-
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
await queryInterface.addIndex("tiktok_identities", ["ad_account_id", "status"], {
|
|
60
|
-
name: "tiktok_identities_ad_account_status_idx",
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
down: async (queryInterface) => {
|
|
65
|
-
await queryInterface.removeIndex(
|
|
66
|
-
"tiktok_identities",
|
|
67
|
-
"tiktok_identities_ad_account_status_idx"
|
|
68
|
-
);
|
|
69
|
-
await queryInterface.dropTable("tiktok_identities");
|
|
70
|
-
},
|
|
71
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates the `tiktok_identities` rotation pool used by
|
|
5
|
+
* `assetResolver.getDefaultAssetForPlatform({ platform: 'tt' })`.
|
|
6
|
+
*
|
|
7
|
+
* Additive-only: no foreign keys, no touching of existing tables.
|
|
8
|
+
* Safe to apply on production. Pre-seed environments fall back to the
|
|
9
|
+
* `TIKTOK_DEFAULT_IDENTITY_ID` env var until rows exist.
|
|
10
|
+
*/
|
|
11
|
+
module.exports = {
|
|
12
|
+
up: async (queryInterface, Sequelize) => {
|
|
13
|
+
await queryInterface.createTable("tiktok_identities", {
|
|
14
|
+
id: {
|
|
15
|
+
type: Sequelize.BIGINT,
|
|
16
|
+
primaryKey: true,
|
|
17
|
+
autoIncrement: true,
|
|
18
|
+
},
|
|
19
|
+
identity_id: {
|
|
20
|
+
type: Sequelize.STRING(64),
|
|
21
|
+
allowNull: false,
|
|
22
|
+
unique: true,
|
|
23
|
+
},
|
|
24
|
+
identity_type: {
|
|
25
|
+
type: Sequelize.STRING(32),
|
|
26
|
+
allowNull: false,
|
|
27
|
+
defaultValue: "CUSTOMIZED_USER",
|
|
28
|
+
},
|
|
29
|
+
name: {
|
|
30
|
+
type: Sequelize.STRING(255),
|
|
31
|
+
allowNull: true,
|
|
32
|
+
},
|
|
33
|
+
ad_account_id: {
|
|
34
|
+
type: Sequelize.STRING(64),
|
|
35
|
+
allowNull: false,
|
|
36
|
+
},
|
|
37
|
+
status: {
|
|
38
|
+
type: Sequelize.STRING(16),
|
|
39
|
+
allowNull: false,
|
|
40
|
+
defaultValue: "active",
|
|
41
|
+
},
|
|
42
|
+
tier: {
|
|
43
|
+
type: Sequelize.INTEGER,
|
|
44
|
+
allowNull: false,
|
|
45
|
+
defaultValue: 1,
|
|
46
|
+
},
|
|
47
|
+
createdAt: {
|
|
48
|
+
type: Sequelize.DATE,
|
|
49
|
+
allowNull: false,
|
|
50
|
+
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
51
|
+
},
|
|
52
|
+
updatedAt: {
|
|
53
|
+
type: Sequelize.DATE,
|
|
54
|
+
allowNull: false,
|
|
55
|
+
defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await queryInterface.addIndex("tiktok_identities", ["ad_account_id", "status"], {
|
|
60
|
+
name: "tiktok_identities_ad_account_status_idx",
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
down: async (queryInterface) => {
|
|
65
|
+
await queryInterface.removeIndex(
|
|
66
|
+
"tiktok_identities",
|
|
67
|
+
"tiktok_identities_ad_account_status_idx"
|
|
68
|
+
);
|
|
69
|
+
await queryInterface.dropTable("tiktok_identities");
|
|
70
|
+
},
|
|
71
|
+
};
|