1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.adservices.data.measurement; 18 19 import com.android.adservices.data.measurement.migration.MeasurementTablesDeprecated; 20 21 import java.util.Arrays; 22 import java.util.Collections; 23 import java.util.List; 24 25 /** 26 * Container class for Measurement PPAPI table definitions and constants. 27 */ 28 public final class MeasurementTables { 29 public static final String MSMT_TABLE_PREFIX = "msmt_"; 30 public static final String INDEX_PREFIX = "idx_"; 31 32 /** 33 * Array of all Measurement related tables. The AdTechUrls table is not included in the 34 * Measurement tables because it will be used for a more general purpose. 35 */ 36 // TODO(b/237306788): Move AdTechUrls tables to common tables and add method to delete common 37 // tables. 38 public static final String[] ALL_MSMT_TABLES = { 39 MeasurementTables.SourceContract.TABLE, 40 MeasurementTables.SourceDestination.TABLE, 41 SourceAttributionScopeContract.TABLE, 42 SourceNamedBudgetContract.TABLE, 43 MeasurementTables.TriggerContract.TABLE, 44 MeasurementTables.EventReportContract.TABLE, 45 MeasurementTables.AggregateReport.TABLE, 46 MeasurementTables.AggregateEncryptionKey.TABLE, 47 MeasurementTables.AttributionContract.TABLE, 48 MeasurementTables.AsyncRegistrationContract.TABLE, 49 MeasurementTables.DebugReportContract.TABLE, 50 MeasurementTables.AggregatableDebugReportBudgetTrackerContract.TABLE, 51 MeasurementTables.XnaIgnoredSourcesContract.TABLE, 52 KeyValueDataContract.TABLE, 53 AppReportHistoryContract.TABLE, 54 CountUniqueReportingContract.TABLE, 55 CountUniqueMetadataContract.TABLE, 56 }; 57 58 public static final String[] V6_TABLES = { 59 // Source & Trigger table should always be at the top to avoid foreign key constraint 60 // failures in other tables. 61 MeasurementTables.SourceContract.TABLE, 62 MeasurementTables.TriggerContract.TABLE, 63 MeasurementTables.EventReportContract.TABLE, 64 MeasurementTables.AggregateReport.TABLE, 65 MeasurementTables.AggregateEncryptionKey.TABLE, 66 MeasurementTables.AttributionContract.TABLE, 67 MeasurementTables.AsyncRegistrationContract.TABLE, 68 MeasurementTables.DebugReportContract.TABLE, 69 MeasurementTables.XnaIgnoredSourcesContract.TABLE 70 }; 71 72 public static final String[] V1_TABLES = { 73 SourceContract.TABLE, 74 TriggerContract.TABLE, 75 EventReportContract.TABLE, 76 AggregateReport.TABLE, 77 AggregateEncryptionKey.TABLE, 78 AttributionContract.TABLE, 79 AsyncRegistrationContract.TABLE, 80 }; 81 82 /** Contract for asynchronous Registration. */ 83 public interface AsyncRegistrationContract { 84 String TABLE = MSMT_TABLE_PREFIX + "async_registration_contract"; 85 String ID = "_id"; 86 String REGISTRATION_URI = "registration_uri"; 87 String TOP_ORIGIN = "top_origin"; 88 String SOURCE_TYPE = "source_type"; 89 String REGISTRANT = "registrant"; 90 String REQUEST_TIME = "request_time"; 91 String RETRY_COUNT = "retry_count"; 92 String TYPE = "type"; 93 String WEB_DESTINATION = "web_destination"; 94 String OS_DESTINATION = "os_destination"; 95 String VERIFIED_DESTINATION = "verified_destination"; 96 String DEBUG_KEY_ALLOWED = "debug_key_allowed"; 97 String AD_ID_PERMISSION = "ad_id_permission"; 98 String REGISTRATION_ID = "registration_id"; 99 String PLATFORM_AD_ID = "platform_ad_id"; 100 String REQUEST_POST_BODY = "request_post_body"; 101 String REDIRECT_BEHAVIOR = "redirect_behavior"; 102 } 103 104 /** Contract for Source. */ 105 public interface SourceContract { 106 String TABLE = MSMT_TABLE_PREFIX + "source"; 107 String ID = "_id"; 108 String EVENT_ID = "event_id"; 109 String PUBLISHER = "publisher"; 110 String PUBLISHER_TYPE = "publisher_type"; 111 String EVENT_REPORT_DEDUP_KEYS = "event_report_dedup_keys"; 112 String AGGREGATE_REPORT_DEDUP_KEYS = "aggregate_report_dedup_keys"; 113 String EVENT_TIME = "event_time"; 114 String EXPIRY_TIME = "expiry_time"; 115 String EVENT_REPORT_WINDOW = "event_report_window"; 116 String AGGREGATABLE_REPORT_WINDOW = "aggregatable_report_window"; 117 String PRIORITY = "priority"; 118 String STATUS = "status"; 119 String SOURCE_TYPE = "source_type"; 120 String ENROLLMENT_ID = "enrollment_id"; 121 String REGISTRANT = "registrant"; 122 String ATTRIBUTION_MODE = "attribution_mode"; 123 String INSTALL_ATTRIBUTION_WINDOW = "install_attribution_window"; 124 String INSTALL_COOLDOWN_WINDOW = "install_cooldown_window"; 125 String IS_INSTALL_ATTRIBUTED = "is_install_attributed"; 126 String FILTER_DATA = "filter_data"; 127 String SHARED_FILTER_DATA_KEYS = "shared_filter_data_keys"; 128 String AGGREGATE_SOURCE = "aggregate_source"; 129 String AGGREGATE_CONTRIBUTIONS = "aggregate_contributions"; 130 String DEBUG_KEY = "debug_key"; 131 String DEBUG_REPORTING = "debug_reporting"; 132 String AD_ID_PERMISSION = "ad_id_permission"; 133 String AR_DEBUG_PERMISSION = "ar_debug_permission"; 134 String REGISTRATION_ID = "registration_id"; 135 String SHARED_AGGREGATION_KEYS = "shared_aggregation_keys"; 136 String INSTALL_TIME = "install_time"; 137 String DEBUG_JOIN_KEY = "debug_join_key"; 138 String TRIGGER_DATA = "trigger_data"; 139 String TRIGGER_SPECS = "trigger_specs"; 140 String PLATFORM_AD_ID = "platform_ad_id"; 141 String DEBUG_AD_ID = "debug_ad_id"; 142 String REGISTRATION_ORIGIN = "registration_origin"; 143 String COARSE_EVENT_REPORT_DESTINATIONS = "coarse_event_report_destinations"; 144 String EVENT_ATTRIBUTION_STATUS = "event_attribution_status"; 145 String PRIVACY_PARAMETERS = "privacy_parameters"; 146 String EVENT_REPORT_WINDOWS = "event_report_windows"; 147 String MAX_EVENT_LEVEL_REPORTS = "max_event_level_reports"; 148 String SHARED_DEBUG_KEY = "shared_debug_key"; 149 String TRIGGER_DATA_MATCHING = "trigger_data_matching"; 150 String ATTRIBUTION_SCOPE_LIMIT = "attribution_scope_limit"; 151 String MAX_EVENT_STATES = "max_event_states"; 152 String REINSTALL_REATTRIBUTION_WINDOW = "reinstall_reattribution_window"; 153 String DESTINATION_LIMIT_PRIORITY = "destination_limit_priority"; 154 String EVENT_LEVEL_EPSILON = "event_level_epsilon"; 155 String AGGREGATE_DEBUG_REPORTING = "aggregate_debug_reporting"; 156 String AGGREGATE_DEBUG_REPORT_CONTRIBUTIONS = "aggregate_debug_report_contributions"; 157 } 158 159 /** Contract for sub-table for destinations in Source. */ 160 public interface SourceDestination { 161 String TABLE = MSMT_TABLE_PREFIX + "source_destination"; 162 String SOURCE_ID = "source_id"; 163 String DESTINATION_TYPE = "destination_type"; 164 String DESTINATION = "destination"; 165 } 166 167 /** Contract for sub-table for attribution scopes in Source. */ 168 public interface SourceAttributionScopeContract { 169 String TABLE = MSMT_TABLE_PREFIX + "source_attribution_scope"; 170 String SOURCE_ID = "source_id"; 171 String ATTRIBUTION_SCOPE = "attribution_scope"; 172 } 173 174 /** Contract for sub-table for aggregatable named budgets in Source. */ 175 public interface SourceNamedBudgetContract { 176 String TABLE = MSMT_TABLE_PREFIX + "source_named_budget"; 177 String SOURCE_ID = "source_id"; 178 String NAME = "name"; 179 String BUDGET = "budget"; 180 String AGGREGATE_CONTRIBUTIONS = "aggregate_contributions"; 181 } 182 183 /** Contract for Trigger. */ 184 public interface TriggerContract { 185 String TABLE = MSMT_TABLE_PREFIX + "trigger"; 186 String ID = "_id"; 187 String ATTRIBUTION_DESTINATION = "attribution_destination"; 188 String DESTINATION_TYPE = "destination_type"; 189 String TRIGGER_TIME = "trigger_time"; 190 String STATUS = "status"; 191 String REGISTRANT = "registrant"; 192 String ENROLLMENT_ID = "enrollment_id"; 193 String EVENT_TRIGGERS = "event_triggers"; 194 String AGGREGATE_TRIGGER_DATA = "aggregate_trigger_data"; 195 String AGGREGATE_VALUES = "aggregate_values"; 196 String AGGREGATABLE_DEDUPLICATION_KEYS = "aggregatable_deduplication_keys"; 197 String FILTERS = "filters"; 198 String NOT_FILTERS = "not_filters"; 199 String DEBUG_KEY = "debug_key"; 200 String DEBUG_REPORTING = "debug_reporting"; 201 String AD_ID_PERMISSION = "ad_id_permission"; 202 String AR_DEBUG_PERMISSION = "ar_debug_permission"; 203 String ATTRIBUTION_CONFIG = "attribution_config"; 204 String X_NETWORK_KEY_MAPPING = "x_network_key_mapping"; 205 String DEBUG_JOIN_KEY = "debug_join_key"; 206 String PLATFORM_AD_ID = "platform_ad_id"; 207 String DEBUG_AD_ID = "debug_ad_id"; 208 String REGISTRATION_ORIGIN = "registration_origin"; 209 String AGGREGATION_COORDINATOR_ORIGIN = "aggregation_coordinator_origin"; 210 String AGGREGATABLE_SOURCE_REGISTRATION_TIME_CONFIG = 211 "aggregatable_source_registration_time_config"; 212 String TRIGGER_CONTEXT_ID = "trigger_context_id"; 213 String ATTRIBUTION_SCOPES = "attribution_scope"; 214 String AGGREGATABLE_FILTERING_ID_MAX_BYTES = "aggregatable_filtering_id_max_bytes"; 215 String AGGREGATE_DEBUG_REPORTING = "aggregate_debug_reporting"; 216 String NAMED_BUDGETS = "named_budgets"; 217 } 218 219 /** Contract for EventReport. */ 220 public interface EventReportContract { 221 String TABLE = MSMT_TABLE_PREFIX + "event_report"; 222 String ID = "_id"; 223 String SOURCE_EVENT_ID = "source_event_id"; 224 String ATTRIBUTION_DESTINATION = "attribution_destination"; 225 String REPORT_TIME = "report_time"; 226 String TRIGGER_DATA = "trigger_data"; 227 String TRIGGER_PRIORITY = "trigger_priority"; 228 String TRIGGER_DEDUP_KEY = "trigger_dedup_key"; 229 String TRIGGER_TIME = "trigger_time"; 230 String STATUS = "status"; 231 String DEBUG_REPORT_STATUS = "debug_report_status"; 232 String SOURCE_TYPE = "source_type"; 233 String ENROLLMENT_ID = "enrollment_id"; 234 String RANDOMIZED_TRIGGER_RATE = "randomized_trigger_rate"; 235 String SOURCE_DEBUG_KEY = "source_debug_key"; 236 String TRIGGER_DEBUG_KEY = "trigger_debug_key"; 237 String TRIGGER_DEBUG_KEYS = "trigger_debug_keys"; 238 String SOURCE_ID = "source_id"; 239 String TRIGGER_ID = "trigger_id"; 240 String REGISTRATION_ORIGIN = "registration_origin"; 241 String TRIGGER_SUMMARY_BUCKET = "trigger_summary_bucket"; 242 } 243 244 /** Contract for Attribution rate limit. */ 245 public interface AttributionContract { 246 String TABLE = MSMT_TABLE_PREFIX + "attribution"; 247 String ID = "_id"; 248 String SOURCE_SITE = "source_site"; 249 String SOURCE_ORIGIN = "source_origin"; 250 String DESTINATION_SITE = "attribution_destination_site"; 251 String DESTINATION_ORIGIN = "destination_origin"; 252 // TODO: b/276638412 rename to source time 253 String TRIGGER_TIME = "trigger_time"; 254 String REGISTRANT = "registrant"; 255 String ENROLLMENT_ID = "enrollment_id"; 256 String SOURCE_ID = "source_id"; 257 String TRIGGER_ID = "trigger_id"; 258 String REGISTRATION_ORIGIN = "registration_origin"; 259 String SCOPE = "scope"; 260 String REPORT_ID = "report_id"; 261 } 262 263 /** Contract for Unencrypted aggregate payload. */ 264 public interface AggregateReport { 265 String TABLE = MSMT_TABLE_PREFIX + "aggregate_report"; 266 String ID = "_id"; 267 String PUBLISHER = "publisher"; 268 String ATTRIBUTION_DESTINATION = "attribution_destination"; 269 String SOURCE_REGISTRATION_TIME = "source_registration_time"; 270 String SCHEDULED_REPORT_TIME = "scheduled_report_time"; 271 String ENROLLMENT_ID = "enrollment_id"; 272 String DEBUG_CLEARTEXT_PAYLOAD = "debug_cleartext_payload"; 273 String STATUS = "status"; 274 String DEBUG_REPORT_STATUS = "debug_report_status"; 275 String API_VERSION = "api_version"; 276 String SOURCE_DEBUG_KEY = "source_debug_key"; 277 String TRIGGER_DEBUG_KEY = "trigger_debug_key"; 278 String SOURCE_ID = "source_id"; 279 String TRIGGER_ID = "trigger_id"; 280 String DEDUP_KEY = "dedup_key"; 281 String REGISTRATION_ORIGIN = "registration_origin"; 282 String AGGREGATION_COORDINATOR_ORIGIN = "aggregation_coordinator_origin"; 283 String IS_FAKE_REPORT = "is_fake_report"; 284 String TRIGGER_CONTEXT_ID = "trigger_context_id"; 285 String TRIGGER_TIME = "trigger_time"; 286 String API = "api"; 287 String AGGREGATABLE_FILTERING_ID_MAX_BYTES = "aggregatable_filtering_id_max_bytes"; 288 } 289 290 /** Contract for aggregate encryption key. */ 291 public interface AggregateEncryptionKey { 292 String TABLE = MSMT_TABLE_PREFIX + "aggregate_encryption_key"; 293 String ID = "_id"; 294 String KEY_ID = "key_id"; 295 String PUBLIC_KEY = "public_key"; 296 String EXPIRY = "expiry"; 297 String AGGREGATION_COORDINATOR_ORIGIN = "aggregation_coordinator_origin"; 298 } 299 300 /** Contract for debug reports. */ 301 public interface DebugReportContract { 302 String TABLE = MSMT_TABLE_PREFIX + "debug_report"; 303 String ID = "_id"; 304 String TYPE = "type"; 305 String BODY = "body"; 306 String ENROLLMENT_ID = "enrollment_id"; 307 String REGISTRATION_ORIGIN = "registration_origin"; 308 String REFERENCE_ID = "reference_id"; 309 String INSERTION_TIME = "insertion_time"; 310 String REGISTRANT = "registrant"; 311 } 312 313 /** Contract for aggregatable debug report budget. */ 314 public interface AggregatableDebugReportBudgetTrackerContract { 315 String TABLE = MSMT_TABLE_PREFIX + "aggregatable_debug_report_budget_tracker"; 316 String REPORT_GENERATION_TIME = "report_generation_time"; 317 String TOP_LEVEL_REGISTRANT = "top_level_registrant"; 318 String REGISTRANT_APP = "registrant_app"; 319 String REGISTRATION_ORIGIN = "registration_origin"; 320 String SOURCE_ID = "source_id"; 321 String TRIGGER_ID = "trigger_id"; 322 String CONTRIBUTIONS = "contributions"; 323 } 324 325 /** Contract for xna ignored sources. */ 326 public interface XnaIgnoredSourcesContract { 327 String TABLE = MSMT_TABLE_PREFIX + "xna_ignored_sources"; 328 String SOURCE_ID = "source_id"; 329 String ENROLLMENT_ID = "enrollment_id"; 330 } 331 332 /** Contract for key-value store */ 333 public interface KeyValueDataContract { 334 String TABLE = MSMT_TABLE_PREFIX + "key_value_data"; 335 String DATA_TYPE = "data_type"; 336 String KEY = "_key"; // Avoid collision with SQLite keyword 'key' 337 String VALUE = "value"; 338 } 339 340 /** Contract for app report history for reinstall reattribution. */ 341 public interface AppReportHistoryContract { 342 String TABLE = MSMT_TABLE_PREFIX + "app_report_history"; 343 String REGISTRATION_ORIGIN = "registration_origin"; 344 String APP_DESTINATION = "app_destination"; 345 String LAST_REPORT_DELIVERED_TIME = "last_report_delivered_time"; 346 } 347 348 /** Contract for Count Unique API Event */ 349 public interface CountUniqueReportingContract { 350 String TABLE = MSMT_TABLE_PREFIX + "count_unique_reporting"; 351 352 String REPORT_ID = "report_id"; 353 String PAYLOAD = "payload"; 354 String REPORTING_ORIGIN = "reporting_origin"; 355 String STATUS = "status"; 356 String SCHEDULED_REPORT_TIME = "scheduled_report_time"; 357 String API_VERSION = "api_version"; 358 String DEBUG_KEY = "debug_key"; 359 String CONTEXT_ID = "context_id"; 360 String DEBUG_REPORT_STATUS = "debug_report_status"; 361 String ENROLLMENT_ID = "enrollment_id"; 362 String CONTRIBUTION_VALUE = "contribution_value"; 363 String CONTRIBUTION_TIME = "contribution_time"; 364 } 365 366 /** Contract for Count Unique API Metadata */ 367 public interface CountUniqueMetadataContract { 368 String TABLE = MSMT_TABLE_PREFIX + "count_unique_metadata"; 369 370 String REPORTING_ORIGIN = "reporting_origin"; 371 String KEY = "key"; 372 String VALUE = "value"; 373 String EXPIRATION_TIME = "expiration_time"; 374 } 375 376 public static final String CREATE_TABLE_ASYNC_REGISTRATION_V6 = 377 "CREATE TABLE " 378 + AsyncRegistrationContract.TABLE 379 + " (" 380 + AsyncRegistrationContract.ID 381 + " TEXT PRIMARY KEY NOT NULL, " 382 + MeasurementTablesDeprecated.AsyncRegistration.ENROLLMENT_ID 383 + " TEXT, " 384 + AsyncRegistrationContract.REGISTRATION_URI 385 + " TEXT, " 386 + AsyncRegistrationContract.WEB_DESTINATION 387 + " TEXT, " 388 + AsyncRegistrationContract.OS_DESTINATION 389 + " TEXT, " 390 + AsyncRegistrationContract.VERIFIED_DESTINATION 391 + " TEXT, " 392 + AsyncRegistrationContract.TOP_ORIGIN 393 + " TEXT, " 394 + MeasurementTablesDeprecated.AsyncRegistration.REDIRECT_TYPE 395 + " INTEGER, " 396 + MeasurementTablesDeprecated.AsyncRegistration.REDIRECT_COUNT 397 + " INTEGER, " 398 + AsyncRegistrationContract.SOURCE_TYPE 399 + " INTEGER, " 400 + AsyncRegistrationContract.REGISTRANT 401 + " TEXT, " 402 + AsyncRegistrationContract.REQUEST_TIME 403 + " INTEGER, " 404 + AsyncRegistrationContract.RETRY_COUNT 405 + " INTEGER, " 406 + MeasurementTablesDeprecated.AsyncRegistration.LAST_PROCESSING_TIME 407 + " INTEGER, " 408 + AsyncRegistrationContract.TYPE 409 + " INTEGER, " 410 + AsyncRegistrationContract.DEBUG_KEY_ALLOWED 411 + " INTEGER, " 412 + AsyncRegistrationContract.AD_ID_PERMISSION 413 + " INTEGER, " 414 + AsyncRegistrationContract.REGISTRATION_ID 415 + " TEXT " 416 + ")"; 417 418 public static final String CREATE_TABLE_ASYNC_REGISTRATION_LATEST = 419 "CREATE TABLE " 420 + AsyncRegistrationContract.TABLE 421 + " (" 422 + AsyncRegistrationContract.ID 423 + " TEXT PRIMARY KEY NOT NULL, " 424 + AsyncRegistrationContract.REGISTRATION_URI 425 + " TEXT, " 426 + AsyncRegistrationContract.WEB_DESTINATION 427 + " TEXT, " 428 + AsyncRegistrationContract.OS_DESTINATION 429 + " TEXT, " 430 + AsyncRegistrationContract.VERIFIED_DESTINATION 431 + " TEXT, " 432 + AsyncRegistrationContract.TOP_ORIGIN 433 + " TEXT, " 434 + AsyncRegistrationContract.SOURCE_TYPE 435 + " INTEGER, " 436 + AsyncRegistrationContract.REGISTRANT 437 + " TEXT, " 438 + AsyncRegistrationContract.REQUEST_TIME 439 + " INTEGER, " 440 + AsyncRegistrationContract.RETRY_COUNT 441 + " INTEGER, " 442 + AsyncRegistrationContract.TYPE 443 + " INTEGER, " 444 + AsyncRegistrationContract.DEBUG_KEY_ALLOWED 445 + " INTEGER, " 446 + AsyncRegistrationContract.AD_ID_PERMISSION 447 + " INTEGER, " 448 + AsyncRegistrationContract.REGISTRATION_ID 449 + " TEXT NOT NULL," 450 + AsyncRegistrationContract.PLATFORM_AD_ID 451 + " TEXT, " 452 + AsyncRegistrationContract.REQUEST_POST_BODY 453 + " TEXT, " 454 + AsyncRegistrationContract.REDIRECT_BEHAVIOR 455 + " TEXT " 456 + ")"; 457 458 public static final String CREATE_TABLE_SOURCE_V6 = 459 "CREATE TABLE " 460 + SourceContract.TABLE 461 + " (" 462 + SourceContract.ID 463 + " TEXT PRIMARY KEY NOT NULL, " 464 + SourceContract.EVENT_ID 465 + " INTEGER, " 466 + SourceContract.PUBLISHER 467 + " TEXT, " 468 + SourceContract.PUBLISHER_TYPE 469 + " INTEGER, " 470 + MeasurementTablesDeprecated.SourceContract.APP_DESTINATION 471 + " TEXT, " 472 + SourceContract.ENROLLMENT_ID 473 + " TEXT, " 474 + SourceContract.EVENT_TIME 475 + " INTEGER, " 476 + SourceContract.EXPIRY_TIME 477 + " INTEGER, " 478 + SourceContract.EVENT_REPORT_WINDOW 479 + " INTEGER, " 480 + SourceContract.AGGREGATABLE_REPORT_WINDOW 481 + " INTEGER, " 482 + SourceContract.PRIORITY 483 + " INTEGER, " 484 + SourceContract.STATUS 485 + " INTEGER, " 486 + SourceContract.EVENT_REPORT_DEDUP_KEYS 487 + " TEXT, " 488 + SourceContract.AGGREGATE_REPORT_DEDUP_KEYS 489 + " TEXT, " 490 + SourceContract.SOURCE_TYPE 491 + " TEXT, " 492 + SourceContract.REGISTRANT 493 + " TEXT, " 494 + SourceContract.ATTRIBUTION_MODE 495 + " INTEGER, " 496 + SourceContract.INSTALL_ATTRIBUTION_WINDOW 497 + " INTEGER, " 498 + SourceContract.INSTALL_COOLDOWN_WINDOW 499 + " INTEGER, " 500 + SourceContract.IS_INSTALL_ATTRIBUTED 501 + " INTEGER, " 502 + SourceContract.FILTER_DATA 503 + " TEXT, " 504 + SourceContract.AGGREGATE_SOURCE 505 + " TEXT, " 506 + SourceContract.AGGREGATE_CONTRIBUTIONS 507 + " INTEGER, " 508 + MeasurementTablesDeprecated.SourceContract.WEB_DESTINATION 509 + " TEXT, " 510 + SourceContract.DEBUG_KEY 511 + " INTEGER , " 512 + SourceContract.DEBUG_REPORTING 513 + " INTEGER, " 514 + SourceContract.AD_ID_PERMISSION 515 + " INTEGER, " 516 + SourceContract.AR_DEBUG_PERMISSION 517 + " INTEGER, " 518 + SourceContract.REGISTRATION_ID 519 + " TEXT, " 520 + SourceContract.SHARED_AGGREGATION_KEYS 521 + " TEXT, " 522 + SourceContract.INSTALL_TIME 523 + " INTEGER " 524 + ")"; 525 526 public static final String CREATE_TABLE_SOURCE_LATEST = 527 "CREATE TABLE " 528 + SourceContract.TABLE 529 + " (" 530 + SourceContract.ID 531 + " TEXT PRIMARY KEY NOT NULL, " 532 + SourceContract.EVENT_ID 533 + " INTEGER, " 534 + SourceContract.PUBLISHER 535 + " TEXT, " 536 + SourceContract.PUBLISHER_TYPE 537 + " INTEGER, " 538 + SourceContract.ENROLLMENT_ID 539 + " TEXT, " 540 + SourceContract.EVENT_TIME 541 + " INTEGER, " 542 + SourceContract.EXPIRY_TIME 543 + " INTEGER, " 544 + SourceContract.EVENT_REPORT_WINDOW 545 + " INTEGER, " 546 + SourceContract.AGGREGATABLE_REPORT_WINDOW 547 + " INTEGER, " 548 + SourceContract.PRIORITY 549 + " INTEGER, " 550 + SourceContract.STATUS 551 + " INTEGER, " 552 + SourceContract.EVENT_REPORT_DEDUP_KEYS 553 + " TEXT, " 554 + SourceContract.AGGREGATE_REPORT_DEDUP_KEYS 555 + " TEXT, " 556 + SourceContract.SOURCE_TYPE 557 + " TEXT, " 558 + SourceContract.REGISTRANT 559 + " TEXT, " 560 + SourceContract.ATTRIBUTION_MODE 561 + " INTEGER, " 562 + SourceContract.INSTALL_ATTRIBUTION_WINDOW 563 + " INTEGER, " 564 + SourceContract.INSTALL_COOLDOWN_WINDOW 565 + " INTEGER, " 566 + SourceContract.IS_INSTALL_ATTRIBUTED 567 + " INTEGER, " 568 + SourceContract.FILTER_DATA 569 + " TEXT, " 570 + SourceContract.AGGREGATE_SOURCE 571 + " TEXT, " 572 + SourceContract.AGGREGATE_CONTRIBUTIONS 573 + " INTEGER, " 574 + SourceContract.DEBUG_KEY 575 + " INTEGER , " 576 + SourceContract.DEBUG_REPORTING 577 + " INTEGER, " 578 + SourceContract.AD_ID_PERMISSION 579 + " INTEGER, " 580 + SourceContract.AR_DEBUG_PERMISSION 581 + " INTEGER, " 582 + SourceContract.REGISTRATION_ID 583 + " TEXT, " 584 + SourceContract.SHARED_AGGREGATION_KEYS 585 + " TEXT, " 586 + SourceContract.INSTALL_TIME 587 + " INTEGER, " 588 + SourceContract.DEBUG_JOIN_KEY 589 + " TEXT, " 590 + SourceContract.TRIGGER_SPECS 591 + " TEXT, " 592 + SourceContract.MAX_EVENT_LEVEL_REPORTS 593 + " INTEGER, " 594 + SourceContract.PLATFORM_AD_ID 595 + " TEXT, " 596 + SourceContract.DEBUG_AD_ID 597 + " TEXT, " 598 + SourceContract.REGISTRATION_ORIGIN 599 + " TEXT, " 600 + SourceContract.COARSE_EVENT_REPORT_DESTINATIONS 601 + " INTEGER, " 602 + SourceContract.EVENT_ATTRIBUTION_STATUS 603 + " TEXT, " 604 + SourceContract.PRIVACY_PARAMETERS 605 + " TEXT, " 606 + SourceContract.EVENT_REPORT_WINDOWS 607 + " TEXT, " 608 + SourceContract.SHARED_DEBUG_KEY 609 + " INTEGER, " 610 + SourceContract.SHARED_FILTER_DATA_KEYS 611 + " TEXT, " 612 + SourceContract.TRIGGER_DATA_MATCHING 613 + " TEXT, " 614 + SourceContract.ATTRIBUTION_SCOPE_LIMIT 615 + " INTEGER, " 616 + SourceContract.MAX_EVENT_STATES 617 + " INTEGER, " 618 + SourceContract.REINSTALL_REATTRIBUTION_WINDOW 619 + " INTEGER, " 620 + SourceContract.DESTINATION_LIMIT_PRIORITY 621 + " INTEGER, " 622 + SourceContract.TRIGGER_DATA 623 + " TEXT, " 624 + SourceContract.EVENT_LEVEL_EPSILON 625 + " DOUBLE, " 626 + SourceContract.AGGREGATE_DEBUG_REPORTING 627 + " TEXT, " 628 + SourceContract.AGGREGATE_DEBUG_REPORT_CONTRIBUTIONS 629 + " INTEGER " 630 + ")"; 631 632 public static final String CREATE_TABLE_SOURCE_DESTINATION_LATEST = 633 "CREATE TABLE " 634 + SourceDestination.TABLE 635 + " (" 636 + SourceDestination.SOURCE_ID 637 + " TEXT, " 638 + SourceDestination.DESTINATION_TYPE 639 + " INTEGER, " 640 + SourceDestination.DESTINATION 641 + " TEXT, " 642 + "FOREIGN KEY (" 643 + SourceDestination.SOURCE_ID 644 + ") REFERENCES " 645 + SourceContract.TABLE 646 + "(" 647 + SourceContract.ID 648 + ") ON DELETE CASCADE " 649 + ")"; 650 651 public static final String CREATE_TABLE_SOURCE_ATTRIBUTION_SCOPE_LATEST = 652 "CREATE TABLE " 653 + SourceAttributionScopeContract.TABLE 654 + " (" 655 + SourceAttributionScopeContract.SOURCE_ID 656 + " TEXT, " 657 + SourceAttributionScopeContract.ATTRIBUTION_SCOPE 658 + " TEXT, " 659 + "FOREIGN KEY (" 660 + SourceDestination.SOURCE_ID 661 + ") REFERENCES " 662 + SourceContract.TABLE 663 + "(" 664 + SourceContract.ID 665 + ") ON DELETE CASCADE " 666 + ")"; 667 668 public static final String CREATE_TABLE_SOURCE_NAMED_BUDGET_LATEST = 669 "CREATE TABLE " 670 + SourceNamedBudgetContract.TABLE 671 + " (" 672 + SourceNamedBudgetContract.SOURCE_ID 673 + " TEXT, " 674 + SourceNamedBudgetContract.NAME 675 + " TEXT, " 676 + SourceNamedBudgetContract.BUDGET 677 + " INTEGER, " 678 + SourceNamedBudgetContract.AGGREGATE_CONTRIBUTIONS 679 + " INTEGER, " 680 + "FOREIGN KEY (" 681 + SourceNamedBudgetContract.SOURCE_ID 682 + ") REFERENCES " 683 + SourceContract.TABLE 684 + "(" 685 + SourceContract.ID 686 + ") ON DELETE CASCADE " 687 + ")"; 688 689 public static final String CREATE_TABLE_TRIGGER_V6 = 690 "CREATE TABLE " 691 + TriggerContract.TABLE 692 + " (" 693 + TriggerContract.ID 694 + " TEXT PRIMARY KEY NOT NULL, " 695 + TriggerContract.ATTRIBUTION_DESTINATION 696 + " TEXT, " 697 + TriggerContract.DESTINATION_TYPE 698 + " INTEGER, " 699 + TriggerContract.ENROLLMENT_ID 700 + " TEXT, " 701 + TriggerContract.TRIGGER_TIME 702 + " INTEGER, " 703 + TriggerContract.EVENT_TRIGGERS 704 + " TEXT, " 705 + TriggerContract.STATUS 706 + " INTEGER, " 707 + TriggerContract.REGISTRANT 708 + " TEXT, " 709 + TriggerContract.AGGREGATE_TRIGGER_DATA 710 + " TEXT, " 711 + TriggerContract.AGGREGATE_VALUES 712 + " TEXT, " 713 + TriggerContract.AGGREGATABLE_DEDUPLICATION_KEYS 714 + " TEXT, " 715 + TriggerContract.FILTERS 716 + " TEXT, " 717 + TriggerContract.NOT_FILTERS 718 + " TEXT, " 719 + TriggerContract.DEBUG_KEY 720 + " INTEGER, " 721 + TriggerContract.DEBUG_REPORTING 722 + " INTEGER, " 723 + TriggerContract.AD_ID_PERMISSION 724 + " INTEGER, " 725 + TriggerContract.AR_DEBUG_PERMISSION 726 + " INTEGER, " 727 + TriggerContract.ATTRIBUTION_CONFIG 728 + " TEXT, " 729 + TriggerContract.X_NETWORK_KEY_MAPPING 730 + " TEXT " 731 + ")"; 732 733 public static final String CREATE_TABLE_TRIGGER_LATEST = 734 "CREATE TABLE " 735 + TriggerContract.TABLE 736 + " (" 737 + TriggerContract.ID 738 + " TEXT PRIMARY KEY NOT NULL, " 739 + TriggerContract.ATTRIBUTION_DESTINATION 740 + " TEXT, " 741 + TriggerContract.DESTINATION_TYPE 742 + " INTEGER, " 743 + TriggerContract.ENROLLMENT_ID 744 + " TEXT, " 745 + TriggerContract.TRIGGER_TIME 746 + " INTEGER, " 747 + TriggerContract.EVENT_TRIGGERS 748 + " TEXT, " 749 + TriggerContract.STATUS 750 + " INTEGER, " 751 + TriggerContract.REGISTRANT 752 + " TEXT, " 753 + TriggerContract.AGGREGATE_TRIGGER_DATA 754 + " TEXT, " 755 + TriggerContract.AGGREGATE_VALUES 756 + " TEXT, " 757 + TriggerContract.AGGREGATABLE_DEDUPLICATION_KEYS 758 + " TEXT, " 759 + TriggerContract.FILTERS 760 + " TEXT, " 761 + TriggerContract.NOT_FILTERS 762 + " TEXT, " 763 + TriggerContract.DEBUG_KEY 764 + " INTEGER, " 765 + TriggerContract.DEBUG_REPORTING 766 + " INTEGER, " 767 + TriggerContract.AD_ID_PERMISSION 768 + " INTEGER, " 769 + TriggerContract.AR_DEBUG_PERMISSION 770 + " INTEGER, " 771 + TriggerContract.ATTRIBUTION_CONFIG 772 + " TEXT, " 773 + TriggerContract.X_NETWORK_KEY_MAPPING 774 + " TEXT, " 775 + TriggerContract.DEBUG_JOIN_KEY 776 + " TEXT, " 777 + TriggerContract.PLATFORM_AD_ID 778 + " TEXT, " 779 + TriggerContract.DEBUG_AD_ID 780 + " TEXT, " 781 + TriggerContract.REGISTRATION_ORIGIN 782 + " TEXT, " 783 + TriggerContract.AGGREGATION_COORDINATOR_ORIGIN 784 + " TEXT, " 785 + TriggerContract.AGGREGATABLE_SOURCE_REGISTRATION_TIME_CONFIG 786 + " TEXT, " 787 + TriggerContract.TRIGGER_CONTEXT_ID 788 + " TEXT, " 789 + TriggerContract.ATTRIBUTION_SCOPES 790 + " TEXT, " 791 + TriggerContract.AGGREGATABLE_FILTERING_ID_MAX_BYTES 792 + " INTEGER, " 793 + TriggerContract.AGGREGATE_DEBUG_REPORTING 794 + " TEXT, " 795 + TriggerContract.NAMED_BUDGETS 796 + " TEXT" 797 + ")"; 798 799 // Only used in V3 800 public static final String CREATE_TABLE_EVENT_REPORT_V3 = 801 "CREATE TABLE " 802 + EventReportContract.TABLE 803 + " (" 804 + EventReportContract.ID 805 + " TEXT PRIMARY KEY NOT NULL, " 806 + EventReportContract.SOURCE_EVENT_ID 807 + " INTEGER, " 808 + EventReportContract.ENROLLMENT_ID 809 + " TEXT, " 810 + EventReportContract.ATTRIBUTION_DESTINATION 811 + " TEXT, " 812 + EventReportContract.REPORT_TIME 813 + " INTEGER, " 814 + EventReportContract.TRIGGER_DATA 815 + " INTEGER, " 816 + EventReportContract.TRIGGER_PRIORITY 817 + " INTEGER, " 818 + EventReportContract.TRIGGER_DEDUP_KEY 819 + " INTEGER, " 820 + EventReportContract.TRIGGER_TIME 821 + " INTEGER, " 822 + EventReportContract.STATUS 823 + " INTEGER, " 824 + EventReportContract.DEBUG_REPORT_STATUS 825 + " INTEGER, " 826 + EventReportContract.SOURCE_TYPE 827 + " TEXT, " 828 + EventReportContract.RANDOMIZED_TRIGGER_RATE 829 + " DOUBLE, " 830 + EventReportContract.SOURCE_DEBUG_KEY 831 + " INTEGER, " 832 + EventReportContract.TRIGGER_DEBUG_KEY 833 + " INTEGER, " 834 + EventReportContract.SOURCE_ID 835 + " TEXT, " 836 + EventReportContract.TRIGGER_ID 837 + " TEXT, " 838 + "FOREIGN KEY (" 839 + EventReportContract.SOURCE_ID 840 + ") REFERENCES " 841 + SourceContract.TABLE 842 + "(" 843 + SourceContract.ID 844 + ") ON DELETE CASCADE, " 845 + "FOREIGN KEY (" 846 + EventReportContract.TRIGGER_ID 847 + ") REFERENCES " 848 + TriggerContract.TABLE 849 + "(" 850 + TriggerContract.ID 851 + ") ON DELETE CASCADE" 852 + ")"; 853 854 public static final String CREATE_TABLE_EVENT_REPORT_LATEST = 855 "CREATE TABLE " 856 + EventReportContract.TABLE 857 + " (" 858 + EventReportContract.ID 859 + " TEXT PRIMARY KEY NOT NULL, " 860 + EventReportContract.SOURCE_EVENT_ID 861 + " INTEGER, " 862 + EventReportContract.ENROLLMENT_ID 863 + " TEXT, " 864 + EventReportContract.ATTRIBUTION_DESTINATION 865 + " TEXT, " 866 + EventReportContract.REPORT_TIME 867 + " INTEGER, " 868 + EventReportContract.TRIGGER_DATA 869 + " INTEGER, " 870 + EventReportContract.TRIGGER_PRIORITY 871 + " INTEGER, " 872 + EventReportContract.TRIGGER_DEDUP_KEY 873 + " INTEGER, " 874 + EventReportContract.TRIGGER_TIME 875 + " INTEGER, " 876 + EventReportContract.STATUS 877 + " INTEGER, " 878 + EventReportContract.DEBUG_REPORT_STATUS 879 + " INTEGER, " 880 + EventReportContract.SOURCE_TYPE 881 + " TEXT, " 882 + EventReportContract.RANDOMIZED_TRIGGER_RATE 883 + " DOUBLE, " 884 + EventReportContract.SOURCE_DEBUG_KEY 885 + " INTEGER, " 886 + EventReportContract.TRIGGER_DEBUG_KEY 887 + " INTEGER, " 888 + EventReportContract.SOURCE_ID 889 + " TEXT, " 890 + EventReportContract.TRIGGER_ID 891 + " TEXT, " 892 + EventReportContract.REGISTRATION_ORIGIN 893 + " TEXT, " 894 + EventReportContract.TRIGGER_SUMMARY_BUCKET 895 + " TEXT, " 896 + EventReportContract.TRIGGER_DEBUG_KEYS 897 + " TEXT, " 898 + "FOREIGN KEY (" 899 + EventReportContract.SOURCE_ID 900 + ") REFERENCES " 901 + SourceContract.TABLE 902 + "(" 903 + SourceContract.ID 904 + ") ON DELETE CASCADE, " 905 + "FOREIGN KEY (" 906 + EventReportContract.TRIGGER_ID 907 + ") REFERENCES " 908 + TriggerContract.TABLE 909 + "(" 910 + TriggerContract.ID 911 + ") ON DELETE CASCADE" 912 + ")"; 913 914 public static final String CREATE_TABLE_ATTRIBUTION_V6 = 915 "CREATE TABLE " 916 + AttributionContract.TABLE 917 + " (" 918 + AttributionContract.ID 919 + " TEXT PRIMARY KEY NOT NULL, " 920 + AttributionContract.SOURCE_SITE 921 + " TEXT, " 922 + AttributionContract.SOURCE_ORIGIN 923 + " TEXT, " 924 + AttributionContract.DESTINATION_SITE 925 + " TEXT, " 926 + AttributionContract.DESTINATION_ORIGIN 927 + " TEXT, " 928 + AttributionContract.ENROLLMENT_ID 929 + " TEXT, " 930 + AttributionContract.TRIGGER_TIME 931 + " INTEGER, " 932 + AttributionContract.REGISTRANT 933 + " TEXT, " 934 + AttributionContract.SOURCE_ID 935 + " TEXT, " 936 + AttributionContract.TRIGGER_ID 937 + " TEXT, " 938 + "FOREIGN KEY (" 939 + AttributionContract.SOURCE_ID 940 + ") REFERENCES " 941 + SourceContract.TABLE 942 + "(" 943 + SourceContract.ID 944 + ") ON DELETE CASCADE, " 945 + "FOREIGN KEY (" 946 + AttributionContract.TRIGGER_ID 947 + ") REFERENCES " 948 + TriggerContract.TABLE 949 + "(" 950 + TriggerContract.ID 951 + ") ON DELETE CASCADE" 952 + ")"; 953 954 public static final String CREATE_TABLE_ATTRIBUTION_LATEST = 955 "CREATE TABLE " 956 + AttributionContract.TABLE 957 + " (" 958 + AttributionContract.ID 959 + " TEXT PRIMARY KEY NOT NULL, " 960 + AttributionContract.SOURCE_SITE 961 + " TEXT, " 962 + AttributionContract.SOURCE_ORIGIN 963 + " TEXT, " 964 + AttributionContract.DESTINATION_SITE 965 + " TEXT, " 966 + AttributionContract.DESTINATION_ORIGIN 967 + " TEXT, " 968 + AttributionContract.ENROLLMENT_ID 969 + " TEXT, " 970 + AttributionContract.TRIGGER_TIME 971 + " INTEGER, " 972 + AttributionContract.REGISTRANT 973 + " TEXT, " 974 + AttributionContract.SOURCE_ID 975 + " TEXT, " 976 + AttributionContract.TRIGGER_ID 977 + " TEXT, " 978 + AttributionContract.REGISTRATION_ORIGIN 979 + " TEXT, " 980 + AttributionContract.SCOPE 981 + " INTEGER, " 982 + AttributionContract.REPORT_ID 983 + " TEXT, " 984 + "FOREIGN KEY (" 985 + AttributionContract.SOURCE_ID 986 + ") REFERENCES " 987 + SourceContract.TABLE 988 + "(" 989 + SourceContract.ID 990 + ") ON DELETE CASCADE, " 991 + "FOREIGN KEY (" 992 + AttributionContract.TRIGGER_ID 993 + ") REFERENCES " 994 + TriggerContract.TABLE 995 + "(" 996 + TriggerContract.ID 997 + ") ON DELETE CASCADE" 998 + ")"; 999 1000 public static final String CREATE_TABLE_AGGREGATE_REPORT_V6 = 1001 "CREATE TABLE " 1002 + AggregateReport.TABLE 1003 + " (" 1004 + AggregateReport.ID 1005 + " TEXT PRIMARY KEY NOT NULL, " 1006 + AggregateReport.PUBLISHER 1007 + " TEXT, " 1008 + AggregateReport.ATTRIBUTION_DESTINATION 1009 + " TEXT, " 1010 + AggregateReport.SOURCE_REGISTRATION_TIME 1011 + " INTEGER, " 1012 + AggregateReport.SCHEDULED_REPORT_TIME 1013 + " INTEGER, " 1014 + AggregateReport.ENROLLMENT_ID 1015 + " TEXT, " 1016 + AggregateReport.DEBUG_CLEARTEXT_PAYLOAD 1017 + " TEXT, " 1018 + AggregateReport.STATUS 1019 + " INTEGER, " 1020 + AggregateReport.DEBUG_REPORT_STATUS 1021 + " INTEGER, " 1022 + AggregateReport.API_VERSION 1023 + " TEXT, " 1024 + AggregateReport.SOURCE_DEBUG_KEY 1025 + " INTEGER, " 1026 + AggregateReport.TRIGGER_DEBUG_KEY 1027 + " INTEGER, " 1028 + AggregateReport.SOURCE_ID 1029 + " TEXT, " 1030 + AggregateReport.TRIGGER_ID 1031 + " TEXT, " 1032 + "FOREIGN KEY (" 1033 + AggregateReport.SOURCE_ID 1034 + ") REFERENCES " 1035 + SourceContract.TABLE 1036 + "(" 1037 + SourceContract.ID 1038 + ") ON DELETE CASCADE " 1039 + "FOREIGN KEY (" 1040 + AggregateReport.TRIGGER_ID 1041 + ") REFERENCES " 1042 + TriggerContract.TABLE 1043 + "(" 1044 + TriggerContract.ID 1045 + ") ON DELETE CASCADE" 1046 + ")"; 1047 1048 public static final String CREATE_TABLE_AGGREGATE_REPORT_LATEST = 1049 "CREATE TABLE " 1050 + AggregateReport.TABLE 1051 + " (" 1052 + AggregateReport.ID 1053 + " TEXT PRIMARY KEY NOT NULL, " 1054 + AggregateReport.PUBLISHER 1055 + " TEXT, " 1056 + AggregateReport.ATTRIBUTION_DESTINATION 1057 + " TEXT, " 1058 + AggregateReport.SOURCE_REGISTRATION_TIME 1059 + " INTEGER, " 1060 + AggregateReport.SCHEDULED_REPORT_TIME 1061 + " INTEGER, " 1062 + AggregateReport.ENROLLMENT_ID 1063 + " TEXT, " 1064 + AggregateReport.DEBUG_CLEARTEXT_PAYLOAD 1065 + " TEXT, " 1066 + AggregateReport.STATUS 1067 + " INTEGER, " 1068 + AggregateReport.DEBUG_REPORT_STATUS 1069 + " INTEGER, " 1070 + AggregateReport.API_VERSION 1071 + " TEXT, " 1072 + AggregateReport.SOURCE_DEBUG_KEY 1073 + " INTEGER, " 1074 + AggregateReport.TRIGGER_DEBUG_KEY 1075 + " INTEGER, " 1076 + AggregateReport.SOURCE_ID 1077 + " TEXT, " 1078 + AggregateReport.TRIGGER_ID 1079 + " TEXT, " 1080 + AggregateReport.DEDUP_KEY 1081 + " INTEGER, " 1082 + AggregateReport.REGISTRATION_ORIGIN 1083 + " TEXT, " 1084 + AggregateReport.AGGREGATION_COORDINATOR_ORIGIN 1085 + " TEXT, " 1086 + AggregateReport.IS_FAKE_REPORT 1087 + " INTEGER, " 1088 + AggregateReport.TRIGGER_CONTEXT_ID 1089 + " TEXT, " 1090 + AggregateReport.TRIGGER_TIME 1091 + " INTEGER, " 1092 + AggregateReport.API 1093 + " TEXT, " 1094 + AggregateReport.AGGREGATABLE_FILTERING_ID_MAX_BYTES 1095 + " INTEGER, " 1096 + "FOREIGN KEY (" 1097 + AggregateReport.SOURCE_ID 1098 + ") REFERENCES " 1099 + SourceContract.TABLE 1100 + "(" 1101 + SourceContract.ID 1102 + ") ON DELETE CASCADE " 1103 + "FOREIGN KEY (" 1104 + AggregateReport.TRIGGER_ID 1105 + ") REFERENCES " 1106 + TriggerContract.TABLE 1107 + "(" 1108 + TriggerContract.ID 1109 + ") ON DELETE CASCADE" 1110 + ")"; 1111 1112 public static final String CREATE_TABLE_AGGREGATE_ENCRYPTION_KEY_V6 = 1113 "CREATE TABLE " 1114 + AggregateEncryptionKey.TABLE 1115 + " (" 1116 + AggregateEncryptionKey.ID 1117 + " TEXT PRIMARY KEY NOT NULL, " 1118 + AggregateEncryptionKey.KEY_ID 1119 + " TEXT, " 1120 + AggregateEncryptionKey.PUBLIC_KEY 1121 + " TEXT, " 1122 + AggregateEncryptionKey.EXPIRY 1123 + " INTEGER " 1124 + ")"; 1125 1126 public static final String CREATE_TABLE_AGGREGATE_ENCRYPTION_KEY_LATEST = 1127 "CREATE TABLE " 1128 + AggregateEncryptionKey.TABLE 1129 + " (" 1130 + AggregateEncryptionKey.ID 1131 + " TEXT PRIMARY KEY NOT NULL, " 1132 + AggregateEncryptionKey.KEY_ID 1133 + " TEXT, " 1134 + AggregateEncryptionKey.PUBLIC_KEY 1135 + " TEXT, " 1136 + AggregateEncryptionKey.EXPIRY 1137 + " INTEGER, " 1138 + AggregateEncryptionKey.AGGREGATION_COORDINATOR_ORIGIN 1139 + " TEXT " 1140 + ")"; 1141 1142 public static final String CREATE_TABLE_DEBUG_REPORT_V3 = 1143 "CREATE TABLE IF NOT EXISTS " 1144 + DebugReportContract.TABLE 1145 + " (" 1146 + DebugReportContract.ID 1147 + " TEXT PRIMARY KEY NOT NULL, " 1148 + DebugReportContract.TYPE 1149 + " TEXT, " 1150 + DebugReportContract.BODY 1151 + " TEXT, " 1152 + DebugReportContract.ENROLLMENT_ID 1153 + " TEXT " 1154 + ")"; 1155 1156 public static final String CREATE_TABLE_DEBUG_REPORT_LATEST = 1157 "CREATE TABLE IF NOT EXISTS " 1158 + DebugReportContract.TABLE 1159 + " (" 1160 + DebugReportContract.ID 1161 + " TEXT PRIMARY KEY NOT NULL, " 1162 + DebugReportContract.TYPE 1163 + " TEXT, " 1164 + DebugReportContract.BODY 1165 + " TEXT, " 1166 + DebugReportContract.ENROLLMENT_ID 1167 + " TEXT, " 1168 + DebugReportContract.REGISTRATION_ORIGIN 1169 + " TEXT, " 1170 + DebugReportContract.REFERENCE_ID 1171 + " TEXT, " 1172 + DebugReportContract.INSERTION_TIME 1173 + " INTEGER, " 1174 + DebugReportContract.REGISTRANT 1175 + " TEXT " 1176 + ")"; 1177 1178 public static final String CREATE_TABLE_AGGREGATABLE_DEBUG_REPORT_BUDGET_TRACKER_LATEST = 1179 "CREATE TABLE IF NOT EXISTS " 1180 + AggregatableDebugReportBudgetTrackerContract.TABLE 1181 + " (" 1182 + AggregatableDebugReportBudgetTrackerContract.REPORT_GENERATION_TIME 1183 + " INTEGER, " 1184 + AggregatableDebugReportBudgetTrackerContract.TOP_LEVEL_REGISTRANT 1185 + " TEXT, " 1186 + AggregatableDebugReportBudgetTrackerContract.REGISTRANT_APP 1187 + " TEXT, " 1188 + AggregatableDebugReportBudgetTrackerContract.REGISTRATION_ORIGIN 1189 + " TEXT, " 1190 + AggregatableDebugReportBudgetTrackerContract.SOURCE_ID 1191 + " TEXT, " 1192 + AggregatableDebugReportBudgetTrackerContract.TRIGGER_ID 1193 + " TEXT, " 1194 + AggregatableDebugReportBudgetTrackerContract.CONTRIBUTIONS 1195 + " INTEGER, " 1196 + "FOREIGN KEY (" 1197 + AggregatableDebugReportBudgetTrackerContract.SOURCE_ID 1198 + ") REFERENCES " 1199 + SourceContract.TABLE 1200 + "(" 1201 + SourceContract.ID 1202 + ") ON DELETE CASCADE " 1203 + "FOREIGN KEY (" 1204 + AggregatableDebugReportBudgetTrackerContract.TRIGGER_ID 1205 + ") REFERENCES " 1206 + TriggerContract.TABLE 1207 + "(" 1208 + TriggerContract.ID 1209 + ") ON DELETE CASCADE" 1210 + ")"; 1211 1212 public static final String CREATE_TABLE_XNA_IGNORED_SOURCES_V6 = 1213 "CREATE TABLE " 1214 + XnaIgnoredSourcesContract.TABLE 1215 + " (" 1216 + XnaIgnoredSourcesContract.SOURCE_ID 1217 + " TEXT NOT NULL, " 1218 + XnaIgnoredSourcesContract.ENROLLMENT_ID 1219 + " TEXT NOT NULL, " 1220 + "FOREIGN KEY (" 1221 + XnaIgnoredSourcesContract.SOURCE_ID 1222 + ") REFERENCES " 1223 + SourceContract.TABLE 1224 + "(" 1225 + SourceContract.ID 1226 + ") ON DELETE CASCADE" 1227 + ")"; 1228 1229 public static final String CREATE_TABLE_XNA_IGNORED_SOURCES_LATEST = 1230 CREATE_TABLE_XNA_IGNORED_SOURCES_V6; 1231 1232 public static final String CREATE_TABLE_KEY_VALUE_STORE_LATEST = 1233 "CREATE TABLE " 1234 + MeasurementTables.KeyValueDataContract.TABLE 1235 + " (" 1236 + MeasurementTables.KeyValueDataContract.DATA_TYPE 1237 + " TEXT NOT NULL, " 1238 + MeasurementTables.KeyValueDataContract.KEY 1239 + " TEXT NOT NULL, " 1240 + MeasurementTables.KeyValueDataContract.VALUE 1241 + " TEXT, " 1242 + " CONSTRAINT type_key_primary_con PRIMARY KEY ( " 1243 + MeasurementTables.KeyValueDataContract.DATA_TYPE 1244 + ", " 1245 + MeasurementTables.KeyValueDataContract.KEY 1246 + " )" 1247 + " )"; 1248 1249 public static final String[] CREATE_INDEXES = { 1250 "CREATE INDEX " 1251 + INDEX_PREFIX 1252 + SourceContract.TABLE 1253 + "_ei_et " 1254 + "ON " 1255 + SourceContract.TABLE 1256 + "( " 1257 + SourceContract.ENROLLMENT_ID 1258 + ", " 1259 + SourceContract.EXPIRY_TIME 1260 + " DESC " 1261 + ")", 1262 "CREATE INDEX " 1263 + INDEX_PREFIX 1264 + SourceContract.TABLE 1265 + "_et " 1266 + "ON " 1267 + SourceContract.TABLE 1268 + "(" 1269 + SourceContract.EXPIRY_TIME 1270 + ")", 1271 "CREATE INDEX " 1272 + INDEX_PREFIX 1273 + SourceContract.TABLE 1274 + "_p_s_et " 1275 + "ON " 1276 + SourceContract.TABLE 1277 + "(" 1278 + SourceContract.PUBLISHER 1279 + ", " 1280 + SourceContract.STATUS 1281 + ", " 1282 + SourceContract.EVENT_TIME 1283 + ")", 1284 "CREATE INDEX " 1285 + INDEX_PREFIX 1286 + SourceContract.TABLE 1287 + "_ei " 1288 + "ON " 1289 + SourceContract.TABLE 1290 + "(" 1291 + SourceContract.ENROLLMENT_ID 1292 + ")", 1293 "CREATE INDEX " 1294 + INDEX_PREFIX 1295 + SourceContract.TABLE 1296 + "_asl " 1297 + "ON " 1298 + SourceContract.TABLE 1299 + "(" 1300 + SourceContract.ATTRIBUTION_SCOPE_LIMIT 1301 + ")", 1302 "CREATE INDEX " 1303 + INDEX_PREFIX 1304 + SourceContract.TABLE 1305 + "_mes " 1306 + "ON " 1307 + SourceContract.TABLE 1308 + "(" 1309 + SourceContract.MAX_EVENT_STATES 1310 + ")", 1311 "CREATE INDEX " 1312 + INDEX_PREFIX 1313 + SourceDestination.TABLE 1314 + "_d" 1315 + " ON " 1316 + SourceDestination.TABLE 1317 + "(" 1318 + SourceDestination.DESTINATION 1319 + ")", 1320 "CREATE INDEX " 1321 + INDEX_PREFIX 1322 + SourceDestination.TABLE 1323 + "_s" 1324 + " ON " 1325 + SourceDestination.TABLE 1326 + "(" 1327 + SourceDestination.SOURCE_ID 1328 + ")", 1329 "CREATE INDEX " 1330 + INDEX_PREFIX 1331 + SourceAttributionScopeContract.TABLE 1332 + "_a" 1333 + " ON " 1334 + SourceAttributionScopeContract.TABLE 1335 + "(" 1336 + SourceAttributionScopeContract.ATTRIBUTION_SCOPE 1337 + ")", 1338 "CREATE INDEX " 1339 + INDEX_PREFIX 1340 + SourceAttributionScopeContract.TABLE 1341 + "_s" 1342 + " ON " 1343 + SourceAttributionScopeContract.TABLE 1344 + "(" 1345 + SourceAttributionScopeContract.SOURCE_ID 1346 + ")", 1347 "CREATE INDEX " 1348 + INDEX_PREFIX 1349 + SourceNamedBudgetContract.TABLE 1350 + "_s_n" 1351 + " ON " 1352 + SourceNamedBudgetContract.TABLE 1353 + "(" 1354 + SourceNamedBudgetContract.SOURCE_ID 1355 + ", " 1356 + SourceNamedBudgetContract.NAME 1357 + ")", 1358 "CREATE INDEX " 1359 + INDEX_PREFIX 1360 + SourceNamedBudgetContract.TABLE 1361 + "_s" 1362 + " ON " 1363 + SourceNamedBudgetContract.TABLE 1364 + "(" 1365 + SourceNamedBudgetContract.SOURCE_ID 1366 + ")", 1367 "CREATE INDEX " 1368 + INDEX_PREFIX 1369 + TriggerContract.TABLE 1370 + "_ad_ei_tt " 1371 + "ON " 1372 + TriggerContract.TABLE 1373 + "( " 1374 + TriggerContract.ATTRIBUTION_DESTINATION 1375 + ", " 1376 + TriggerContract.ENROLLMENT_ID 1377 + ", " 1378 + TriggerContract.TRIGGER_TIME 1379 + " ASC)", 1380 "CREATE INDEX " 1381 + INDEX_PREFIX 1382 + TriggerContract.TABLE 1383 + "_tt " 1384 + "ON " 1385 + TriggerContract.TABLE 1386 + "(" 1387 + TriggerContract.TRIGGER_TIME 1388 + ")", 1389 "CREATE INDEX " 1390 + INDEX_PREFIX 1391 + AttributionContract.TABLE 1392 + "_s_ss_ds_ei_tt" 1393 + " ON " 1394 + AttributionContract.TABLE 1395 + "(" 1396 + AttributionContract.SCOPE 1397 + ", " 1398 + AttributionContract.SOURCE_SITE 1399 + ", " 1400 + AttributionContract.DESTINATION_SITE 1401 + ", " 1402 + AttributionContract.ENROLLMENT_ID 1403 + ", " 1404 + AttributionContract.TRIGGER_TIME 1405 + ")", 1406 "CREATE INDEX " 1407 + INDEX_PREFIX 1408 + XnaIgnoredSourcesContract.TABLE 1409 + "_ei " 1410 + "ON " 1411 + XnaIgnoredSourcesContract.TABLE 1412 + "(" 1413 + XnaIgnoredSourcesContract.ENROLLMENT_ID 1414 + ")", 1415 "CREATE INDEX " 1416 + INDEX_PREFIX 1417 + AppReportHistoryContract.TABLE 1418 + "_lrdt " 1419 + "ON " 1420 + AppReportHistoryContract.TABLE 1421 + "(" 1422 + AppReportHistoryContract.LAST_REPORT_DELIVERED_TIME 1423 + ")", 1424 "CREATE INDEX " 1425 + INDEX_PREFIX 1426 + AppReportHistoryContract.TABLE 1427 + "_ro_ad " 1428 + "ON " 1429 + AppReportHistoryContract.TABLE 1430 + "(" 1431 + AppReportHistoryContract.REGISTRATION_ORIGIN 1432 + ", " 1433 + AppReportHistoryContract.APP_DESTINATION 1434 + ")", 1435 "CREATE INDEX " 1436 + INDEX_PREFIX 1437 + CountUniqueReportingContract.TABLE 1438 + "_c_u_r " 1439 + " ON " 1440 + CountUniqueReportingContract.TABLE 1441 + "(" 1442 + CountUniqueReportingContract.REPORT_ID 1443 + ", " 1444 + CountUniqueReportingContract.REPORTING_ORIGIN 1445 + ")", 1446 }; 1447 1448 public static final String[] CREATE_INDEXES_V6 = { 1449 "CREATE INDEX " 1450 + INDEX_PREFIX 1451 + SourceContract.TABLE 1452 + "_ad_ei_et " 1453 + "ON " 1454 + SourceContract.TABLE 1455 + "( " 1456 + MeasurementTablesDeprecated.SourceContract.APP_DESTINATION 1457 + ", " 1458 + SourceContract.ENROLLMENT_ID 1459 + ", " 1460 + SourceContract.EXPIRY_TIME 1461 + " DESC " 1462 + ")", 1463 "CREATE INDEX " 1464 + INDEX_PREFIX 1465 + SourceContract.TABLE 1466 + "_et " 1467 + "ON " 1468 + SourceContract.TABLE 1469 + "(" 1470 + SourceContract.EXPIRY_TIME 1471 + ")", 1472 "CREATE INDEX " 1473 + INDEX_PREFIX 1474 + SourceContract.TABLE 1475 + "_p_ad_wd_s_et " 1476 + "ON " 1477 + SourceContract.TABLE 1478 + "(" 1479 + SourceContract.PUBLISHER 1480 + ", " 1481 + MeasurementTablesDeprecated.SourceContract.APP_DESTINATION 1482 + ", " 1483 + MeasurementTablesDeprecated.SourceContract.WEB_DESTINATION 1484 + ", " 1485 + SourceContract.STATUS 1486 + ", " 1487 + SourceContract.EVENT_TIME 1488 + ")", 1489 "CREATE INDEX " 1490 + INDEX_PREFIX 1491 + TriggerContract.TABLE 1492 + "_ad_ei_tt " 1493 + "ON " 1494 + TriggerContract.TABLE 1495 + "( " 1496 + TriggerContract.ATTRIBUTION_DESTINATION 1497 + ", " 1498 + TriggerContract.ENROLLMENT_ID 1499 + ", " 1500 + TriggerContract.TRIGGER_TIME 1501 + " ASC)", 1502 "CREATE INDEX " 1503 + INDEX_PREFIX 1504 + TriggerContract.TABLE 1505 + "_tt " 1506 + "ON " 1507 + TriggerContract.TABLE 1508 + "(" 1509 + TriggerContract.TRIGGER_TIME 1510 + ")", 1511 "CREATE INDEX " 1512 + INDEX_PREFIX 1513 + AttributionContract.TABLE 1514 + "_ss_so_ds_do_ei_tt" 1515 + " ON " 1516 + AttributionContract.TABLE 1517 + "(" 1518 + AttributionContract.SOURCE_SITE 1519 + ", " 1520 + AttributionContract.SOURCE_ORIGIN 1521 + ", " 1522 + AttributionContract.DESTINATION_SITE 1523 + ", " 1524 + AttributionContract.DESTINATION_ORIGIN 1525 + ", " 1526 + AttributionContract.ENROLLMENT_ID 1527 + ", " 1528 + AttributionContract.TRIGGER_TIME 1529 + ")" 1530 }; 1531 1532 public static final String CREATE_TABLE_APP_REPORT_HISTORY_LATEST = 1533 "CREATE TABLE " 1534 + AppReportHistoryContract.TABLE 1535 + " (" 1536 + AppReportHistoryContract.REGISTRATION_ORIGIN 1537 + " TEXT, " 1538 + AppReportHistoryContract.APP_DESTINATION 1539 + " TEXT, " 1540 + AppReportHistoryContract.LAST_REPORT_DELIVERED_TIME 1541 + " INTEGER, " 1542 + "PRIMARY KEY(" 1543 + AppReportHistoryContract.REGISTRATION_ORIGIN 1544 + ", " 1545 + AppReportHistoryContract.APP_DESTINATION 1546 + "))"; 1547 1548 public static final String CREATE_TABLE_COUNT_UNIQUE_REPORTING_LATEST = 1549 "CREATE TABLE " 1550 + CountUniqueReportingContract.TABLE 1551 + " (" 1552 + CountUniqueReportingContract.REPORT_ID 1553 + " TEXT, " 1554 + CountUniqueReportingContract.PAYLOAD 1555 + " TEXT, " 1556 + CountUniqueReportingContract.REPORTING_ORIGIN 1557 + " TEXT, " 1558 + CountUniqueReportingContract.STATUS 1559 + " INTEGER, " 1560 + CountUniqueReportingContract.SCHEDULED_REPORT_TIME 1561 + " INTEGER, " 1562 + CountUniqueReportingContract.API_VERSION 1563 + " TEXT, " 1564 + CountUniqueReportingContract.DEBUG_KEY 1565 + " TEXT, " 1566 + CountUniqueReportingContract.CONTEXT_ID 1567 + " TEXT, " 1568 + CountUniqueReportingContract.DEBUG_REPORT_STATUS 1569 + " INTEGER, " 1570 + CountUniqueReportingContract.ENROLLMENT_ID 1571 + " TEXT, " 1572 + CountUniqueReportingContract.CONTRIBUTION_VALUE 1573 + " INTEGER, " 1574 + CountUniqueReportingContract.CONTRIBUTION_TIME 1575 + " INTEGER, " 1576 + "PRIMARY KEY(" 1577 + CountUniqueReportingContract.REPORT_ID 1578 + "))"; 1579 1580 public static final String CREATE_TABLE_COUNT_UNIQUE_METADATA_LATEST = 1581 "CREATE TABLE " 1582 + MeasurementTables.CountUniqueMetadataContract.TABLE 1583 + " (" 1584 + MeasurementTables.CountUniqueMetadataContract.REPORTING_ORIGIN 1585 + " TEXT, " 1586 + MeasurementTables.CountUniqueMetadataContract.KEY 1587 + " TEXT, " 1588 + MeasurementTables.CountUniqueMetadataContract.VALUE 1589 + " INTEGER, " 1590 + MeasurementTables.CountUniqueMetadataContract.EXPIRATION_TIME 1591 + " INTEGER, " 1592 + "PRIMARY KEY (" 1593 + MeasurementTables.CountUniqueMetadataContract.KEY 1594 + ", " 1595 + MeasurementTables.CountUniqueMetadataContract.REPORTING_ORIGIN 1596 + " )" 1597 + " )"; 1598 1599 // endepmic ads 1600 // Consolidated list of create statements for all tables. 1601 public static final List<String> CREATE_STATEMENTS = 1602 Collections.unmodifiableList( 1603 Arrays.asList( 1604 CREATE_TABLE_SOURCE_LATEST, 1605 CREATE_TABLE_SOURCE_DESTINATION_LATEST, 1606 CREATE_TABLE_SOURCE_ATTRIBUTION_SCOPE_LATEST, 1607 CREATE_TABLE_SOURCE_NAMED_BUDGET_LATEST, 1608 CREATE_TABLE_TRIGGER_LATEST, 1609 CREATE_TABLE_EVENT_REPORT_LATEST, 1610 CREATE_TABLE_ATTRIBUTION_LATEST, 1611 CREATE_TABLE_AGGREGATE_REPORT_LATEST, 1612 CREATE_TABLE_AGGREGATE_ENCRYPTION_KEY_LATEST, 1613 CREATE_TABLE_ASYNC_REGISTRATION_LATEST, 1614 CREATE_TABLE_DEBUG_REPORT_LATEST, 1615 CREATE_TABLE_AGGREGATABLE_DEBUG_REPORT_BUDGET_TRACKER_LATEST, 1616 CREATE_TABLE_XNA_IGNORED_SOURCES_LATEST, 1617 CREATE_TABLE_KEY_VALUE_STORE_LATEST, 1618 CREATE_TABLE_APP_REPORT_HISTORY_LATEST, 1619 CREATE_TABLE_COUNT_UNIQUE_REPORTING_LATEST, 1620 CREATE_TABLE_COUNT_UNIQUE_METADATA_LATEST)); 1621 1622 // Consolidated list of create statements for all tables at version 6. 1623 public static final List<String> CREATE_STATEMENTS_V6 = 1624 Collections.unmodifiableList( 1625 Arrays.asList( 1626 CREATE_TABLE_SOURCE_V6, 1627 CREATE_TABLE_TRIGGER_V6, 1628 CREATE_TABLE_EVENT_REPORT_V3, 1629 CREATE_TABLE_ATTRIBUTION_V6, 1630 CREATE_TABLE_AGGREGATE_REPORT_V6, 1631 CREATE_TABLE_AGGREGATE_ENCRYPTION_KEY_V6, 1632 CREATE_TABLE_ASYNC_REGISTRATION_V6, 1633 CREATE_TABLE_DEBUG_REPORT_V3, 1634 CREATE_TABLE_XNA_IGNORED_SOURCES_V6)); 1635 1636 // Private constructor to prevent instantiation. MeasurementTables()1637 private MeasurementTables() { 1638 } 1639 } 1640