Skip to content

Instantly share code, notes, and snippets.

@elmiko
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elmiko/9badea7384aaec355a06 to your computer and use it in GitHub Desktop.
Save elmiko/9badea7384aaec355a06 to your computer and use it in GitHub Desktop.
mysql postgresql tenant_secret table differences

mysql

CREATE TABLE `tenant_secret` (
        `id` varchar(36) NOT NULL,
        `created_at` datetime NOT NULL,
        `updated_at` datetime NOT NULL,
        `deleted_at` datetime DEFAULT NULL,
        `deleted` tinyint(1) NOT NULL,
        `status` varchar(20) NOT NULL,
        `role` varchar(255) DEFAULT NULL,
        `tenant_id` varchar(36) NOT NULL,
        `secret_id` varchar(36) NOT NULL,
        PRIMARY KEY (`id`,`tenant_id`,`secret_id`),
        UNIQUE KEY `_tenant_secret_uc` (`tenant_id`,`secret_id`),
        KEY `secret_id` (`secret_id`),
        CONSTRAINT `tenant_secret_ibfk_1` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`),
        CONSTRAINT `tenant_secret_ibfk_2` FOREIGN KEY (`secret_id`) REFERENCES `secrets` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

postgresql

Table "public.tenant_secret"
Column   |            Type             | Modifiers | Storage  | Stats target | Description 
------------+-----------------------------+-----------+----------+--------------+-------------
id         | character varying(36)       | not null  | extended |              | 
created_at | timestamp without time zone | not null  | plain    |              | 
updated_at | timestamp without time zone | not null  | plain    |              | 
deleted_at | timestamp without time zone |           | plain    |              | 
deleted    | boolean                     | not null  | plain    |              | 
status     | character varying(20)       | not null  | extended |              | 
role       | character varying(255)      |           | extended |              | 
tenant_id  | character varying(36)       | not null  | extended |              | 
secret_id  | character varying(36)       | not null  | extended |              | 
Indexes:
"tenant_secret_pkey" PRIMARY KEY, btree (id, tenant_id, secret_id)
"_tenant_secret_uc" UNIQUE CONSTRAINT, btree (tenant_id, secret_id)
Foreign-key constraints:
"tenant_secret_secret_id_fkey" FOREIGN KEY (secret_id) REFERENCES secrets(id)
"tenant_secret_tenant_id_fkey" FOREIGN KEY (tenant_id) REFERENCES tenants(id)
Has OIDs: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment