Definition
- Diagram
- MySQL
CREATE TABLE IF NOT EXISTS `organizations` (
`id` bigint(20) unsigned NOT NULL,
`organization_name` varchar(127) NOT NULL,
`status` int(10) NOT NULL COMMENT '-1 deleted 0 pendding 1 valid',
`created_at` timestamp NULL,
`updated_at` timestamp NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `organization_users` (
`organization_id` bigint(20) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`organization_id`, `user_id`),
CONSTRAINT `fk_organization_users_organization_id` FOREIGN KEY (`organization_id`) REFERENCES `organizations` (`id`)
);
Organization
AttributeName | AttributeType | ColumnName | DataType | NotNull | Comment |
---|---|---|---|---|---|
ID | uint64 | id | bigint(20) unsigned | true | |
OrganizationName | string | organization_name | varchar(127) | true | |
Status | int | status | int(10) | true | -1 deleted 0 pendding 1 valid |
CreatedAt | *time.Time | created_at | timestamp | false | |
UpdatedAt | *time.Time | updated_at | timestamp | false |
User
AttributeName | AttributeType | ColumnName | DataType | NotNull | Comment |
---|---|---|---|---|---|
ID | uint64 | id | bigint(20) unsigned | true |
OrganizationUser
AttributeName | AttributeType | ColumnName | DataType | NotNull | Comment |
---|---|---|---|---|---|
OrganizationID | uint64 | organization_id | bigint(20) unsigned | true | |
UserID | uint64 | user_id | bigint(20) unsigned | true |