Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bonetechnologies/31ab592ed08096043b93ca358bafeb4d to your computer and use it in GitHub Desktop.
Save bonetechnologies/31ab592ed08096043b93ca358bafeb4d to your computer and use it in GitHub Desktop.
CREATE TABLE user_properties(
id BIGINT NOT NULL AUTO_INCREMENT,
legacy_user_id BIGINT NOT NULL,
vevo_user_id VARCHAR(22) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
property_type VARCHAR(255) NOT NULL,
created DATETIME DEFAULT CURRENT_TIMESTAMP,
modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY property_type_unique (vevo_user_id, property_type),
PRIMARY KEY(id),
FOREIGN KEY(vevo_user_id) REFERENCES id_generation(vevo_user_id),
FOREIGN KEY(legacy_user_id) REFERENCES id_generation(legacy_user_id));
CREATE TABLE user_properties_values(
id BIGINT NOT NULL AUTO_INCREMENT,
property_id BIGINT NOT NULL,
property_value VARCHAR(255) NOT NULL,
created DATETIME DEFAULT CURRENT_TIMESTAMP,
modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY(property_id) REFERENCES user_properties(id) ON DELETE CASCADE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment