<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="147189" data-post-id="147189">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="abitdodgy" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/abitdodgy/120/24328_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  abitdodgy
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What do you do when you need data from two schemas in this case? For example, say you want to get a product from a <code>catalog</code> schema and its creator or editor from a <code>users</code> shema. Things could get complicate fast. One of the things that joins and associations do well is sorting, linking, and organising data.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="147189" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/different-apps-shared-database-different-schema-a-good-idea/26123/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-147189" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="147189"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="147191" data-post-id="147191">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="anthonator" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/anthonator/120/14467_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  anthonator
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What’s hard with this approach is drawing your boundaries. If you have two tables that rely on each other then they may belong within the same application. If you feel like you need to create a join between two applications that could be a signal that your boundary is incorrect.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="147191" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/different-apps-shared-database-different-schema-a-good-idea/26123/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-147191" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="147191"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="147228" data-post-id="147228">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="abitdodgy" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/abitdodgy/120/24328_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  abitdodgy
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think it’s an impossible task to draw your boundaries objectively since there is no single criteria that can tell you right from wrong. For example, I work for a multichannel commerce company. We have several business systems that could be thought of as coupled or independent. This is an extremely oversimplified example:</p>
<ol>
<li>A PIM (product information management) system for registering and distributing product data to a number of other applications.</li>
<li>An e-commerce website.</li>
<li>User management for said applications.</li>
</ol>
<p>The PIM is used to create and enrich product data. From poster descriptions, to label information, all the way to web descriptions and digital assets. The PIM is responsible for a hundred or so attributes and only a couple of dozen of those are used on the e-commerce website.</p>
<p>But, fundamentally, they both make use of the same data. Products and prices, along with other tables specific to each system. They also share the same users.</p>
<p>If you separate them, you would have to duplicate and then synchronise shared data. If you couple them, then you would be writing two fundamentally different systems that happen to share a subset of data.</p>
<p>Whether you decide to decouple them entirely or within an umbrella doesn’t matter. An umbrella merely brings some conveniences. You said you treat schemas as separate databases. So, in this case, your approach would be to have a products table in both apps, a user table in both apps, etc… you might run into issues of session management, which user to authenticate, track, and and all sorts of other stuff, but I don’t know if these drawbacks are that serious.</p>
<p>There isn’t an easy answer here. Coupling the schemas could reduce duplication, but perhaps it’s not worth the hassle.</p>
<p>PS: We actually have an e-commerce, estimates, internal sales, and telesales systems. We also have an ERP connector, users, BI automation, marketing communication with suppliers, shipping app and api, customer registration app, and more. Sometimes you can say it’s all related. E-commerce needs customers and products. So do internal sales systems. So does an estimates app.</p>
<p>Deciding whether all this stuff belongs to the same app or in separate apps and databases is tricky.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="147228" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/different-apps-shared-database-different-schema-a-good-idea/26123/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-147228" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="147228"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="147595" data-post-id="147595">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chouzar" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chouzar/120/36037_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chouzar
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="abitdodgy" data-post="14" data-topic="26123">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/abitdodgy/48/24328_2.png" class="avatar"> abitdodgy:</div>
<blockquote>
<p>The PIM is used to create and enrich product data. From poster descriptions, to label information, all the way to web descriptions and digital assets.</p>
</blockquote>
</aside>
<p>Sounds like a current design I’m dealing with (just a toy project), basically I have an app that prints documents and a CRUD app which manages users. I need some of the user information to “stamp” the document and print it, so the document app contains both document and user schemas.</p>
<div class="md-table">
<table>
<thead>
<tr>
<th>User App</th>
<th style="text-align:center"></th>
<th>Document App</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td style="text-align:center"></td>
<td>Document schema</td>
</tr>
<tr>
<td>User schema</td>
<td style="text-align:center">—&gt;</td>
<td>Sign Schema</td>
</tr>
</tbody>
</table>
</div><aside class="quote no-group" data-username="abitdodgy" data-post="14" data-topic="26123">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/abitdodgy/48/24328_2.png" class="avatar"> abitdodgy:</div>
<blockquote>
<p>If you separate them, you would have to duplicate and then synchronise shared data.</p>
</blockquote>
</aside>
<p>Yes, this means that data is duplicated and inconsistent between apps; this is fine, the document app will retrieve user info and transform it into a “sign schema” which is later stored into its own document database.</p>
<p>For practical purposes all schema relationships will be kept exclusively to the bounds of the app, my only SQL joins will be between the “document” and “sign” tables. It may be a naive strategy for the medium or long term but I like how this design is settling down.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="147595" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/different-apps-shared-database-different-schema-a-good-idea/26123/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-147595" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="147595"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>