geoff-maddock / events-tracker

CRM and calendar to track events, weekly and monthly series, promoters, artists, producers, djs, venues and other entities.
https://arcane.city
MIT License
16 stars 6 forks source link

Relate entities to other entities #2

Open geoff-maddock opened 8 years ago

geoff-maddock commented 8 years ago

Add a method to relate entities to other entities.

geoff-maddock commented 7 years ago

Revisit this. I'll have to include the type of relation, which i've not implemented anywhere yet.

geoff-maddock commented 5 years ago

Not super useful, keep in backlog

geoff-maddock commented 3 years ago

Here's what was in my database schema. I'm removing this for now, but will revisit this issue in the future:

      relation        data        relations of objects - not currently used           none        FI           DROP  BARE - NO   * dupe of relations - DELETED
        // Friend, Alias, Founder, Officer, Member, Fan  * Might actually be relations instead of relation
      relation_attribute no data  key values for relation types - template for data?  n/a         FI           KEEP?  BARE - NO   * not used currently - DELETED
      relation_status data        statuses for relations                              n/a         n/a          KEEP?  BARE - YES? * not used currently - DELETED
        // Request, Pending, Confirmed, Banned
      relation_type   data        types of relations                                  n/a         n/a          KEEP?  BARE - YES? * not used currently
        // User, Entity, Group
      relations       no data     relations of objects - not currently used           FCU         FI           KEEP?  BARE - YES? * dupe for relation - pick one?
geoff-maddock commented 3 years ago
CREATE TABLE `relation_status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(16) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

CREATE TABLE `relation_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

CREATE TABLE `relations` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `end_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `relation_type_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `relations_relation_type_index` (`relation_type_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
geoff-maddock commented 3 years ago

Would need to add to implement this: entity_user_relation entity_entity_relation

geoff-maddock commented 5 days ago

Revisit this to relate entities to other entities - do we need meta data?