投稿時間:2023-03-18 22:19:34 RSSフィード2023-03-18 22:00 分まとめ(22件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
js JavaScriptタグが付けられた新着投稿 - Qiita [ React ] useStateを使用して配列に追加する方法 https://qiita.com/takenokoEngineer/items/dc7695328f20494d6c80 importreactusestate 2023-03-18 21:29:14
Ruby Rubyタグが付けられた新着投稿 - Qiita form_withの使い方について https://qiita.com/isukacoffee4120/items/604a87617f5158b07b1c formwith 2023-03-18 21:04:19
AWS AWSタグが付けられた新着投稿 - Qiita AWS Certified DevOps Engineer - Professional(DOP-C02)を受験してみた https://qiita.com/ymd65536/items/a2e95a63d245aefed00c devops 2023-03-18 21:38:39
AWS AWSタグが付けられた新着投稿 - Qiita 【AWS】DNS Firewallをもっと愛そう!~Network Firewall vs DNS Firewall~ https://qiita.com/koheiawa/items/015219f8fd11e7e668e5 application 2023-03-18 21:08:57
Azure Azureタグが付けられた新着投稿 - Qiita Azure Front Door, Web App, Data Lakeの接続をPrivate Endpoint経由で構成する https://qiita.com/smr1/items/f28f2833bf978cdcbf10 frontdoo 2023-03-18 21:10:05
Ruby Railsタグが付けられた新着投稿 - Qiita form_withの使い方について https://qiita.com/isukacoffee4120/items/604a87617f5158b07b1c formwith 2023-03-18 21:04:19
技術ブログ Developers.IO Projects on GitHub Mobileが公開ベータになりました https://dev.classmethod.jp/articles/projects-on-github-mobile-is-now-in-public-beta/ pullr 2023-03-18 12:29:39
海外TECH MakeUseOf 6 Apps and Software to Jumpstart Your Podcast Creation Journey https://www.makeuseof.com/apps-software-to-start-podcast/ right 2023-03-18 12:30:16
海外TECH MakeUseOf What Is a Type 1 Hypervisor? https://www.makeuseof.com/what-is-a-type-1-hypervisor/ software 2023-03-18 12:15:16
海外TECH MakeUseOf What Is the Windows Registry and How Do I Edit It? https://www.makeuseof.com/tag/what-is-the-windows-registry-editor-and-how-do-i-use-it-makeuseof-explains/ changes 2023-03-18 12:05:15
海外TECH DEV Community InterOp - what can we actually expect this year? https://dev.to/robole/interop-what-can-we-actually-expect-this-year-1p66 InterOp what can we actually expect this year Since the InterOp initiative initially called Compat gathered the major browser vendors and some consulting parties to solve the top browser compatibility issues They create a list of focus areas and investigations each year to work on This colloboration has yielded positive results and has been well received by the front end community However it is vague what they are delivering Let s see if we can uncover what we can expect from this initiative InterOp proposed improvementsInterop covers types of improvements Focus areas cover parts of the platform where there is already a high quality specification and good test coverage in web platform tests Progress is measured by looking at the pass rate of those tests across implementations Investigations are for areas where interoperability is lacking but progress cannot be made by passing existing tests The reasons for this could be that there is not a good specification or tests for an area or areas might be hard to test due to missing test infrastructure Many of the focus areas do not have clear explicit objectives In many cases it is not obvious what is expected to be delivered or what underlying issues are being solved The complete list of focus areas can be seen in the Interop readme As you can see from the screenshot above the has focus area has a description of TODO Each of the stakeholders wrote an announcement blog post of their participation For the most part they are declaring their involvement but Apple takes some time to outline the focus areas Apple Pushing Interop Forward in Bocoup Interop UpdateGoogle Interop Igalia Interop Microsoft Microsoft Edge and Interop Mozilla Announcing Interop There is more info buried in the proposals and test suites I will do some digging later to try to consolidate this information I think that the project would benefit from clearer objectives Reporting can become disingenuous if little is explicitly stated in advance and everything is tied to a test suite It appears that ambitions have grown in InterOp there are focus areas this year up from last year Considering that they didn t complete everything last year more than half of the focus areas from were incomplete it seems like a big ask I applaud the audacity but I wonder if the resources and motivation are sufficient for each of the browser engines to deliver Particularly I wonder if Firefox can handle the load In Mozilla laid off of its workforce The headcount of the entire company is now about going off figures quoted in Mozilla s contract with Google to have Google as the default search provider for Firefox was extended until this year Most of Mozilla s revenue comes from this contract with Google although they are trying to increase their revenue from their own commercial products now Something that is a big omission from InterOp in my opinion is priority I would like to see these focus areas ordered according to priority if everything is important nothing is important When November comes and the heat is on which focus areas will get the final push I think it is fair to say that it is outside of the purview of InterOp to tell us everything that is coming for the year InterOp is not Santa Claus for the web Browser vendors still act independently and have different agendas I would like to see browser vendors communicate more on what they intend to do in general Let s review the focus areas and see what we can expect Interop focus areas explainedI will discuss each focus area to try to uncover what we can expect in the coming year from InterOp Border image CSS The border image CSS property draws an image around a given element It replaces the element s border It opens up a world of possibilities for how a border can look For example this codepen demonstrates having a brass picture frame as the border image for text content You can edit the text and resize the content area to see how the border stretches to cover the change in dimensions See the Pen Framed content by Rob robjoeol on CodePen The border image property is in all major browsers InterOp aims to make the improvements required to make it consistent across all browsers MDN has the following warning currently when using the property Note You should specify a separate border style in case the border image fails to load Although the specification doesn t strictly require it some browsers don t render the border image if border style is none or border width is Color spaces and functions CSS It is not clear what Interop will do in this focus area exactly I assume it is to do with implementing the CSS Color Module Level specification completely and consistently across all major browsers and maybe some of CSS Color Module Level specification In summary the CSS Color Module Level specification adds new color spaces such as lab and lch that enable a richer range of colors to be used on the web along with providing more flexible and consistent syntaxes for existing color functions As Lea Verou of the CSS working group put it with regard to color spaces Our websites are washed out because screens advanced faster than CSS Color did If we want to make full use of the range of colors that the majority of screens are capable of displaying we need to use new CSS colors formats lab lch or display p The new features in this specification are lab lch oklab and oklch functions for device independent color CSS colors are no longer restricted to the narrow gamut of sRGB The wide color gamut RGB color space is predefined now RGB color spaces Attribution Wikimedia under CC BY Currently the support for the new color functions is as follows lab and lch are in Chrome and Safari oklab is in Safari oklch is in Safari The following syntax changes have been added rgb and rgba functions now accept rather than so that a fractional number can be accepted hsl and hsla functions now accept as well as for hues rgb and rgba and hsl and hsla are now aliases of each other all of them have an optional alpha rgb rgba hsl and hsla have all gained a new syntax consisting of space separated arguments and an optional slash separated opacity All the color functions use this syntax form now in keeping with CSS s functional notation design principles All uses of now accept as well as and digit hex colors have been added to specify transparency The none value has been added to represent powerless components These syntax changes appear to be in browsers now Read the High definition CSS color guide to learn about these new color types and spaces The CSS Color Module Level specification introduces the color mix and color contrast functions Google mentioned that the CSS Color Module Level specification was part of the scope for InterOp but it was not done Is it in scope for this year According to Chrome s Platform Status CSS Color Module Level and color mix are slated for Chrome v March All features described in CSS Color are now enabled This includes four device independent color types lab Oklab lch and Oklch the color function and user defined color spaces for gradients and animations The incredibly useful color mix function from CSS Color has also been included as a bonus A bonus Or a year late The color mix function has been an experimental feature in Safari and Firefox for some time It is not clear if it will be adopted properly by all major browsers The color contrast color function is in Safari My guess is that color contrast won t make the cut this year Container queries CSS Container queries simplify responsive web design in the web component era It allow us to apply styles based on the size of a containing element rather than the viewport or other device characteristics For example if a container has less space in the surrounding context you can hide certain elements or use smaller fonts Image attributed to CSS Container Queries by Mozilla Contributors is licensed under CC BY SA Container Queries shipped last year in Chrome and Safari Firefox has just shipped container queries in Firefox Feb Presumably the objective is to improve the passing rate for the test suite to ensure that container queries work reliably across browsers Containment CSS The objective of the CSS Containment specification is to improve the performance of web pages by allowing the browser to isolate a subtree of the page from the rest of the page The specification defines the CSS properties contain contain intrinsic size and content visibility for this My naive interpretation of these properties is that contain provides a hint to the browser that it can render parts of the page independently whereas content visibility is more prescriptive where you can say don t need to render this subsection until it is needed kind of like lazy loading The proposal for this focus area states The contain CSS property is a prerequisite for content visibility but that is already part of Interop The contain intrinsic size property is important to provide an easy way to reserve placeholder sizing for content visibility subtrees It also enables full content visibility auto adoption without the need for any script The contain property is in all major browsers now but it appears contain requires more tests to stabilize its usage The content visibility property is in Chrome and Edge Mozilla previously stated that it is worth prototyping Can we surmise that the goal is to get containment completed this year then Pseudo classes CSS This focus area covers a collection of CSS pseudo classes dir nth child nth last child nth of type nth last of type modal user valid and user invalid The objective is to improve interoperability Custom properties CSS Basic support for custom properties has been in browsers a long while Interop will focus on the property at rule which is part of CSS Houdini The property at rule allows developers to explicitly define their own custom properties allowing for property type checking setting default values and define whether a property can inherit values or not It allows you to write semantically meaningful CSS within CSS itself For example you could define your own primary color property primaryColor syntax lt color gt initial value pink inherits false And use it anywhere like a regular custom property card background color var primaryColor pink If you assign an incorrect type of value it will fallback to the default card primaryColor incorrect type background color var primaryColor background color falls back to pink This overcomes the weird fallback issue with custom properties Flexbox CSS Flexbox is a one dimensional layout method for arranging items in rows or columns It is a mature CSS stalwart now Over that time the Flexbox specification has matured with both slight behavior changes and updated clarifications of precise details Looking at the test suite it looks like the goal is to expand test coverage to make flexbox more consistent and stable Font feature detection and palettes CSS The Interop group describe this focus area as enable testing for font stack capabilities and enable additional expressiveness with vector color fonts Font feature detection and palettes This appears to refer to widening the capabilities of the supports at rule which has functions that can be used to conditionally check font features through the font tech andfont format The font tech function can check if a browser supports a specified font technology for layout and rendering For example the CSS following checks if the browser supports the COLRv font technology multi colored glyphs via COLR version table and if it is supported sets the font family for the document body import url Spice supports font tech color COLRv body font family Bungee Spice I do not know much about these new font features You can read about color fonts in this post The current browser support is font tech Firefox font format Firefox Forms HTML The HTML element defines a document section containing interactive controls for submitting information to a server Support for vertical text in form fields has been missing Interop is a commitment by the industry to change this This focu area also carries over the tests from Interop This includes tests for the appearance property form events on disabled form controls input elements form submission and form validation Grid CSS CSS Grid is a layout method that provides a two dimensional grid system Looking at the test suite it looks like the goal is to expand test coverage to make grid more consistent and stable The has pseudo class CSS Developers have been wishing for a parent selector in CSS forever The has pseudo class makes possible many of the use cases for a parent selector as well as the selection of a previous sibling element with respect to a reference element The has pseudo class landed in Chrome and Safari last year but it is still in an experimental state in Firefox It will take more effort this year for it to be consistently implemented across all browsers The inert attribute HTML The inert HTML attribute makes the browser ignore user input events for an element This can be useful when building UIs such as modals where you would want to trap the focus inside the modal when it s visible The inert attribute is in Chrome and Safari I guess that it will be coming soon to Firefox Masking CSS Support for CSS masking is patchy Using masking is harder to use than it should be This focus area will help developers to confidently use creative masking effects cross browser This was on my wishlist for CSS improvements that I discussed in my previous article Math functions CSS New groups of math functions are proposed in the CSS Values and Units Module Level specification The implementation of these math functions has been sporadic so far presumably the expectation is that the following functions will be added in the next year trigonometric calculations such as sin Calculates the trigonometric sine of a number cos Calculates the trigonometric cosine of a number tan Calculates the trigonometric tangent of a number asin Calculates the trigonometric inverse sine of a number acos Calculates the trigonometric inverse cosine of a number atan Calculates the trigonometric inverse tangent of a number atan Calculates the trigonometric inverse tangent of two numbers in a plane exponential functions such as pow Calculates the base raised to the power of a number sqrt Calculates the square root of a number hypot Calculates the square root of the sum of the squares of its arguments log Calculates the logarithm of a number exp Calculates e raised to the power of a number sign related functions such as abs Calculates the absolute value of a number sign Calculates the sign positive or negative of the number stepped values such as round Calculates a rounded number based on a rounding strategy mod Calculates a modulus with the same sign as the divisor when dividing one number by another rem Calculates a remainder with the same sign as the dividend when dividing one number by another The browser support and indications for implementation of the math functions are as follows Trigonometric functions Chrome will ship the trigonometric functions in the next version v Then the trigonometric functions will be in all major browsers Exponential functions Are in Safari Sign related functions Are in Safari are under development in Chrome and there is no signal from Firefox about development Stepped values functions Are in Safari Firefox has rem and round implemented as an experimental features If you are wondering what use these math functions are here are some use cases Can improve data visualization and charts Especially for frameworks like Charts CSS that use no JavaScript Trigonometric functions can be usd to place items on a shape Satisfy additional needs inside CSS animations such as symmetries in staggered animations and animating shadows in D scenes For fluid layouts you can replace units with more complex calculations Ana Tudor wrote an article an inspiring article titled Using Absolute Value Sign Rounding and Modulo in CSS Today listing some use cases for math and some work arounds to do things with these math functions Media queries CSS Media Queries allow you to apply CSS styles depending on the medium print or screen or a device s characteristics such as screen resolution or browser viewport width This focus area is to implement the Media Queries Level specification The specification has reasonable support in modern browsers but some media features are not well supported The major additions are Media features with numeric values can now be written in a range context For example media width lt em is the equivalent of media max width em The pointer any pointer hover any hover update color gamut overflow block and overflow inline media features were added Modules in Web Workers JavaScript Web Workers are a simple means to run scripts in background threads The worker thread can perform tasks without interfering with the user interface Until now it is a bit clunky to organize your code when writing a web worker An importScripts function is available within web workers for loading additional code but it pauses execution of the worker in order to fetch and evaluate each script It also executes scripts in the global scope like a lt script gt tag which means you can have some unwanted side effects if you are not mindful JavaScript modules will be added to web workers to address these shortcomings They are referred to as module workers The Worker constructor now accepts a new type module option which changes script loading and execution to match lt script type module gt const worker new Worker worker js type module In the module worker you can use import and export statements Dependencies are only executed once in the given context and all future imports reference the already executed module instance It looks like this is in all major browsers now except for Firefox The expectation is that Firefox will add support this year You can read this web dev article for more info on module workers Threading the web with module workers Motion path CSS Motion Path allows animation of any graphical object along a custom path This enables the addition of more dynamic movement in CSS animations Motion Path is now supported in all major browsers but there are failing tests in the test suites that need attention This focus area is to reach a higher bar of interoperability You can explore some examples in the following article CSS Motion Path The end of GSAP OffscreenCanvas API JavaScript This is one that I am excited about The canvas element and Canvas API provide a scriptable way to draw graphics in a web page However this can cause performance problems as the work is performed on the same thread as user interaction OffscreenCanvas offers developers a canvas which is decoupled from the DOM and the Canvas API Developers can run rendering tasks in a Web Worker separate from the main thread Currently OffscreenCanvas is in Chrome and Firefox and has just arrived in Safari as an experimental feature The test suite suggests that the objective is to get a consistent outcome across the browsers Pointer and Mouse Events JavaScript Pointer and mouse events are DOM events that are fired for a pointing device such as a mouse pen stylus or touch such as one or more fingers This focus area looks to improve pointer and mouse events with regard to hit accuracy and scrolling areas Interop have decided to explicitly exclude touch and stylus inputs due to lack of WPT testing support across all browsers Scrolling CSS The focus area is a carryover from Interop There s more work to do to increase interoperability so everyone agreed to include it again The scroll behavior overscroll behavior and the scroll snap CSS properties allow authors to influence how scrolling behaves It appears that all major browsers have implemented the scroll related properties outlined in the CSS Overflow Module Level specification The test suite suggests that it is a question of ironing out issues Subgrid CSS Subgrid allows a grid item with its own grid to align in one or both dimensions with its parent grid Subgrid is currently supported in all major browsers except Chromium based browsers It is under development for Chrome Transforms CSS This focus area is continued on from Interop The transform CSS property lets you rotate scale skew or translate an element in two or three dimensional space Over the last two years engineers at Firefox Chrome and Safari have been closely collaborating to improve the interoperability of D Interop aims to raise the number of tests that pass in all three browser engines up from its current URL API JavaScript The URL API is used to parse construct normalize and encode URLs This focus area is to get all browsers to agree on the implementation of URLs as defined in the URL Standard You should not need to manipulate URLs client side very often we are moving away from Single Page Apps right Web Codecs API JavaScript The WebCodecs API gives web developers low level access to the individual frames of a video stream and fragments of audio This is useful for web apps that require full control over the way media is processed such as video editors and video conferencing apps The Web Codecs API is supported in Chrome and Firefox and just arrived in Safari as an experimental feature Interop will focus on the video processing portion of WebCodecs Web Compat CSS and JavaScript This is a catchall focus area for small bugs that cause known site compatibility issues For a whole new set of tests have been selected They include tests for Regex Lookbehind inline editing event dispatching on disabled controls CSS image set white space and text emphasis Web ComponentsWeb Components are a suite of different technologies that enable the creation of reusable custom elements They enable building web apps in a similar manner to popular UI frameworks such as React Interop README states that they will focus on improving the interoperability of these foundational technologies including Constructable stylesheets adoptedStyleSheets ElementInternals Form associated Custom Elements and the basic behavior of Shadow DOM and Custom Elements I won t comment on this one because I find the story of web components bewildering It is something that I would like to delve into Is Interop focusing on the right things This is quite a subjective question Your answer will depend on whether you work on the front of the front end or back of the front end what kind of day job you have pain points you feel on a daily basis what your interests are side projects and hobbies and what your preferences are for tools and tech stacks I think last year the focus areas were well short of what is important to an average developers This year they look more in line with what a typical developer would like to see Final thoughtsI would be delighted if the proposals in InterOp are delivered InterOp is ambitious I am skeptical about the capacity to execute It will be interesting to revisit this next year to see if this is an accurate forecast of features and improvements coming to browsers Fingers crossed You can subscribe to my RSS feed to get my latest articles 2023-03-18 12:18:14
海外TECH DEV Community Multi-tenant implementation approaches with Prisma and ZenStack https://dev.to/zenstack/multi-tenant-implementation-approaches-with-prisma-and-zenstack-4p20 Multi tenant implementation approaches with Prisma and ZenStack Why multi tenant is trendingCollaboration has become crucial in the contemporary business landscape This is due to the mounting complexity of the challenges we face as well as the prevalence of remote work Businesses are realizing that effective collaboration is the key to success as it promotes teamwork enhances productivity and leads to better outcomes The adoption of team spaces has become ubiquitous across various SaaS categories to facilitate collaboration Communication Slack Microsoft teams Project Management Trello Basecamp Documentation Notion Marketing tools Hubspot Mailchimp Data analytics PowerBI Airtable Design Figma SketchNot surprisingly it is also a standard kit in the software development world as evidenced by Vercel Supabase and also our leading actor Prisma s data platform To support that technically you need to implement the multi tenant system to complete the mission users from tenant A should not be able to access data from tenant B and vice versa Different approachesThere are two primary approaches to implementing multi tenancy using relational databases which are determined by whether there is physical isolation for data in the database Multiple databasesEach tenant will have its own database like the below How to implementThe idea behind it is quite straightforward You need to have a separate instance of database client for each tenant database For example using Prisma and Nest js the code would be like this Injectable class PrismaClientManager the client instances cache object private clients key string PrismaClient retrieve and return the tenant ID from the request object getTenantId request Request string getClient request Request PrismaClient const tenantId this getTenantId request let client this clients tenantId create and cache a new client when needed if client const databaseUrl process env DATABASE URL replace public tenantId client new PrismaClient datasources db url databaseUrl this clients tenantId client return client Injectable scope Scope REQUEST export class MyService private prisma PrismaClient constructor Inject REQUEST request Request prismaClientManager PrismaClientManager this prisma prismaClientManager getClient request findAll just use this prisma to access the database This is just a simplified version In your specific production case you might also need to consider other issues like connection pool if you have a high rate of simultaneous requests Pros SecurityThis is highly secure as it s isolated from the database point of view So it s really hard for one tenant to see another tenant s data accidentally even if you have a sloppy developer ScalabilityIt is flexible to make the load balance between high volume tenants and low volume tenants Also you have good control that one busy tenant won t affect the neighbors CustomizationYou can have customized data schema functionality and maintenance strategies for different tenants ConsMaintainabilityThis is probably the one and only reason most people ditched it for the other approach Maintaining dozens of databases might be affordable but what about thousands or millions of databases like Notion At that level you definitely couldn t maintain it manually Instead you probably need a set of automation to handle tasks like backup monitoring etc In my experience with a data analytics product we had a feature that created a separate database for each tenant to store and calculate their uploaded data Luckily for me there is a database operation team Despite having a good personal relationship the database operations team still found it challenging to manage thousands of databases They described it as a burden and a hindrance whenever they wanted to make infrastructure changes When we eventually refactored the code to eliminate this approach our database operations team was so pleased that they took us out to a fancy dinner to celebrate Cross tenant data sharingThere is often data that is meant to be shared between tenants such as project templates resources and global configurations One way to handle this is to duplicate this data in each tenant s database which can then lead to synchronization issues that need to be resolved Alternatively a shared database can be used to store this data which adds complexity to the system Cross tenant AnalysisIf you need to run queries or reports across all tenants which is a routine task for product marketing it becomes more difficult and time consuming You might end up adopting some ETL tools to do so When to use it When security and data isolation is your number one concern When some tenants are expected to have significantly larger data volumes compared to the normal tenants which is usually the case for large Enterprise clients When the service requires a high degree of customization including ad hoc deployment Single databaseOne database holds the data for all tenants and every table has a unique tenantId like below How to implementNoviceSince databases don t take care of it you need to implement the whole logic by yourself Specifically you need to get the tenantId from every API request and make sure to use it as a filter when issuing the database operation While this process may not be more difficult than the single database approach in some cases it depends on the complexity of the business model For instance the implementation of teamId in cal com is not complex However when your business logic becomes more complex and requires more developers to collaborate together it will become error prone and hinders developer productivity The reason is that this tenant isolation logic is dispersed in your code base It is possible that a developer forgets or incorrectly sets the filter somewhere I saw this kind of bug very common in the development cycle of our SaaS product before IntermediateFortunately using a tool like Prisma can help you manage this logic in a centralized way eliminating the need for individual developers to worry about it You can implement this by using either middleware or client extension For instance you can create a simplified middleware implementation that looks like the following const tenantMiddleware model gt async params next gt const tenantId getTenantId params params args where params args where tenantId return next params However there are some issues with this approach as specified below Comment for larskarbo commented on Jun I went down the path with the soft delete middleware docs But realized like many here have mentioned that this only works in very simple usecases Can t handle complex queries with AND every etc chrissisura s comment shows this Can t handle include like euberdeveloper mentioned update doesn t return correct type this is documented in the prisma article In other words the best approach right now is probably the option mentioned in the article Implement filters in your own application code instead of trying to make this work with middlewares Examples where the middleware approach would fall short This would include soft deleted rooms because of complex where const rooms await prisma room findMany where AND something true This would include soft deleted rooms const building await prisma building findUnique where id include rooms true View on GitHub TLDR the biggest problem is that it would fall short when the relation field is involved in the filter AdvancedIf you are using Postgres as your database or a service provider that is based on it such as Supabase you have the advantage of utilizing the advanced feature of RLS Row Level Security provided by the database This way defining role based access policies in the database becomes the primary task to control which rows of data can be accessed CREATE POLICY tenant user isolation policy ON tenant userUSING tenant id TEXT current user After that for every request you just need to specify the role getting from the user Prisma hasn t officially supported it but you can find the solution and caveat from the below issue Supporting Postgres SET across queries of a request matthewmueller posted on Jan ProblemIn Postgres you can set a user for a connection on the database await prisma executeRaw SET current user id currentUser id This SET can then be used in combination with row level security RLS to issue queries like this select from messagesthat only give you back messages from that user This technique is used by Postgraphile and Postgrest and really takes advantage of what Postgres offers Without access to the connection pool there s no way to guarantee you ll get the same connection each query Since SET values are bound to the query subsequent queries may be missing the SET or may even override another request s SET I m not sure what the best approach is Tying a connection to the lifecycle of a request has its own performance implications A point of reference potentially worth investigating Go s standard SQL library uses a connection pool under the hood that s transparent to developers Do they run into this problem too If so do they or how do they deal with it Originally from issuecomment View on GitHub TLDR it s not easy to make it right ProsCons for multiple database approach ConsPros for multiple database approach When to use it When your tenants are small to medium sized and do not have large amounts of data or high transaction volumes This is usually the case for SMB clients When you provide standard product features for all the customers except those restricted by the plan When you can t afford to have dedicated people manage the database instances Innovative approachI love the way about RLS of centralizing the isolation policies in one place Would it be better if this policy could stay along with the data model of the application Here comes the full stack toolkit ZenStack we are building One of the most important things ZenStack is trying to solve is allowing you to define access policies directly inside your data model so it s easier to keep the policies in sync when your data models evolve ZModel the modeling DSL of ZenStack is a superset of the Prisma schema For example let s add the Space tenant concept to the classical Prisma Post example The Primsa schema would look like below model User id String id default uuid name String spaces SpaceUser posts Post model Space id String id default uuid name String members SpaceUser posts Post model SpaceUser id String id default uuid space Space relation fields spaceId references id onDelete Cascade spaceId String user User relation fields userId references id onDelete Cascade userId String model Post id String id default uuid title String content String owner User relation fields ownerId references id onDelete Cascade ownerId String space Space relation fields spaceId references id onDelete Cascade spaceId String To make Post tenant isolation you just need to add the below access policy model Post id String id default uuid title String content String owner User relation fields ownerId references id onDelete Cascade ownerId String space Space relation fields spaceId references id onDelete Cascade spaceId String can be read by owner or space members only if not private allow read owner auth space members user auth when create owner must be set to current user and user must be in the space allow create owner auth amp amp space members user auth when create owner must be set to current user and user must be in the space update is not allowed to change owner allow update owner auth amp amp space members user auth amp amp future owner owner can be deleted by owner allow delete owner auth Then whenever the place you use the Prisma client just wrap it with the withPresets provided by ZenStack This way tenant isolation will be automatically applied in all parts of your application that use the Prisma client whether it s React Hooks tRPC routers generated by ZenStack or APIs that you implement yourself If you feel interested in the access policy you can find more detail below Understanding Access PoliciesThere is also a tutorial for how to create the project step by step How to build a collaborative SaaS product using Next js and ZenStack s access control policy Easter EggI love the way about ZenStack of using a declarative way to define the access policy in the schema However when it comes to tenant isolation it appears that for each model I have to duplicate the same access policies in the Post model above it Would it be better if there is a way it could be reused Here comes the inheritance feature we are working on model Basic id String id default uuid createdAt DateTime default now updatedAt DateTime updatedAt owner User relation fields ownerId references id onDelete Cascade ownerId String space Space relation fields spaceId references id onDelete Cascade spaceId String allow read owner auth space members user auth allow create owner auth amp amp space members user auth allow update owner auth amp amp space members user auth amp amp future owner owner allow delete owner auth model Post extends Basic title String content String So if you need to add a new Comment model you can just extend the Basic model Then you can define it as what you always do in Prisma model Comment extends Basic content String post Post relation fields postId references id onDelete Cascade postId String The tenant isolation is still handled seamlessly in the background Consider the benefits of having a newly hired developer who is unfamiliar with the multi tenant concept Despite their lack of understanding they can still perform their job without causing any issues If you like it join our Discord or follow our GitHub You will get to use it the first time it is released in ZenStack 2023-03-18 12:14:45
Apple AppleInsider - Frontpage News Daily deals March 18: $100 off M2 Mac mini, $250 off Apple Studio Display, up to 48% off Cricut, more https://appleinsider.com/articles/23/03/18/daily-deals-march-18-100-off-m2-mac-mini-250-off-apple-studio-display-up-to-48-off-cricut-more?utm_medium=rss Daily deals March off M Mac mini off Apple Studio Display up to off Cricut moreToday s top deals include off a Flexispot standing desk off an Xbox Series X and off a Lego Speed Champions Fast Furious Nissan Skyline GT R kit Save big on the Apple Studio Display The AppleInsider staff team searches the internet for excellent deals at online retailers to create a list of can t miss deals on popular tech items including discounts on Apple products TVs accessories and other gadgets We post our top finds in our Daily Deals list to help you save money Read more 2023-03-18 12:22:48
海外科学 NYT > Science Wyoming Becomes First State to Outlaw the Use of Pills for Abortion https://www.nytimes.com/2023/03/17/us/wyoming-abortion-pills-ban.html Wyoming Becomes First State to Outlaw the Use of Pills for AbortionThe law is the only one in the nation to prohibit the use separate from a total abortion ban and is part of a growing effort by conservative states to target the pills 2023-03-18 12:54:01
ニュース @日本経済新聞 電子版 電気料金値上げ、申請より圧縮 直近の燃料費反映で東京電力など6社 https://t.co/ISEvQqJlzF https://t.co/1UJUuFibYq https://twitter.com/nikkei/statuses/1637076420508753921 東京電力 2023-03-18 13:00:08
ニュース @日本経済新聞 電子版 テックの祭典SXSW、「気候」急成長 ユニコーン80社超 https://t.co/ixs8yWmCpB https://twitter.com/nikkei/statuses/1637074616874340354 祭典 2023-03-18 12:52:58
ニュース @日本経済新聞 電子版 「名刺を切らしておりまして…」所属企業隠しは違法か https://t.co/miRWu4DiM7 https://twitter.com/nikkei/statuses/1637068853690679297 隠し 2023-03-18 12:30:04
ニュース @日本経済新聞 電子版 国内コロナ感染、新たに7123人 累計3338万4829人 https://t.co/Xga6aDCO6I https://twitter.com/nikkei/statuses/1637063189602119680 累計 2023-03-18 12:07:34
ニュース BBC News - Home SNP chief executive Peter Murrell resigns over membership row https://www.bbc.co.uk/news/uk-scotland-65000606?at_medium=RSS&at_campaign=KARANGA effect 2023-03-18 12:48:57
ニュース BBC News - Home Imran Khan supporters clash with police outside court https://www.bbc.co.uk/news/world-asia-64998922?at_medium=RSS&at_campaign=KARANGA lahore 2023-03-18 12:45:49
ニュース BBC News - Home Putin arrest warrant: Biden welcomes ICC's war crimes charges https://www.bbc.co.uk/news/world-europe-64998165?at_medium=RSS&at_campaign=KARANGA ukrainian 2023-03-18 12:22:04
ニュース BBC News - Home Patrick Vieira: Crystal Palace panicked in sacking boss says Martin Keown https://www.bbc.co.uk/sport/av/football/65000635?at_medium=RSS&at_campaign=KARANGA Patrick Vieira Crystal Palace panicked in sacking boss says Martin KeownFootball Focus pundit Martin Keown says Crystal Palace made a panicked decision in sacing Patrick Vieira as manager ahead of the weekend s Premier League fixture against leaders Arsenal 2023-03-18 12:34:26

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)