1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00
phorge-phorge/resources/sql/patches/20131208.phragmentsnapshot.sql
James Rhodes 8bb6e807f0 Implement snapshots in Phragment
Summary:
Ref T4212.  This implements snapshots in Phragment, which allows you to take a snapshot of a fragment at a given point in time, and download a ZIP of the snapshot as it was in this state.

There's also functionality for deleting and promoting snapshots.  You can promote a snapshot to either the latest version or any other snapshot of the fragment.

Test Plan: Clicked around, took some snapshots, promoted them to different points and deleted snapshots.  Also downloaded ZIPs of the snapshots and saw the right versions coming through for all the files downloaded.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4205, T4212

Differential Revision: https://secure.phabricator.com/D7741
2013-12-09 08:24:50 +11:00

21 lines
988 B
SQL

CREATE TABLE {$NAMESPACE}_phragment.phragment_snapshot (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
primaryFragmentPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
name VARCHAR(192) NOT NULL COLLATE utf8_bin,
description LONGTEXT NULL COLLATE utf8_bin,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (phid),
UNIQUE KEY `key_name` (primaryFragmentPHID, name)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_phragment.phragment_snapshotchild (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
snapshotPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
fragmentPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
fragmentVersionPHID VARCHAR(64) NULL COLLATE utf8_bin,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_child` (snapshotPHID, fragmentPHID, fragmentVersionPHID)
) ENGINE=InnoDB, COLLATE utf8_general_ci;