Skip to content

Document database changes between pristine DB and SQL export #88

Description

@dokterbob

Essentially, the pristine db has some deletedDate fields listing when objects were deleted and the export has flags2 in pro_accounts and recentViewCount and viewCount in pro_padmeta.

It would be great to make an SQL file automatically converting an export to a directly usable format, or at least having something of a tutorial how to import this.

Full diff:

*** hackpad-pristine-structure-07-11-17.sql.txt	2017-11-07 16:16:05.000000000 +0000
--- hackpad-export-structure-07-11-17.sql.txt	2017-11-07 16:17:10.000000000 +0000
***************
*** 7,13 ****
  #
  # Host: 172.18.0.3 (MySQL 5.7.20)
  # Database: hackpad
! # Generation Time: 2017-11-07 16:16:05 +0000
  # ************************************************************
  
  
--- 7,13 ----
  #
  # Host: 172.18.0.3 (MySQL 5.7.20)
  # Database: hackpad
! # Generation Time: 2017-11-07 16:17:10 +0000
  # ************************************************************
  
  
*************** CREATE TABLE `oauth_scopes` (
*** 176,188 ****
  # ------------------------------------------------------------
  
  CREATE TABLE `pad_access` (
-   `globalPadId` varchar(128) COLLATE utf8_bin NOT NULL,
    `hostUserId` int(11) DEFAULT NULL,
-   `userId` int(11) DEFAULT NULL,
    `facebookId` varchar(20) COLLATE utf8_bin DEFAULT NULL,
    `facebookPostId` varchar(20) COLLATE utf8_bin DEFAULT NULL,
!   `createdDate` datetime DEFAULT NULL,
    `lastAccessedDate` datetime DEFAULT NULL,
    `type` tinyint(4) DEFAULT '0',
    `token` varchar(20) COLLATE utf8_bin DEFAULT NULL,
    `groupId` int(11) DEFAULT NULL,
--- 176,188 ----
  # ------------------------------------------------------------
  
  CREATE TABLE `pad_access` (
    `hostUserId` int(11) DEFAULT NULL,
    `facebookId` varchar(20) COLLATE utf8_bin DEFAULT NULL,
    `facebookPostId` varchar(20) COLLATE utf8_bin DEFAULT NULL,
!   `userId` int(11) DEFAULT NULL,
    `lastAccessedDate` datetime DEFAULT NULL,
+   `globalPadId` varchar(128) COLLATE utf8_bin NOT NULL,
+   `createdDate` datetime DEFAULT NULL,
    `type` tinyint(4) DEFAULT '0',
    `token` varchar(20) COLLATE utf8_bin DEFAULT NULL,
    `groupId` int(11) DEFAULT NULL,
*************** CREATE TABLE `pad_access` (
*** 190,196 ****
    `isRevoked` tinyint(1) DEFAULT '0',
    KEY `idx_userId_type` (`userId`,`type`),
    KEY `idx_globalPadId_type` (`globalPadId`,`type`),
!   KEY `idx_groupId` (`groupId`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
  
--- 190,197 ----
    `isRevoked` tinyint(1) DEFAULT '0',
    KEY `idx_userId_type` (`userId`,`type`),
    KEY `idx_globalPadId_type` (`globalPadId`,`type`),
!   KEY `idx_groupId` (`groupId`),
!   KEY `idx_hostUserId_type` (`hostUserId`,`type`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
  
*************** CREATE TABLE `PAD_AUTHORS_TEXT` (
*** 226,231 ****
--- 227,233 ----
    `PAGESTART` int(11) DEFAULT NULL,
    `OFFSETS` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT ',,,,,,,,,,,,,,,,,,,',
    `DATA` mediumtext COLLATE utf8_bin NOT NULL,
+   UNIQUE KEY `NUMID` (`NUMID`,`PAGESTART`),
    KEY `PAD_AUTHORS-NUMID-PAGESTART` (`NUMID`,`PAGESTART`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
*************** CREATE TABLE `PAD_REVS100_TEXT` (
*** 417,422 ****
--- 419,425 ----
    `PAGESTART` int(11) DEFAULT NULL,
    `OFFSETS` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT ',,,,,,,,,,,,,,,,,,,',
    `DATA` mediumtext COLLATE utf8_bin NOT NULL,
+   UNIQUE KEY `NUMID` (`NUMID`,`PAGESTART`),
    KEY `PAD_REVS100-NUMID-PAGESTART` (`NUMID`,`PAGESTART`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
*************** CREATE TABLE `PAD_REVS1000_TEXT` (
*** 442,447 ****
--- 445,451 ----
    `PAGESTART` int(11) DEFAULT NULL,
    `OFFSETS` varchar(256) COLLATE utf8_bin NOT NULL DEFAULT ',,,,,,,,,,,,,,,,,,,',
    `DATA` mediumtext COLLATE utf8_bin NOT NULL,
+   UNIQUE KEY `NUMID` (`NUMID`,`PAGESTART`),
    KEY `PAD_REVS1000-NUMID-PAGESTART` (`NUMID`,`PAGESTART`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
*************** CREATE TABLE `PAD_SEGMENTS_TEXT` (
*** 477,485 ****
  
  CREATE TABLE `PAD_SQLMETA` (
    `id` varchar(128) COLLATE utf8_bin NOT NULL,
-   `version` int(11) NOT NULL,
-   `creationTime` datetime NOT NULL,
    `lastWriteTime` datetime NOT NULL,
    `headRev` int(11) NOT NULL,
    `guestPolicy` varchar(20) COLLATE utf8_bin NOT NULL,
    `lastSyndicatedRev` int(11) NOT NULL DEFAULT '0',
--- 481,489 ----
  
  CREATE TABLE `PAD_SQLMETA` (
    `id` varchar(128) COLLATE utf8_bin NOT NULL,
    `lastWriteTime` datetime NOT NULL,
+   `creationTime` datetime NOT NULL,
+   `version` int(11) NOT NULL,
    `headRev` int(11) NOT NULL,
    `guestPolicy` varchar(20) COLLATE utf8_bin NOT NULL,
    `lastSyndicatedRev` int(11) NOT NULL DEFAULT '0',
*************** CREATE TABLE `pro_account_key_values` (
*** 538,546 ****
  CREATE TABLE `pro_account_usage` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `domainId` int(11) NOT NULL,
    `count` int(11) NOT NULL DEFAULT '0',
    `lastReset` datetime DEFAULT NULL,
-   `lastUpdated` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `domainId` (`domainId`),
    KEY `idx_domainId` (`domainId`)
--- 542,550 ----
  CREATE TABLE `pro_account_usage` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `domainId` int(11) NOT NULL,
+   `lastUpdated` datetime DEFAULT NULL,
    `count` int(11) NOT NULL DEFAULT '0',
    `lastReset` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `domainId` (`domainId`),
    KEY `idx_domainId` (`domainId`)
*************** CREATE TABLE `pro_account_usage` (
*** 553,572 ****
  
  CREATE TABLE `pro_accounts` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
-   `domainId` int(11) NOT NULL,
    `fullName` varchar(128) COLLATE utf8_bin NOT NULL,
!   `email` varchar(128) COLLATE utf8_bin NOT NULL,
!   `passwordHash` varchar(128) COLLATE utf8_bin DEFAULT NULL,
!   `createdDate` datetime NOT NULL,
    `lastLoginDate` datetime DEFAULT NULL,
    `isAdmin` tinyint(1) DEFAULT '0',
    `tempPassHash` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `isDeleted` tinyint(1) NOT NULL DEFAULT '0',
    `fbid` char(20) COLLATE utf8_bin DEFAULT NULL,
    `flags` tinyint(3) DEFAULT '0',
    `deletedDate` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
!   KEY `idx_domainId_email` (`domainId`,`email`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
  
--- 557,578 ----
  
  CREATE TABLE `pro_accounts` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `fullName` varchar(128) COLLATE utf8_bin NOT NULL,
!   `domainId` int(11) NOT NULL,
    `lastLoginDate` datetime DEFAULT NULL,
+   `email` varchar(128) COLLATE utf8_bin NOT NULL,
    `isAdmin` tinyint(1) DEFAULT '0',
+   `createdDate` datetime NOT NULL,
+   `passwordHash` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `tempPassHash` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `isDeleted` tinyint(1) NOT NULL DEFAULT '0',
    `fbid` char(20) COLLATE utf8_bin DEFAULT NULL,
    `flags` tinyint(3) DEFAULT '0',
    `deletedDate` datetime DEFAULT NULL,
+   `flags2` bigint(20) DEFAULT '0',
    PRIMARY KEY (`id`),
!   KEY `idx_domainId_email` (`domainId`,`email`),
!   KEY `idx_email` (`email`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
  
*************** CREATE TABLE `pro_config` (
*** 621,632 ****
  
  CREATE TABLE `pro_domains` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
-   `subDomain` varchar(128) COLLATE utf8_bin NOT NULL,
    `extDomain` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `orgName` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `createdDate` datetime DEFAULT NULL,
    `isDeleted` tinyint(1) NOT NULL DEFAULT '0',
-   `deletedDate` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `idx_subDomain` (`subDomain`),
    KEY `idx_extDomain` (`extDomain`),
--- 627,637 ----
  
  CREATE TABLE `pro_domains` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `extDomain` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `orgName` varchar(128) COLLATE utf8_bin DEFAULT NULL,
+   `subDomain` varchar(128) COLLATE utf8_bin NOT NULL,
    `createdDate` datetime DEFAULT NULL,
    `isDeleted` tinyint(1) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`),
    KEY `idx_subDomain` (`subDomain`),
    KEY `idx_extDomain` (`extDomain`),
*************** CREATE TABLE `pro_dropbox_sync` (
*** 651,660 ****
  # ------------------------------------------------------------
  
  CREATE TABLE `pro_group_members` (
    `groupId` int(11) NOT NULL,
    `userId` int(11) NOT NULL,
-   `isMember` tinyint(1) DEFAULT '1',
-   `addedDate` datetime NOT NULL,
    `addedByUserId` int(11) DEFAULT NULL,
    `facebookPostId` varchar(20) COLLATE utf8_bin DEFAULT NULL,
    `token` varchar(20) COLLATE utf8_bin DEFAULT NULL,
--- 656,665 ----
  # ------------------------------------------------------------
  
  CREATE TABLE `pro_group_members` (
+   `addedDate` datetime NOT NULL,
+   `isMember` tinyint(1) DEFAULT '1',
    `groupId` int(11) NOT NULL,
    `userId` int(11) NOT NULL,
    `addedByUserId` int(11) DEFAULT NULL,
    `facebookPostId` varchar(20) COLLATE utf8_bin DEFAULT NULL,
    `token` varchar(20) COLLATE utf8_bin DEFAULT NULL,
*************** CREATE TABLE `pro_group_members` (
*** 668,682 ****
  # ------------------------------------------------------------
  
  CREATE TABLE `pro_groups` (
    `groupId` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(128) COLLATE utf8_bin NOT NULL,
-   `createdDate` datetime NOT NULL,
-   `creatorId` int(11) NOT NULL,
    `facebookGroupId` varchar(128) COLLATE utf8_bin DEFAULT NULL,
!   `isPublic` tinyint(1) DEFAULT '0',
    `isDeleted` tinyint(1) DEFAULT '0',
    `domainId` int(11) DEFAULT NULL,
-   `deletedDate` datetime DEFAULT NULL,
    PRIMARY KEY (`groupId`),
    KEY `idx_groupId` (`groupId`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--- 673,686 ----
  # ------------------------------------------------------------
  
  CREATE TABLE `pro_groups` (
+   `creatorId` int(11) NOT NULL,
+   `isPublic` tinyint(1) DEFAULT '0',
    `groupId` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(128) COLLATE utf8_bin NOT NULL,
    `facebookGroupId` varchar(128) COLLATE utf8_bin DEFAULT NULL,
!   `createdDate` datetime NOT NULL,
    `isDeleted` tinyint(1) DEFAULT '0',
    `domainId` int(11) DEFAULT NULL,
    PRIMARY KEY (`groupId`),
    KEY `idx_groupId` (`groupId`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
*************** CREATE TABLE `pro_oauth_tokens` (
*** 713,734 ****
  # ------------------------------------------------------------
  
  CREATE TABLE `pro_padmeta` (
-   `id` int(11) NOT NULL AUTO_INCREMENT,
-   `domainId` int(11) NOT NULL,
    `localPadId` varchar(128) COLLATE utf8_bin NOT NULL,
!   `title` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `creatorId` int(11) DEFAULT NULL,
!   `createdDate` datetime NOT NULL,
    `lastEditorId` int(11) DEFAULT NULL,
    `lastEditedDate` datetime DEFAULT NULL,
    `password` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `isDeleted` tinyint(1) NOT NULL DEFAULT '0',
    `isArchived` tinyint(1) NOT NULL DEFAULT '0',
    `proAttrsJson` mediumtext COLLATE utf8_bin,
!   `deletedDate` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `idx_domainId_localPadId` (`domainId`,`localPadId`),
!   KEY `idx_creatorId_lastEditedDate` (`creatorId`,`lastEditedDate`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  
  
--- 717,740 ----
  # ------------------------------------------------------------
  
  CREATE TABLE `pro_padmeta` (
    `localPadId` varchar(128) COLLATE utf8_bin NOT NULL,
!   `id` int(11) NOT NULL AUTO_INCREMENT,
    `creatorId` int(11) DEFAULT NULL,
!   `title` varchar(128) COLLATE utf8_bin DEFAULT NULL,
!   `domainId` int(11) NOT NULL,
    `lastEditorId` int(11) DEFAULT NULL,
    `lastEditedDate` datetime DEFAULT NULL,
+   `createdDate` datetime NOT NULL,
    `password` varchar(128) COLLATE utf8_bin DEFAULT NULL,
    `isDeleted` tinyint(1) NOT NULL DEFAULT '0',
    `isArchived` tinyint(1) NOT NULL DEFAULT '0',
    `proAttrsJson` mediumtext COLLATE utf8_bin,
!   `viewCount` int(11) NOT NULL DEFAULT '0',
!   `recentViewCount` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`),
    KEY `idx_domainId_localPadId` (`domainId`,`localPadId`),
!   KEY `idx_creatorId_lastEditedDate` (`creatorId`,`lastEditedDate`),
!   KEY `idx_id` (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Raw SQL of structure

hackpad-pristine-structure-07-11-17.sql.txt
hackpad-export-structure-07-11-17.sql.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions