For Create Tables
Point 1. Primary Key must be combination with TenantID and key field.
![](/Asset/S-4/primarykey.png)
1 (i). All PK should have TenantID+EntityID as primary key. But in large tables, use EntityID+TenantID as primary key to improve update query performance.
![](/Asset/S-4/largetables.png)
1 (ii). If EntityID is integer, and used in other tables, Primary key = EntityID+TenantID.
![](/Asset/S-4/entityid.png)
1 (iii). If EntityID is integer, and not used in other tables, Primary key = EntityID and EntityID is guid, Primary key = EntityID OK
![](/Asset/S-4/entityid-not-used.png)
Point 2. TenantID must have default value & using this for default value rls.fncGetTenantID ()
![](/Asset/S-4/defaultvalue.png)
Point 3. Frist letter of all columns should be Capital and ID fields to be appear on top.
![](/Asset/S-4/capitalletter.png)
Point 4. Must be added require relationship for ID fields with combination TenantID like as FK.
![](/Asset/S-4/relationship.png)
4 (i). All FK should have TenantID+EntityID as primary key. But in large tables, use EntityID+TenantID as primary key to improve update query performance.
![](/Asset/S-4/fk.png)
Point 5. Add Unique Constraints: All unique indexes should have TenantID in it as last column.
![](/Asset/S-4/uniqueconstraints.png)
Point 6. Applied proper Indexes for ID's field which are included in Join & where Conditions in functions & views and all indexes apart from primary index should not have TenantID column.
![](/Asset/S-4/index.png)
![](/Asset/S-4/indexcolumn.png)
![](/Asset/S-4/indexcolumns.png)
Point 7. Created table should be included in tenantAccessPolicy (If it's Tenant Based)
![](/Asset/S-4/tenantaccesspolicy.png)
Point 8. Assigned require permission to roles
8 (i). Go to Database->Right click on Table and select Properties.
![](/Asset/S-4/tablerightclick.png)
8 (ii). Select Permissions and click on Search button and click Browse button.
![](/Asset/S-4/permissions.png)
8 (iii). After click on Browse button Browse window open and marked on require objects(Roles, Users) and click on Ok.
![](/Asset/S-4/browse.png)
8 (iv). Now we can assigned require permission(Select/Delete/Insert/Update) click on Ok.
![](/Asset/S-4/tableproperty.png)
Point 9. Synced with other Database where Table is require.
![](/Asset/S-4/syncdb.png)